init push
This commit is contained in:
30
migrations/20260409_flight_inspections.sql
Normal file
30
migrations/20260409_flight_inspections.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE IF NOT EXISTS flight_inspections (
|
||||
id BINARY(16) PRIMARY KEY,
|
||||
helicopter_id BINARY(16) NOT NULL,
|
||||
inspection_date DATE NOT NULL,
|
||||
operation_id BINARY(16) NULL,
|
||||
status ENUM('Draft', 'InProgress', 'Completed') NOT NULL DEFAULT 'Draft',
|
||||
before_flight_completed_at DATETIME NULL,
|
||||
before_flight_completed_by BINARY(16) NULL,
|
||||
flight_prep_completed_at DATETIME NULL,
|
||||
flight_prep_completed_by BINARY(16) NULL,
|
||||
after_flight_completed_at DATETIME NULL,
|
||||
after_flight_completed_by BINARY(16) NULL,
|
||||
final_completed_at DATETIME NULL,
|
||||
final_completed_by BINARY(16) NULL,
|
||||
created_at DATETIME NULL,
|
||||
created_by BINARY(16) NULL,
|
||||
updated_at DATETIME NULL,
|
||||
updated_by BINARY(16) NULL,
|
||||
CONSTRAINT fk_flight_inspections_helicopter FOREIGN KEY (helicopter_id) REFERENCES helicopters(id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_flight_inspections_helicopter_id ON flight_inspections(helicopter_id);
|
||||
CREATE INDEX idx_flight_inspections_inspection_date ON flight_inspections(inspection_date);
|
||||
CREATE INDEX idx_flight_inspections_status ON flight_inspections(status);
|
||||
CREATE INDEX idx_flight_inspections_operation_id ON flight_inspections(operation_id);
|
||||
CREATE INDEX idx_flight_inspections_helicopter_date ON flight_inspections(helicopter_id, inspection_date);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE IF EXISTS flight_inspections;
|
||||
Reference in New Issue
Block a user