init push
This commit is contained in:
45
migrations/20260624_add_manual_seed_to_helicopter_usage.sql
Normal file
45
migrations/20260624_add_manual_seed_to_helicopter_usage.sql
Normal file
@@ -0,0 +1,45 @@
|
||||
-- +goose Up
|
||||
SET @has_manual := (
|
||||
SELECT COUNT(*)
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema = DATABASE()
|
||||
AND table_name = 'helicopter_usage'
|
||||
AND column_name = 'manual_airframe_hours'
|
||||
);
|
||||
|
||||
SET @sql := IF(
|
||||
@has_manual = 0,
|
||||
'ALTER TABLE helicopter_usage
|
||||
ADD COLUMN manual_airframe_hours DECIMAL(12,2) NOT NULL DEFAULT 0,
|
||||
ADD COLUMN manual_airframe_cycles INT NOT NULL DEFAULT 0,
|
||||
ADD COLUMN manual_engine_1_hours DECIMAL(12,2) NOT NULL DEFAULT 0,
|
||||
ADD COLUMN manual_engine_1_gpc_ng_n1 DECIMAL(12,2) NOT NULL DEFAULT 0,
|
||||
ADD COLUMN manual_engine_1_ptc_nf_n2 DECIMAL(12,2) NOT NULL DEFAULT 0,
|
||||
ADD COLUMN manual_engine_2_hours DECIMAL(12,2) NOT NULL DEFAULT 0,
|
||||
ADD COLUMN manual_engine_2_gpc_ng_n1 DECIMAL(12,2) NOT NULL DEFAULT 0,
|
||||
ADD COLUMN manual_engine_2_ptc_nf_n2 DECIMAL(12,2) NOT NULL DEFAULT 0,
|
||||
ADD COLUMN manual_landing INT NOT NULL DEFAULT 0,
|
||||
ADD COLUMN manual_flight_report INT NOT NULL DEFAULT 0,
|
||||
ADD COLUMN manual_hook_release INT NOT NULL DEFAULT 0,
|
||||
ADD COLUMN manual_rotor_brake_cycle INT NOT NULL DEFAULT 0',
|
||||
'SELECT 1'
|
||||
);
|
||||
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
-- +goose Down
|
||||
ALTER TABLE helicopter_usage
|
||||
DROP COLUMN manual_airframe_hours,
|
||||
DROP COLUMN manual_airframe_cycles,
|
||||
DROP COLUMN manual_engine_1_hours,
|
||||
DROP COLUMN manual_engine_1_gpc_ng_n1,
|
||||
DROP COLUMN manual_engine_1_ptc_nf_n2,
|
||||
DROP COLUMN manual_engine_2_hours,
|
||||
DROP COLUMN manual_engine_2_gpc_ng_n1,
|
||||
DROP COLUMN manual_engine_2_ptc_nf_n2,
|
||||
DROP COLUMN manual_landing,
|
||||
DROP COLUMN manual_flight_report,
|
||||
DROP COLUMN manual_hook_release,
|
||||
DROP COLUMN manual_rotor_brake_cycle;
|
||||
Reference in New Issue
Block a user