t3-code-android-nightly/.repos/alchemy-effect/examples/cloudflare-planetscale-postgres-drizzle/migrations/20260504073935_migration/migration.sql
Julius Marminge bd851c0203
chore: add Alchemy reference repo subtree (#2918)
Co-authored-by: codex <codex@users.noreply.github.com>
2026-06-03 00:08:31 +00:00

18 lines
543 B
SQL

CREATE TABLE "posts" (
"id" serial PRIMARY KEY,
"user_id" integer NOT NULL,
"title" text NOT NULL,
"body" text NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "users" (
"id" serial PRIMARY KEY,
"email" text NOT NULL UNIQUE,
"name" text NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "posts" ADD CONSTRAINT "posts_user_id_users_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE;