mirror of
https://git.sr.ht/~roxwize/mipilin
synced 2025-01-31 02:53:36 +00:00
14 lines
No EOL
614 B
SQL
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"); |