Skip to content

Commit 43c24bf

Browse files
committed
feat: add onboarding database schema and migrations
1 parent 1a182a7 commit 43c24bf

File tree

4 files changed

+8335
-1
lines changed

4 files changed

+8335
-1
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CREATE TABLE IF NOT EXISTS "onboarding" (
2+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
3+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
4+
"finished_at" timestamp with time zone,
5+
"version" integer DEFAULT 1 NOT NULL,
6+
"slack" boolean DEFAULT false NOT NULL,
7+
"email" boolean DEFAULT false NOT NULL,
8+
"user_id" uuid NOT NULL,
9+
"organization_id" uuid NOT NULL
10+
);
11+
--> statement-breakpoint
12+
ALTER TABLE "onboarding" ADD CONSTRAINT "onboarding_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
13+
--> statement-breakpoint
14+
ALTER TABLE "onboarding" ADD CONSTRAINT "onboarding_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE cascade ON UPDATE no action;
15+
--> statement-breakpoint
16+
ALTER TABLE "onboarding" ADD CONSTRAINT "onboarding_user_id_organization_id_version_unique" UNIQUE ("user_id", "organization_id", "version");

0 commit comments

Comments
 (0)