-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add scripts for pulling
team_settings
data from production (#…
- Loading branch information
Showing
4 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
-- insert teams_settings overwriting conflicts | ||
CREATE TEMPORARY TABLE sync_team_settings ( | ||
id integer, | ||
team_id integer, | ||
reference_code text, | ||
homepage text, | ||
help_email text, | ||
help_phone text, | ||
help_opening_hours text, | ||
email_reply_to_id text, | ||
external_planning_site_url text, | ||
external_planning_site_name text, | ||
boundary_url text, | ||
boundary_json jsonb | ||
); | ||
|
||
\copy sync_team_settings FROM '/tmp/team_settings.csv' WITH (FORMAT csv, DELIMITER ';'); | ||
|
||
INSERT INTO | ||
team_settings ( | ||
id, | ||
team_id, | ||
reference_code, | ||
homepage, | ||
help_email, | ||
help_phone, | ||
help_opening_hours, | ||
email_reply_to_id, | ||
external_planning_site_url, | ||
external_planning_site_name, | ||
boundary_url, | ||
boundary_json | ||
) | ||
SELECT | ||
id, | ||
team_id, | ||
reference_code, | ||
homepage, | ||
help_email, | ||
help_phone, | ||
help_opening_hours, | ||
email_reply_to_id, | ||
external_planning_site_url, | ||
external_planning_site_name, | ||
boundary_url, | ||
boundary_json | ||
FROM | ||
sync_team_settings ON CONFLICT (id) DO | ||
UPDATE | ||
SET | ||
team_id = EXCLUDED.team_id, | ||
reference_code = EXCLUDED.reference_code, | ||
homepage = EXCLUDED.homepage, | ||
help_email = EXCLUDED.help_email, | ||
help_phone = EXCLUDED.help_phone, | ||
help_opening_hours = EXCLUDED.help_opening_hours, | ||
email_reply_to_id = EXCLUDED.email_reply_to_id, | ||
external_planning_site_url = EXCLUDED.external_planning_site_url, | ||
external_planning_site_name = EXCLUDED.external_planning_site_name, | ||
boundary_url = EXCLUDED.boundary_url, | ||
boundary_json = EXCLUDED.boundary_json; | ||
SELECT | ||
setval('team_settings_id_seq', max(id)) | ||
FROM | ||
team_settings; |