initial working version

This commit is contained in:
2025-11-23 10:47:37 +01:00
commit 44ce6e38dd
50 changed files with 3106 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
CREATE TABLE "items" (
"id" uuid PRIMARY KEY NOT NULL,
"wishlist_id" uuid NOT NULL,
"title" text NOT NULL,
"description" text,
"link" text,
"image_url" text,
"price" numeric(10, 2),
"priority" text DEFAULT 'medium',
"is_reserved" boolean DEFAULT false NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "reservations" (
"id" uuid PRIMARY KEY NOT NULL,
"item_id" uuid NOT NULL,
"reserver_name" text,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "wishlists" (
"id" uuid PRIMARY KEY NOT NULL,
"title" text NOT NULL,
"description" text,
"owner_token" text NOT NULL,
"public_token" text NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "wishlists_owner_token_unique" UNIQUE("owner_token"),
CONSTRAINT "wishlists_public_token_unique" UNIQUE("public_token")
);
--> statement-breakpoint
ALTER TABLE "items" ADD CONSTRAINT "items_wishlist_id_wishlists_id_fk" FOREIGN KEY ("wishlist_id") REFERENCES "public"."wishlists"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "reservations" ADD CONSTRAINT "reservations_item_id_items_id_fk" FOREIGN KEY ("item_id") REFERENCES "public"."items"("id") ON DELETE cascade ON UPDATE no action;