Skip to content

Commit 32b4ccf

Browse files
committed
fix: make rename migration idempotent with existence check
1 parent 9a508e6 commit 32b4ccf

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
ALTER TABLE "scrape_configs" RENAME COLUMN "check_every_hours" TO "check_interval_minutes";
1+
DO $$ BEGIN
2+
IF EXISTS (
3+
SELECT 1 FROM information_schema.columns
4+
WHERE table_name = 'scrape_configs' AND column_name = 'check_every_hours'
5+
) THEN
6+
ALTER TABLE scrape_configs RENAME COLUMN check_every_hours TO check_interval_minutes;
7+
END IF;
8+
END $$;

0 commit comments

Comments
 (0)