Skip to content

Commit

Permalink
build: make initial_feature_count migration idempotent
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Feb 23, 2024
1 parent 1c9a541 commit f9449c7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/backend/migrations/011-task-features-count.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
-- Start a transaction
BEGIN;

ALTER TABLE IF EXISTS public.tasks
RENAME COLUMN initial_feature_count TO feature_count;
DO $$
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'tasks' AND column_name = 'initial_feature_count') THEN
ALTER TABLE public.tasks RENAME COLUMN initial_feature_count TO feature_count;
END IF;
END $$;

-- Commit the transaction
COMMIT;

0 comments on commit f9449c7

Please sign in to comment.