From 3405c937cf3a95d34203ba0827bd0f85ea651801 Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Fri, 17 Nov 2023 15:17:43 +0100 Subject: [PATCH] ensure teams.reference_code col gets synced --- scripts/seed-database/write/teams.sql | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/seed-database/write/teams.sql b/scripts/seed-database/write/teams.sql index 0eaabb0bb6..1ffd5914a4 100644 --- a/scripts/seed-database/write/teams.sql +++ b/scripts/seed-database/write/teams.sql @@ -10,7 +10,8 @@ CREATE TEMPORARY TABLE sync_teams ( notify_personalisation jsonb, domain text, submission_email text, - boundary jsonb + boundary jsonb, + reference_code text ); \copy sync_teams FROM '/tmp/teams.csv' WITH (FORMAT csv, DELIMITER ';'); @@ -22,7 +23,8 @@ INSERT INTO teams ( theme, settings, notify_personalisation, - boundary + boundary, + reference_code ) SELECT id, @@ -31,7 +33,8 @@ SELECT theme, settings, notify_personalisation, - boundary + boundary, + reference_code FROM sync_teams ON CONFLICT (id) DO UPDATE SET @@ -40,6 +43,7 @@ SET theme = EXCLUDED.theme, settings = EXCLUDED.settings, notify_personalisation = EXCLUDED.notify_personalisation, - boundary = EXCLUDED.boundary; + boundary = EXCLUDED.boundary, + reference_code = EXCLUDED.reference_code; SELECT setval('teams_id_seq', max(id)) FROM teams;