Skip to content

Commit

Permalink
fix: include teams.reference_code in data sync (#2442)
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak authored Nov 17, 2023
1 parent f098e19 commit 4e80624
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/seed-database/write/teams.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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 ';');
Expand All @@ -22,7 +23,8 @@ INSERT INTO teams (
theme,
settings,
notify_personalisation,
boundary
boundary,
reference_code
)
SELECT
id,
Expand All @@ -31,7 +33,8 @@ SELECT
theme,
settings,
notify_personalisation,
boundary
boundary,
reference_code
FROM sync_teams
ON CONFLICT (id) DO UPDATE
SET
Expand All @@ -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;

0 comments on commit 4e80624

Please sign in to comment.