Skip to content

Commit

Permalink
fix: account for new column flows.analytics_link in data sync script (
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak authored Nov 13, 2023
1 parent 1437c9b commit c79e639
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 @@ -9,7 +9,8 @@ CREATE TEMPORARY TABLE sync_flows (
created_at timestamptz,
updated_at timestamptz,
settings jsonb,
copied_from uuid
copied_from uuid,
analytics_link text
);

\copy sync_flows FROM '/tmp/flows.csv' WITH (FORMAT csv, DELIMITER ';');
Expand All @@ -22,7 +23,8 @@ INSERT INTO flows (
data,
version,
settings,
copied_from
copied_from,
null as analytics_link,
)
SELECT
id,
Expand All @@ -32,7 +34,8 @@ SELECT
data,
version,
settings,
copied_from
copied_from,
analytics_link
FROM sync_flows
ON CONFLICT (id) DO UPDATE
SET
Expand All @@ -42,7 +45,8 @@ SET
data = EXCLUDED.data,
version = EXCLUDED.version,
settings = EXCLUDED.settings,
copied_from = EXCLUDED.copied_from;
copied_from = EXCLUDED.copied_from,
analytics_link = null;

-- 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 c79e639

Please sign in to comment.