first commit
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
-- Initial schema for otto trips and activities
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "trips" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"destination" text NOT NULL,
|
||||
"lat" numeric,
|
||||
"lng" numeric,
|
||||
"start_date" timestamptz,
|
||||
"num_days" integer NOT NULL,
|
||||
"total_budget" numeric,
|
||||
"currency" text DEFAULT 'EUR',
|
||||
"preferences" jsonb DEFAULT '[]'::jsonb,
|
||||
"experience_mode" text DEFAULT 'balanced',
|
||||
"estimated_total_cost" numeric,
|
||||
"created_at" timestamptz DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "activities" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"trip_id" uuid,
|
||||
"day_number" integer NOT NULL,
|
||||
"start_time" text,
|
||||
"title" text NOT NULL,
|
||||
"type" text NOT NULL,
|
||||
"estimated_cost" numeric,
|
||||
"address" text,
|
||||
"lat" numeric,
|
||||
"lng" numeric,
|
||||
"rating" numeric,
|
||||
"source" text,
|
||||
"source_url" text,
|
||||
"notes" text,
|
||||
"order_in_day" integer DEFAULT 0,
|
||||
CONSTRAINT "activities_trip_id_fkey" FOREIGN KEY ("trip_id") REFERENCES "trips"("id") ON DELETE cascade
|
||||
);
|
||||
|
||||
-- Helpful indexes
|
||||
CREATE INDEX IF NOT EXISTS "trips_created_at_idx" ON "trips" ("created_at");
|
||||
Reference in New Issue
Block a user