1
0
Fork 0
mirror of https://git.sr.ht/~roxwize/mipilin synced 2025-01-31 02:53:36 +00:00
mipilin/drizzle/0001_famous_silver_surfer.sql
roxwize e3c09d7f0d
this is the initial commit for my AWESOME website
Signed-off-by: roxwize <rae@roxwize.xyz>
2024-11-13 22:51:08 -05:00

14 lines
No EOL
614 B
SQL

CREATE TABLE IF NOT EXISTS "profiles" (
"user" integer PRIMARY KEY NOT NULL,
"bio" varchar(2048) DEFAULT ''
);
--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "email" varchar NOT NULL;--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "profiles" ADD CONSTRAINT "profiles_user_users_id_fk" FOREIGN KEY ("user") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
ALTER TABLE "users" DROP COLUMN IF EXISTS "bio";--> statement-breakpoint
ALTER TABLE "users" ADD CONSTRAINT "users_email_unique" UNIQUE("email");