mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 05:54:19 +01:00
Fix eb68f277ab61_add_func_column_to_dynamic_challenges migration (#2374)
* Fix issue in migration with some MySQL versions
This commit is contained in:
@@ -19,9 +19,15 @@ def upgrade(op=None):
|
||||
"dynamic_challenge", sa.Column("function", sa.String(length=32), nullable=True)
|
||||
)
|
||||
conn = op.get_bind()
|
||||
url = str(conn.engine.url)
|
||||
if url.startswith("postgres"):
|
||||
conn.execute(
|
||||
"UPDATE dynamic_challenge SET function = 'logarithmic' WHERE function IS NULL"
|
||||
)
|
||||
else:
|
||||
conn.execute(
|
||||
"UPDATE dynamic_challenge SET `function` = 'logarithmic' WHERE `function` IS NULL"
|
||||
)
|
||||
|
||||
|
||||
def downgrade(op=None):
|
||||
|
||||
Reference in New Issue
Block a user