mirror of
https://github.com/aljazceru/CTFd.git
synced 2026-02-01 20:34:36 +01:00
Update migration
This commit is contained in:
@@ -13,10 +13,17 @@ depends_on = None
|
||||
|
||||
|
||||
def upgrade(op=None):
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(
|
||||
"dynamic_challenge_ibfk_1", "dynamic_challenge", type_="foreignkey"
|
||||
)
|
||||
bind = op.get_bind()
|
||||
url = str(bind.engine.url)
|
||||
if url.startswith("mysql"):
|
||||
op.drop_constraint(
|
||||
"dynamic_challenge_ibfk_1", "dynamic_challenge", type_="foreignkey"
|
||||
)
|
||||
elif url.startswith("postgres"):
|
||||
op.drop_constraint(
|
||||
"dynamic_challenge_id_fkey", "dynamic_challenge", type_="foreignkey"
|
||||
)
|
||||
|
||||
op.create_foreign_key(
|
||||
None, "dynamic_challenge", "challenges", ["id"], ["id"], ondelete="CASCADE"
|
||||
)
|
||||
@@ -24,7 +31,15 @@ def upgrade(op=None):
|
||||
|
||||
|
||||
def downgrade(op=None):
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, "dynamic_challenge", type_="foreignkey")
|
||||
bind = op.get_bind()
|
||||
url = str(bind.engine.url)
|
||||
if url.startswith("mysql"):
|
||||
op.drop_constraint(
|
||||
"dynamic_challenge_ibfk_1", "dynamic_challenge", type_="foreignkey"
|
||||
)
|
||||
elif url.startswith("postgres"):
|
||||
op.drop_constraint(
|
||||
"dynamic_challenge_id_fkey", "dynamic_challenge", type_="foreignkey"
|
||||
)
|
||||
|
||||
op.create_foreign_key(None, "dynamic_challenge", "challenges", ["id"], ["id"])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
Reference in New Issue
Block a user