Can't apply migration?

The following migration file was generated by Drizzle-Kit
DROP TABLE "worker_pay_period";--> statement-breakpoint
ALTER TABLE "pay_stub" DROP CONSTRAINT "pay_stub_pay_period_id_worker_pay_period_id_fk";
--> statement-breakpoint
ALTER TABLE "pay_stub" ADD COLUMN "pay_period_start" timestamp NOT NULL;--> statement-breakpoint
ALTER TABLE "pay_stub" ADD COLUMN "pay_period_end" timestamp NOT NULL;--> statement-breakpoint
ALTER TABLE "pay_stub" DROP COLUMN IF EXISTS "pay_period_id";
DROP TABLE "worker_pay_period";--> statement-breakpoint
ALTER TABLE "pay_stub" DROP CONSTRAINT "pay_stub_pay_period_id_worker_pay_period_id_fk";
--> statement-breakpoint
ALTER TABLE "pay_stub" ADD COLUMN "pay_period_start" timestamp NOT NULL;--> statement-breakpoint
ALTER TABLE "pay_stub" ADD COLUMN "pay_period_end" timestamp NOT NULL;--> statement-breakpoint
ALTER TABLE "pay_stub" DROP COLUMN IF EXISTS "pay_period_id";
I basically just dropped a table called worker_pay_period, this table was referenced inside my pay_stub table (hence why the last command deletes the FK column) For some reason when this executes I get:
severity: 'ERROR',
code: '2BP01',
detail: 'constraint pay_stub_pay_period_id_worker_pay_period_id_fk on table pay_stub depends on table worker_pay_period',
hint: 'Use DROP ... CASCADE to drop the dependent objects too.',
severity: 'ERROR',
code: '2BP01',
detail: 'constraint pay_stub_pay_period_id_worker_pay_period_id_fk on table pay_stub depends on table worker_pay_period',
hint: 'Use DROP ... CASCADE to drop the dependent objects too.',
If I'm not mistaken, Drizzle-Kit should've dropped the column inside the pay_stub table that references the dropped table. Is this a bug? Can I manually update the migration file to do this or would this cause issues?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server