diff --git a/gatherling/Data/sql/migrations/80.sql b/gatherling/Data/sql/migrations/80.sql new file mode 100644 index 000000000..12918d8eb --- /dev/null +++ b/gatherling/Data/sql/migrations/80.sql @@ -0,0 +1,3 @@ +-- We must explicitly set this (which we did not at creation time) because server default may differ. +-- Our other tables have this explicitly set in schema.sql. +ALTER TABLE sessions CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; diff --git a/gatherling/Models/Format.php b/gatherling/Models/Format.php index 417bf7d9b..1c48942b8 100644 --- a/gatherling/Models/Format.php +++ b/gatherling/Models/Format.php @@ -1227,7 +1227,10 @@ public function updateLegalList(array $addCards, array $delCards): array */ private function getCurrentLegalityOfCards(array $cards): array { - $sql = "CREATE TEMPORARY TABLE input_cards (original_name VARCHAR(160))"; + $sql = ' + CREATE TEMPORARY TABLE input_cards ( + original_name VARCHAR(160) + ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci'; db()->execute($sql); $placeholders = $params = []; diff --git a/gatherling/Models/Player.php b/gatherling/Models/Player.php index 3b3c9f674..5b44d8b9d 100644 --- a/gatherling/Models/Player.php +++ b/gatherling/Models/Player.php @@ -230,6 +230,9 @@ public static function sanitizeUsername(string $playerName): string public static function createByName(string $playername): self { + if (strlen($playername) > 40) { + throw new ValidationException('Username too long (must be less than 40 characters)'); + } $sql = 'INSERT INTO players (name) VALUES (:player_name)'; $params = ['player_name' => $playername]; db()->execute($sql, $params); diff --git a/gatherling/Models/Series.php b/gatherling/Models/Series.php index 9d3c95cd8..a1705a47e 100644 --- a/gatherling/Models/Series.php +++ b/gatherling/Models/Series.php @@ -24,7 +24,7 @@ class Series public array $bannedplayers; public ?string $mtgo_room; - public ?string $this_season_format; + public ?string $this_season_format = null; public ?string $this_season_master_link = null; public int $this_season_season; diff --git a/gatherling/Views/Components/FullMetagame.php b/gatherling/Views/Components/FullMetagame.php index a32ea8c40..eb2ef8188 100644 --- a/gatherling/Views/Components/FullMetagame.php +++ b/gatherling/Views/Components/FullMetagame.php @@ -46,16 +46,16 @@ public function __construct(Event $event) $players[] = $info; } $sql = ' - CREATE TEMPORARY TABLE meta - ( - player VARCHAR(40), - deckname VARCHAR(120), - archetype VARCHAR(20), - colors VARCHAR(10), - medal VARCHAR(10), - id BIGINT UNSIGNED, - srtordr TINYINT UNSIGNED DEFAULT 0 - )'; + CREATE TEMPORARY TABLE meta ( + player VARCHAR(40), + deckname VARCHAR(120), + archetype VARCHAR(20), + colors VARCHAR(10), + medal VARCHAR(10), + id BIGINT UNSIGNED, + srtordr TINYINT UNSIGNED DEFAULT 0 + ) + CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci'; db()->execute($sql); $sql = ' INSERT INTO meta