-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #249 from giselles-ai/feat/delete-team-migration
feat: Add cascade delete to team-related foreign key constraints
- Loading branch information
Showing
4 changed files
with
2,071 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
ALTER TABLE "subscriptions" DROP CONSTRAINT "subscriptions_team_db_id_teams_db_id_fk"; | ||
--> statement-breakpoint | ||
ALTER TABLE "team_memberships" DROP CONSTRAINT "team_memberships_team_db_id_teams_db_id_fk"; | ||
--> statement-breakpoint | ||
DO $$ BEGIN | ||
ALTER TABLE "subscriptions" ADD CONSTRAINT "subscriptions_team_db_id_teams_db_id_fk" FOREIGN KEY ("team_db_id") REFERENCES "public"."teams"("db_id") ON DELETE cascade ON UPDATE no action; | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; | ||
--> statement-breakpoint | ||
DO $$ BEGIN | ||
ALTER TABLE "team_memberships" ADD CONSTRAINT "team_memberships_team_db_id_teams_db_id_fk" FOREIGN KEY ("team_db_id") REFERENCES "public"."teams"("db_id") ON DELETE cascade ON UPDATE no action; | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; |
Oops, something went wrong.