Skip to content

Commit

Permalink
fix: Disable grant_new_user_template_team_access trigger in DB sync (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr authored Oct 17, 2023
1 parent a636268 commit 102393e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scripts/seed-database/write/users.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ CREATE TEMPORARY TABLE sync_users (

\copy sync_users FROM '/tmp/users.csv' WITH (FORMAT csv, DELIMITER ';');

-- Do not automatically generate team_member records for the templates team
-- We manually truncate and replace the team_members table in another step
ALTER TABLE
users DISABLE TRIGGER grant_new_user_template_team_access;

INSERT INTO users (
id,
first_name,
Expand All @@ -27,4 +32,7 @@ SELECT
FROM sync_users
ON CONFLICT (id) DO NOTHING;

ALTER TABLE
users ENABLE TRIGGER grant_new_user_template_team_access;

SELECT setval('users_id_seq', max(id)) FROM users;

0 comments on commit 102393e

Please sign in to comment.