Skip to content

Commit

Permalink
fix: onboarding schema (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
ephraimduncan authored Jun 17, 2024
1 parent 558be8b commit 53b7e16
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 5 deletions.
17 changes: 17 additions & 0 deletions packages/db/drizzle/0001_mighty_iron_fist.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
DO $$ BEGIN
ALTER TABLE "form_datas" ADD CONSTRAINT "form_datas_form_id_forms_id_fk" FOREIGN KEY ("form_id") REFERENCES "public"."forms"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "forms" ADD CONSTRAINT "forms_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "onboarding_forms" ADD CONSTRAINT "onboarding_forms_form_id_forms_id_fk" FOREIGN KEY ("form_id") REFERENCES "public"."forms"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
52 changes: 47 additions & 5 deletions packages/db/drizzle/meta/0001_snapshot.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "43304a23-01d5-419a-9868-a2f94f467288",
"prevId": "3b08f407-2220-4159-95e7-68a7faa162ea",
"id": "b4c676fd-d684-456f-9aca-3ca42cc8af1f",
"prevId": "43304a23-01d5-419a-9868-a2f94f467288",
"version": "6",
"dialect": "postgresql",
"tables": {
Expand Down Expand Up @@ -113,7 +113,21 @@
"isUnique": false
}
},
"foreignKeys": {},
"foreignKeys": {
"form_datas_form_id_forms_id_fk": {
"name": "form_datas_form_id_forms_id_fk",
"tableFrom": "form_datas",
"tableTo": "forms",
"columnsFrom": [
"form_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
Expand Down Expand Up @@ -208,7 +222,21 @@
"isUnique": false
}
},
"foreignKeys": {},
"foreignKeys": {
"forms_user_id_users_id_fk": {
"name": "forms_user_id_users_id_fk",
"tableFrom": "forms",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
Expand Down Expand Up @@ -485,7 +513,21 @@
}
},
"indexes": {},
"foreignKeys": {},
"foreignKeys": {
"onboarding_forms_form_id_forms_id_fk": {
"name": "onboarding_forms_form_id_forms_id_fk",
"tableFrom": "onboarding_forms",
"tableTo": "forms",
"columnsFrom": [
"form_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
Expand Down
7 changes: 7 additions & 0 deletions packages/db/drizzle/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
"when": 1717559991446,
"tag": "0000_left_mimic",
"breakpoints": true
},
{
"idx": 1,
"version": "6",
"when": 1718583247062,
"tag": "0001_mighty_iron_fist",
"breakpoints": true
}
]
}

0 comments on commit 53b7e16

Please sign in to comment.