mirror of
https://github.com/VibedByKaKi/t3-code-android-nightly.git
synced 2026-10-09 20:01:15 +02:00
18 lines
543 B
SQL
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;
|