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
11b0ada8
Commit
11b0ada8
authored
Dec 03, 2025
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix database migrations
parent
a596debf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
88 deletions
+0
-88
routes.py
mbetterclient/web_dashboard/routes.py
+0
-88
No files found.
mbetterclient/web_dashboard/routes.py
View file @
11b0ada8
...
...
@@ -3730,94 +3730,6 @@ def delete_result_option():
return
jsonify
({
"error"
:
str
(
e
)}),
500
# Migration to create result_options table with default values
def
create_result_options_migration
():
"""Create migration for result_options table"""
try
:
from
..database.models
import
ResultOptionModel
from
..database.migrations
import
DatabaseMigration
class
Migration_023
(
DatabaseMigration
):
def
__init__
(
self
):
super
()
.
__init__
(
"023"
,
"Add result_options table for extraction system results area"
)
def
up
(
self
,
db_manager
):
"""Apply migration"""
try
:
session
=
db_manager
.
get_session
()
try
:
# Create table if it doesn't exist
ResultOptionModel
.
__table__
.
create
(
session
.
bind
,
checkfirst
=
True
)
# Insert default result options
default_options
=
[
(
'DRAW'
,
'Draw result'
,
1
),
(
'DKO'
,
'Double Knockout'
,
2
),
(
'WIN1'
,
'Fighter 1 wins'
,
3
),
(
'WIN2'
,
'Fighter 2 wins'
,
4
),
(
'RET1'
,
'Fighter 1 retires'
,
5
),
(
'RET2'
,
'Fighter 2 retires'
,
6
),
(
'PTS1'
,
'Fighter 1 wins by points'
,
7
),
(
'PTS2'
,
'Fighter 2 wins by points'
,
8
),
(
'KO1'
,
'Fighter 1 wins by KO'
,
9
),
(
'KO2'
,
'Fighter 2 wins by KO'
,
10
)
]
for
result_name
,
description
,
sort_order
in
default_options
:
# Check if already exists
existing
=
session
.
query
(
ResultOptionModel
)
.
filter_by
(
result_name
=
result_name
)
.
first
()
if
not
existing
:
option
=
ResultOptionModel
(
result_name
=
result_name
,
description
=
description
,
sort_order
=
sort_order
)
session
.
add
(
option
)
session
.
commit
()
logger
.
info
(
"Created result_options table with default values"
)
return
True
finally
:
session
.
close
()
except
Exception
as
e
:
logger
.
error
(
f
"Migration 023 failed: {e}"
)
return
False
def
down
(
self
,
db_manager
):
"""Rollback migration"""
try
:
session
=
db_manager
.
get_session
()
try
:
# Drop table
ResultOptionModel
.
__table__
.
drop
(
session
.
bind
,
checkfirst
=
True
)
session
.
commit
()
logger
.
info
(
"Dropped result_options table"
)
return
True
finally
:
session
.
close
()
except
Exception
as
e
:
logger
.
error
(
f
"Migration 023 rollback failed: {e}"
)
return
False
return
Migration_023
()
except
Exception
as
e
:
logger
.
error
(
f
"Failed to create result options migration: {e}"
)
return
None
# Add the migration to the migrations list
try
:
from
..database.migrations
import
MIGRATIONS
migration_023
=
create_result_options_migration
()
if
migration_023
:
MIGRATIONS
.
append
(
migration_023
)
logger
.
info
(
"Added Migration 023 for result_options table"
)
except
Exception
as
e
:
logger
.
error
(
f
"Failed to add Migration 023: {e}"
)
# Redistribution CAP API routes (admin-only)
...
...
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