-
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.
chore(wip): Update sync script for
team_themes
table (#2633)
- Loading branch information
1 parent
59d016a
commit c9b7810
Showing
4 changed files
with
44 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
-- insert teams_themes overwriting conflicts | ||
CREATE TEMPORARY TABLE sync_team_themes ( | ||
id integer, | ||
team_id integer, | ||
primary_colour text, | ||
secondary_colour text, | ||
logo text, | ||
favicon text | ||
); | ||
|
||
\copy sync_team_themes FROM '/tmp/team_themes.csv' WITH (FORMAT csv, DELIMITER ';'); | ||
|
||
INSERT INTO | ||
team_themes ( | ||
id, | ||
team_id, | ||
primary_colour, | ||
secondary_colour, | ||
logo, | ||
favicon | ||
) | ||
SELECT | ||
id, | ||
team_id, | ||
primary_colour, | ||
secondary_colour, | ||
logo, | ||
favicon | ||
FROM | ||
sync_team_themes ON CONFLICT (id) DO | ||
UPDATE | ||
SET | ||
team_id = EXCLUDED.team_id, | ||
primary_colour = EXCLUDED.primary_colour, | ||
secondary_colour = EXCLUDED.secondary_colour, | ||
logo = EXCLUDED.logo, | ||
favicon = EXCLUDED.favicon; | ||
SELECT | ||
setval('team_themes_id_seq', max(id)) | ||
FROM | ||
team_themes; |
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