BUILD129 — три настраиваемых цвета команд
This commit is contained in:
@@ -161,9 +161,25 @@ class HockeyDatabase:
|
||||
migrated = self._migrate_operator_session_user_id()
|
||||
Base.metadata.create_all(self.engine)
|
||||
repaired = migrated + self._repair_game_table()
|
||||
|
||||
# BUILD129: preserve the behaviour of the legacy primary team
|
||||
# colour when the explicit enable flag is introduced. Existing
|
||||
# rows that already had color_hex become enabled exactly once,
|
||||
# only on the migration that creates color_enabled.
|
||||
team_repaired = self._repair_additive_table(Team)
|
||||
repaired.extend(team_repaired)
|
||||
if f"{Team.__tablename__}.color_enabled" in team_repaired:
|
||||
with self.engine.begin() as connection:
|
||||
connection.execute(
|
||||
text(
|
||||
"UPDATE \"hockey_teams\" SET \"color_enabled\" = TRUE "
|
||||
"WHERE COALESCE(TRIM(\"color_hex\"), '') <> ''"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
for model in (
|
||||
OperatorSession,
|
||||
Team,
|
||||
TeamLeague,
|
||||
Country,
|
||||
PenaltyType,
|
||||
|
||||
Reference in New Issue
Block a user