Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MBetterc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mbetter
MBetterc
Commits
0632ac59
Commit
0632ac59
authored
Nov 19, 2025
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add default config for templates
parent
63ca5331
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
0 deletions
+80
-0
migrations.py
mbetterclient/database/migrations.py
+80
-0
No files found.
mbetterclient/database/migrations.py
View file @
0632ac59
...
@@ -2001,6 +2001,85 @@ class Migration_026_AddExtractionStatsTable(DatabaseMigration):
...
@@ -2001,6 +2001,85 @@ class Migration_026_AddExtractionStatsTable(DatabaseMigration):
logger
.
error
(
f
"Failed to drop extraction_stats table: {e}"
)
logger
.
error
(
f
"Failed to drop extraction_stats table: {e}"
)
return
False
return
False
class
Migration_027_AddDefaultIntroTemplatesConfig
(
DatabaseMigration
):
"""Add default intro templates configuration for Qt player"""
def
__init__
(
self
):
super
()
.
__init__
(
"027"
,
"Add default intro templates configuration for Qt player"
)
def
up
(
self
,
db_manager
)
->
bool
:
"""Add default intro templates configuration to game_config table"""
try
:
with
db_manager
.
engine
.
connect
()
as
conn
:
# Check if intro_templates_config already exists
result
=
conn
.
execute
(
text
(
"""
SELECT COUNT(*) FROM game_config WHERE config_key = 'intro_templates_config'
"""
))
exists
=
result
.
scalar
()
>
0
if
not
exists
:
# Create default intro templates configuration
default_config
=
{
"templates"
:
[
{
"name"
:
"fixtures"
,
"show_time"
:
"00:15"
},
{
"name"
:
"match"
,
"show_time"
:
"00:15"
}
],
"default_show_time"
:
"00:15"
,
"rotating_time"
:
"05:00"
}
import
json
config_json
=
json
.
dumps
(
default_config
)
conn
.
execute
(
text
(
"""
INSERT INTO game_config
(config_key, config_value, value_type, description, is_system, created_at, updated_at)
VALUES (:config_key, :config_value, :value_type, :description, :is_system, datetime('now'), datetime('now'))
"""
),
{
'config_key'
:
'intro_templates_config'
,
'config_value'
:
config_json
,
'value_type'
:
'string'
,
'description'
:
'Default intro templates configuration for Qt player START_INTRO messages'
,
'is_system'
:
True
})
logger
.
info
(
"Added default intro templates configuration"
)
else
:
logger
.
info
(
"Intro templates configuration already exists"
)
conn
.
commit
()
logger
.
info
(
"Default intro templates configuration migration completed successfully"
)
return
True
except
Exception
as
e
:
logger
.
error
(
f
"Failed to add default intro templates configuration: {e}"
)
return
False
def
down
(
self
,
db_manager
)
->
bool
:
"""Remove default intro templates configuration"""
try
:
with
db_manager
.
engine
.
connect
()
as
conn
:
# Remove the intro templates configuration
conn
.
execute
(
text
(
"""
DELETE FROM game_config WHERE config_key = 'intro_templates_config'
"""
))
conn
.
commit
()
logger
.
info
(
"Default intro templates configuration removed"
)
return
True
except
Exception
as
e
:
logger
.
error
(
f
"Failed to remove default intro templates configuration: {e}"
)
return
False
# Registry of all migrations in order
# Registry of all migrations in order
MIGRATIONS
:
List
[
DatabaseMigration
]
=
[
MIGRATIONS
:
List
[
DatabaseMigration
]
=
[
Migration_001_InitialSchema
(),
Migration_001_InitialSchema
(),
...
@@ -2029,6 +2108,7 @@ MIGRATIONS: List[DatabaseMigration] = [
...
@@ -2029,6 +2108,7 @@ MIGRATIONS: List[DatabaseMigration] = [
Migration_024_AddResultOptionsTable
(),
Migration_024_AddResultOptionsTable
(),
Migration_025_AddResultOptionModel
(),
Migration_025_AddResultOptionModel
(),
Migration_026_AddExtractionStatsTable
(),
Migration_026_AddExtractionStatsTable
(),
Migration_027_AddDefaultIntroTemplatesConfig
(),
]
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment