Skip to content

Commit 8b81360

Browse files
committed
bug: fix from renaming teams
1 parent e093c28 commit 8b81360

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

hasura/triggers/match_lineups.sql

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
CREATE OR REPLACE FUNCTION public.tbu_match_lineups()
2+
RETURNS trigger
3+
LANGUAGE plpgsql
4+
AS $$
5+
DECLARE
6+
_match_status text;
7+
BEGIN
8+
IF NEW.team_name != OLD.team_name THEN
9+
select status from matches where lineup_1_id = NEW.id or lineup_2_id = NEW.id into _match_status;
10+
IF _match_status NOT IN ('PickingPlayers', 'Scheduled', 'WaitingForCheckIn', 'Veto', 'WaitingForServer') THEN
11+
RAISE EXCEPTION 'Cannot change the name of a lineup when the match is Live or Finished' USING ERRCODE = '22000';
12+
END IF;
13+
END IF;
14+
15+
RETURN NEW;
16+
END;
17+
$$;
18+
19+
DROP TRIGGER IF EXISTS tbu_match_lineups ON public.match_lineups;
20+
CREATE TRIGGER tbu_match_lineups BEFORE INSERT OR UPDATE ON public.match_lineups FOR EACH ROW EXECUTE FUNCTION public.tbu_match_lineups();

src/configs/s3.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default (): {
77
key: process.env.S3_ACCESS_KEY,
88
secret: process.env.S3_SECRET,
99
bucket: process.env.S3_BUCKET,
10-
db_backup_bucket: process.env.S3_DB_BACKUP_BUCKET,
10+
db_backup_bucket: process.env.S3_DB_BACKUP_BUCKET || "5stack-db-backups",
1111
endpoint: process.env.S3_ENDPOINT || process.env.DEMOS_DOMAIN,
1212
useSSL: process.env.S3_USE_SSL === "false" ? false : true,
1313
port: process.env.S3_PORT || "443",

0 commit comments

Comments
 (0)