init push

This commit is contained in:
2026-07-16 22:16:45 +07:00
commit 8b068bdb10
1021 changed files with 332816 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
-- +goose Up
SET @has_status := (
SELECT COUNT(*)
FROM information_schema.columns
WHERE table_schema = DATABASE()
AND table_name = 'flight_data'
AND column_name = 'status'
);
SET @sql := IF(
@has_status = 0,
'ALTER TABLE flight_data ADD COLUMN status VARCHAR(20) NOT NULL DEFAULT ''on_going'' AFTER id',
'SELECT 1'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
UPDATE flight_data
SET status = 'on_going'
WHERE status IS NULL OR status = '';
-- +goose Down
SET @has_status := (
SELECT COUNT(*)
FROM information_schema.columns
WHERE table_schema = DATABASE()
AND table_name = 'flight_data'
AND column_name = 'status'
);
SET @sql := IF(
@has_status = 1,
'ALTER TABLE flight_data DROP COLUMN status',
'SELECT 1'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;