kinda stuck at this point so making a commit

This commit is contained in:
2024-10-31 00:19:02 +01:00
parent cd7d9fa3b7
commit 6d65463286
35 changed files with 44224 additions and 217 deletions

View File

@@ -0,0 +1,31 @@
-- Add up migration script here
CREATE TABLE "owner_history" (
"id" BIGSERIAL NOT NULL,
"aircraft_id" BIGSERIAL NOT NULL,
"pilot_id" uuid NOT NULL,
"since" timestamp DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "owner_history_pkey" PRIMARY KEY ("id")
);
-- Pilot currently occupying/flying aircraft
CREATE TABLE "pilot_current_aircraft" (
"pilot_id" uuid NOT NULL,
"aircraft_id" uuid NOT NULL,
CONSTRAINT "pilot_aircraft_pkey" PRIMARY KEY ("pilot_id", "aircraft_id"),
) WITH (oids = false);
CREATE TABLE "flight_log" (
"id" BIGSERIAL NOT NULL,
"pilot_id" uuid NOT NULL,
"aircraft_id" uuid NOT NULL,
"takeoff_time" timestamp DEFAULT CURRENT_TIMESTAMP,
"takeoff_latitude_deg" NUMERIC NOT NULL,
"takeoff_longitude_deg" NUMERIC NOT NULL,
"takeoff_elevation_ft" NUMERIC NOT NULL DEFAULT 0,
"landing" timestamp,
"landing_latitude_deg" NUMERIC NOT NULL,
"landing_longitude_deg" NUMERIC NOT NULL,
"landing_elevation_ft" NUMERIC NOT NULL DEFAULT 0,
CONSTRAINT "flight_log_pkey" PRIMARY KEY ("id")
);