Skip to content

Commit

Permalink
chore: Overwrite records on data-sync conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Oct 19, 2023
1 parent 7a4cb0f commit e01cae5
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scripts/seed-database/write/flows.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ SELECT
settings,
copied_from
FROM sync_flows
ON CONFLICT (id) DO NOTHING;
ON CONFLICT (id) DO UPDATE;

-- ensure that original flows.version is overwritten to match new operation inserted below, else sharedb will fail
UPDATE flows SET version = 1;
Expand Down
2 changes: 1 addition & 1 deletion scripts/seed-database/write/published_flows.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ SELECT
publisher_id,
created_at
FROM sync_published_flows
ON CONFLICT (id) DO NOTHING;
ON CONFLICT (id) DO UPDATE;
2 changes: 1 addition & 1 deletion scripts/seed-database/write/team_members.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ INSERT INTO
SELECT
id, user_id, team_id, role
FROM
sync_team_members ON CONFLICT (id) DO NOTHING;
sync_team_members ON CONFLICT (id) DO UPDATE;
2 changes: 1 addition & 1 deletion scripts/seed-database/write/teams.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ SELECT
notify_personalisation,
boundary
FROM sync_teams
ON CONFLICT (id) DO NOTHING;
ON CONFLICT (id) DO UPDATE;

SELECT setval('teams_id_seq', max(id)) FROM teams;
2 changes: 1 addition & 1 deletion scripts/seed-database/write/users.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ SELECT
email,
is_platform_admin
FROM sync_users
ON CONFLICT (id) DO NOTHING;
ON CONFLICT (id) DO UPDATE;

ALTER TABLE
users ENABLE TRIGGER grant_new_user_template_team_access;
Expand Down

0 comments on commit e01cae5

Please sign in to comment.