Skip to content
/ api Public

Commit a3eff7e

Browse files
committed
bug: fix issue where deleting match options was not doable since we had them connected to antoher tournament
1 parent e4dd7a1 commit a3eff7e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

hasura/triggers/match_options.sql

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,15 @@ BEGIN
178178
SELECT type INTO _pool_type FROM map_pools WHERE id = OLD.map_pool_id;
179179

180180
IF _pool_type = 'Custom' THEN
181-
DELETE FROM map_pools WHERE id = OLD.map_pool_id;
181+
IF NOT EXISTS (
182+
SELECT 1
183+
FROM match_options
184+
WHERE map_pool_id = OLD.map_pool_id
185+
AND id <> OLD.id
186+
) THEN
187+
DELETE FROM map_pools
188+
WHERE id = OLD.map_pool_id;
189+
END IF;
182190
END IF;
183191

184192
RETURN OLD;

0 commit comments

Comments
 (0)