forked from FlashpointProject/flashpoint-submission-system
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpgdb-utils.sql
More file actions
27 lines (23 loc) · 660 Bytes
/
pgdb-utils.sql
File metadata and controls
27 lines (23 loc) · 660 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
-- Disable and enable triggers
SET session_replication_role = replica;
SET session_replication_role = DEFAULT;
-- Rebuild platform strings
UPDATE game
SET platforms_str = (
SELECT string_agg(
(SELECT primary_alias FROM platform WHERE id = p.platform_id), '; '
)
FROM game_platforms_platform p
WHERE p.game_id = game.id
) WHERE 1=1
-- Rebuild tag strings
UPDATE game
SET tags_str = coalesce(
(
SELECT string_agg(
(SELECT primary_alias FROM tag WHERE id = t.tag_id), '; '
)
FROM game_tags_tag t
WHERE t.game_id = game.id
), ''
) WHERE 1=1