Skip to content

Commit

Permalink
fix: v0.52.5 migrations (#1094)
Browse files Browse the repository at this point in the history
  • Loading branch information
abelanger5 authored Dec 5, 2024
1 parent 9ca4bb1 commit db6558a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
18 changes: 16 additions & 2 deletions sql/migrations/20241121142159_v0.52.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,22 @@ CREATE INDEX "RetryQueueItem_isQueued_tenantId_retryAfter_idx" ON "RetryQueueIte
CREATE TYPE "WorkflowTriggerCronRefMethods" AS ENUM ('DEFAULT', 'API');
-- Create enum type "WorkflowTriggerScheduledRefMethods"
CREATE TYPE "WorkflowTriggerScheduledRefMethods" AS ENUM ('DEFAULT', 'API');
-- Modify "WorkflowTriggerCronRef" table
ALTER TABLE "WorkflowTriggerCronRef" ADD COLUMN "name" text NULL, ADD COLUMN "id" uuid NOT NULL, ADD COLUMN "method" "WorkflowTriggerCronRefMethods" NOT NULL DEFAULT 'DEFAULT', ADD CONSTRAINT "WorkflowTriggerCronRef_parentId_cron_name_key" UNIQUE ("parentId", "cron", "name");

-- Step 1: Add the new columns with "id" as nullable
ALTER TABLE "WorkflowTriggerCronRef"
ADD COLUMN "name" text NULL,
ADD COLUMN "id" uuid NULL,
ADD COLUMN "method" "WorkflowTriggerCronRefMethods" NOT NULL DEFAULT 'DEFAULT',
ADD CONSTRAINT "WorkflowTriggerCronRef_parentId_cron_name_key" UNIQUE ("parentId", "cron", "name");

-- Step 2: Populate "id" column with UUIDs for existing rows
UPDATE "WorkflowTriggerCronRef"
SET "id" = gen_random_uuid()
WHERE "id" IS NULL;

-- Step 3: Alter "id" column to be NOT NULL
ALTER TABLE "WorkflowTriggerCronRef"
ALTER COLUMN "id" SET NOT NULL;

UPDATE "WorkflowTriggerCronRef" SET "name" = '' WHERE "name" IS NULL;

Expand Down
6 changes: 3 additions & 3 deletions sql/migrations/atlas.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
h1:sKzk6H+hzjxCLeAk/CkTouxbldj14qwUpoKyby94tN0=
h1:Wss8IkuJYR8J4IJ6CRNFuue+s1DgpMvGj2L+ErfzrwI=
20240115180414_init.sql h1:Ef3ZyjAHkmJPdGF/dEWCahbwgcg6uGJKnDxW2JCRi2k=
20240122014727_v0_6_0.sql h1:o/LdlteAeFgoHJ3e/M4Xnghqt9826IE/Y/h0q95Acuo=
20240126235456_v0_7_0.sql h1:KiVzt/hXgQ6esbdC6OMJOOWuYEXmy1yeCpmsVAHTFKs=
Expand Down Expand Up @@ -75,5 +75,5 @@ h1:sKzk6H+hzjxCLeAk/CkTouxbldj14qwUpoKyby94tN0=
20241029122625_v0.51.0.sql h1:nOa4FqmZxSh1yBOJyduX+j15gQavjizTn660wyXjhNk=
20241107162939_v0.51.2.sql h1:qtnUITelb0kzAazo99gdTzejmQeOiE8NTP8b8bpQuF0=
20241114175346_v0.51.3.sql h1:ZbpRJsCmt6098ilZ3LtOk9LXRzuuwiznXPJmSkZSRpg=
20241121142159_v0.52.0.sql h1:fQdRQTxg2PiuFWbXJ9M4jxJLJsOkuWm5wfIuv8UPBVY=
20241204191714_v0.52.5.sql h1:aN6nxVv2oT3vCoxVw33nspjxlx/y3YLvyG6gWtmRGQI=
20241121142159_v0.52.0.sql h1:8oIy/D+oN92eMKWJT7QeA7yujewNxpSLLDJhed6wwZY=
20241204191714_v0.52.5.sql h1:6oJgHJynK+YtwQoD/VnqiCMda409K96A4Oq2l8h3dQ0=

0 comments on commit db6558a

Please sign in to comment.