Skip to content

Commit 1f30500

Browse files
Set types correctly during migration
1 parent ed306f7 commit 1f30500

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

webapp/migrations/Version20250801124024.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,24 @@ public function up(Schema $schema): void
2121
{
2222
// this up() migration is auto-generated, please modify it to your needs
2323
$this->addSql(<<<SQL
24-
ALTER TABLE team_category
24+
ALTER TABLE team_category
2525
ADD types INT NOT NULL DEFAULT 1 COMMENT 'Bitmask of category types, default is scoring.' AFTER name,
2626
CHANGE sortorder sortorder TINYINT UNSIGNED DEFAULT NULL COMMENT 'Where to sort this category on the scoreboard',
2727
ADD css_class VARCHAR(255) DEFAULT NULL COMMENT 'CSS class to apply to scoreboard rows (only for TYPE_CSS_CLASS)' AFTER allow_self_registration
2828
SQL);
29+
30+
// Now update the types for existing categories based on whether the color is set
31+
$this->addSql('UPDATE team_category SET types = 7 WHERE color IS NOT NULL');
32+
$this->addSql('UPDATE team_category SET types = 5 WHERE color IS NULL');
2933
}
3034

3135
public function down(Schema $schema): void
3236
{
3337
// this down() migration is auto-generated, please modify it to your needs
3438
$this->addSql(<<<SQL
35-
ALTER TABLE team_category
36-
DROP types,
37-
DROP css_class,
39+
ALTER TABLE team_category
40+
DROP types,
41+
DROP css_class,
3842
CHANGE sortorder sortorder TINYINT UNSIGNED DEFAULT 0 NOT NULL COMMENT 'Where to sort this category on the scoreboard'
3943
SQL);
4044
}

0 commit comments

Comments
 (0)