Skip to content

Commit

Permalink
chore: Sync new team_themes columns from production [skip pizza] (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr authored Jan 15, 2024
1 parent f34adf1 commit 20be595
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions scripts/seed-database/write/team_themes.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
-- TODO: Update to add action_color and link_colour columns

-- 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
favicon text,
link_colour text,
action_colour text
);

\copy sync_team_themes FROM '/tmp/team_themes.csv' WITH (FORMAT csv, DELIMITER ';');
Expand All @@ -17,26 +16,29 @@ INSERT INTO
id,
team_id,
primary_colour,
-- secondary_colour,
logo,
favicon
favicon,
link_colour,
action_colour
)
SELECT
id,
team_id,
primary_colour,
-- secondary_colour,
logo,
favicon
favicon,
link_colour,
action_colour
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;
favicon = EXCLUDED.favicon,
link_colour = EXCLUDED.link_colour,
action_colour = EXCLUDED.action_colour;
SELECT
setval('team_themes_id_seq', max(id))
FROM
Expand Down

0 comments on commit 20be595

Please sign in to comment.