Skip to content

Commit

Permalink
fix: Add new flow.status column to sync script
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed May 24, 2024
1 parent 8f0478b commit 5724666
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/seed-database/write/flows.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ CREATE TEMPORARY TABLE sync_flows (
updated_at timestamptz,
settings jsonb,
copied_from uuid,
analytics_link text
analytics_link text,
status text
);

\copy sync_flows FROM '/tmp/flows.csv' WITH (FORMAT csv, DELIMITER ';');
Expand All @@ -24,7 +25,8 @@ INSERT INTO flows (
version,
settings,
copied_from,
analytics_link
analytics_link,
status
)
SELECT
id,
Expand All @@ -35,7 +37,8 @@ SELECT
version,
settings,
copied_from,
NULL
NULL,
status
FROM sync_flows
ON CONFLICT (id) DO UPDATE
SET
Expand All @@ -46,7 +49,8 @@ SET
version = EXCLUDED.version,
settings = EXCLUDED.settings,
copied_from = EXCLUDED.copied_from,
analytics_link = NULL;
analytics_link = NULL,
status = EXCLUDED.status;

-- ensure that original flows.version is overwritten to match new operation inserted below, else sharedb will fail
UPDATE flows SET version = 1;
Expand Down

0 comments on commit 5724666

Please sign in to comment.