From 06e0142cb6ae99f7e9c2f0d30805fef53c49eaea Mon Sep 17 00:00:00 2001 From: Wesley Finck Date: Thu, 9 Oct 2025 16:01:13 -0700 Subject: [PATCH] refactor: add truncate before adding author_id column in cards migration Co-authored-by: aider (anthropic/claude-sonnet-4-5-20250929) --- .../database/migrations/0004_brainy_rocket_racer.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shared/infrastructure/database/migrations/0004_brainy_rocket_racer.sql b/src/shared/infrastructure/database/migrations/0004_brainy_rocket_racer.sql index b80d33bf..10696b5f 100644 --- a/src/shared/infrastructure/database/migrations/0004_brainy_rocket_racer.sql +++ b/src/shared/infrastructure/database/migrations/0004_brainy_rocket_racer.sql @@ -1,5 +1,6 @@ ALTER TABLE "cards" RENAME COLUMN "original_published_record_id" TO "published_record_id";--> statement-breakpoint ALTER TABLE "cards" DROP CONSTRAINT "cards_original_published_record_id_published_records_id_fk"; --> statement-breakpoint +TRUNCATE TABLE "cards" CASCADE;--> statement-breakpoint ALTER TABLE "cards" ADD COLUMN "author_id" text NOT NULL;--> statement-breakpoint -ALTER TABLE "cards" ADD CONSTRAINT "cards_published_record_id_published_records_id_fk" FOREIGN KEY ("published_record_id") REFERENCES "public"."published_records"("id") ON DELETE no action ON UPDATE no action; \ No newline at end of file +ALTER TABLE "cards" ADD CONSTRAINT "cards_published_record_id_published_records_id_fk" FOREIGN KEY ("published_record_id") REFERENCES "public"."published_records"("id") ON DELETE no action ON UPDATE no action; -- 2.51.2