Skip to content

Commit

Permalink
feat(schema): set current schedule to null on delete
Browse files Browse the repository at this point in the history
  • Loading branch information
MinhxNguyen7 committed Nov 25, 2024
1 parent 14cc77b commit 591a9e0
Show file tree
Hide file tree
Showing 4 changed files with 454 additions and 1 deletion.
7 changes: 7 additions & 0 deletions apps/backend/drizzle/0002_fat_ted_forrester.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ALTER TABLE "users" DROP CONSTRAINT "users_current_schedule_id_schedules_id_fk";
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "users" ADD CONSTRAINT "users_current_schedule_id_schedules_id_fk" FOREIGN KEY ("current_schedule_id") REFERENCES "public"."schedules"("id") ON DELETE set null ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
Loading

0 comments on commit 591a9e0

Please sign in to comment.