Skip to content

Commit

Permalink
feat: added share trip route, added get trip route. test: added integ…
Browse files Browse the repository at this point in the history
…ration test for both
  • Loading branch information
joshuaisaact committed Nov 27, 2024
1 parent 256e7d6 commit 435e4e8
Show file tree
Hide file tree
Showing 16 changed files with 758 additions and 3 deletions.
15 changes: 15 additions & 0 deletions drizzle/20241126124900_strong_tyger_tiger.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CREATE TABLE IF NOT EXISTS "shared_trips" (
"id" serial PRIMARY KEY NOT NULL,
"user_id" uuid NOT NULL,
"trip_id" serial NOT NULL,
"share_code" text NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"expires_at" timestamp with time zone,
CONSTRAINT "shared_trips_share_code_unique" UNIQUE("share_code")
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "shared_trips" ADD CONSTRAINT "shared_trips_trip_id_trips_trip_id_fk" FOREIGN KEY ("trip_id") REFERENCES "public"."trips"("trip_id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
Loading

0 comments on commit 435e4e8

Please sign in to comment.