Add Drizzle + Postgres setup (task 03)

drizzle-orm + postgres driver + drizzle-kit wired up. Core schema declares
users, households, and household_members. docker-compose.dev.yaml runs
Postgres 16 locally. Initial migration generated and verified applied.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ginnoir
2026-05-06 01:21:40 -05:00
co-authored by Claude Sonnet 4.6
parent 09d6adbf18
commit 37977568ed
8 changed files with 1036 additions and 2 deletions
+24
View File
@@ -0,0 +1,24 @@
CREATE TYPE "public"."household_member_role" AS ENUM('owner', 'member');--> statement-breakpoint
CREATE TABLE "household_members" (
"household_id" uuid NOT NULL,
"user_id" uuid NOT NULL,
"role" "household_member_role" DEFAULT 'member' NOT NULL,
CONSTRAINT "household_members_household_id_user_id_pk" PRIMARY KEY("household_id","user_id")
);
--> statement-breakpoint
CREATE TABLE "households" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"name" varchar(255) NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "users" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"email" varchar(255) NOT NULL,
"display_name" varchar(255) NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "users_email_unique" UNIQUE("email")
);
--> statement-breakpoint
ALTER TABLE "household_members" ADD CONSTRAINT "household_members_household_id_households_id_fk" FOREIGN KEY ("household_id") REFERENCES "public"."households"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "household_members" ADD CONSTRAINT "household_members_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;