mirror of
https://framagit.org/framasoft/framaspace/argos.git
synced 2025-04-28 09:52:38 +02:00
🗃 — Fix some migrations for SQLite
This commit is contained in:
parent
a9b7b8f750
commit
fa4de8a2b7
2 changed files with 9 additions and 3 deletions
|
@ -18,16 +18,20 @@ depends_on: Union[str, Sequence[str], None] = None
|
|||
|
||||
|
||||
def upgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
with op.batch_alter_table("results", schema=None) as batch_op:
|
||||
batch_op.drop_constraint("results_task_id_fkey", type_="foreignkey")
|
||||
if bind.engine.name != "sqlite":
|
||||
batch_op.drop_constraint("results_task_id_fkey", type_="foreignkey")
|
||||
batch_op.create_foreign_key(
|
||||
"results_task_id_fkey", "tasks", ["task_id"], ["id"], ondelete="CASCADE"
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
with op.batch_alter_table("results", schema=None) as batch_op:
|
||||
batch_op.drop_constraint("results_task_id_fkey", type_="foreignkey")
|
||||
if bind.engine.name != "sqlite":
|
||||
batch_op.drop_constraint("results_task_id_fkey", type_="foreignkey")
|
||||
batch_op.create_foreign_key(
|
||||
"results_task_id_fkey", "tasks", ["task_id"], ["id"]
|
||||
)
|
||||
|
|
|
@ -19,7 +19,9 @@ depends_on: Union[str, Sequence[str], None] = None
|
|||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute("ALTER TYPE severity ADD VALUE 'unknown'")
|
||||
bind = op.get_bind()
|
||||
if bind.engine.name != "sqlite":
|
||||
op.execute("ALTER TYPE severity ADD VALUE 'unknown'")
|
||||
op.add_column(
|
||||
"tasks",
|
||||
sa.Column(
|
||||
|
|
Loading…
Reference in a new issue