File tree Expand file tree Collapse file tree
hasura/migrations/default/1761617285280_alter_table_public_match_map_veto_picks_add_unique_match_id_map_id Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ DROP TRIGGER IF EXISTS tbd_match_map_veto_picks ON public .match_map_veto_picks ;
2+
13WITH duplicates AS (
24 SELECT
3- id,
5+ mmvp . id ,
46 ROW_NUMBER() OVER (
5- PARTITION BY match_id, map_id
6- ORDER BY created_at ASC , id ASC
7+ PARTITION BY mmvp .match_id , mmvp .map_id
8+ ORDER BY
9+ CASE WHEN EXISTS (
10+ SELECT 1 FROM match_maps mm
11+ JOIN match_map_demos mmd ON mmd .match_map_id = mm .id
12+ WHERE mm .match_id = mmvp .match_id AND mm .map_id = mmvp .map_id
13+ ) THEN 0 ELSE 1 END,
14+ mmvp .created_at ASC ,
15+ mmvp .id ASC
716 ) as row_num
8- FROM match_map_veto_picks
17+ FROM match_map_veto_picks mmvp
918)
1019DELETE FROM match_map_veto_picks
1120WHERE id IN (
@@ -14,4 +23,6 @@ WHERE id IN (
1423 WHERE row_num > 1
1524);
1625
26+ CREATE TRIGGER tbd_match_map_veto_picks BEFORE DELETE ON public .match_map_veto_picks FOR EACH ROW EXECUTE FUNCTION public .tbd_match_map_veto_picks ();
27+
1728alter table " public" ." match_map_veto_picks" add constraint " match_map_veto_picks_match_id_map_id_key" unique (" match_id" , " map_id" );
You can’t perform that action at this time.
0 commit comments