mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-05-06 13:01:50 +02:00
Fix "Skipping unsupported ALTER" warning on database migration
This commit is contained in:
parent
e2cd3342d0
commit
d5e6370bbe
1 changed files with 28 additions and 10 deletions
|
@ -165,6 +165,18 @@ def upgrade():
|
|||
sa.Column("remote_addr", sa.String(length=50), nullable=True),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
bind = op.get_bind()
|
||||
if bind.engine.name == "sqlite":
|
||||
with op.batch_alter_table("project", recreate="always") as batch_op:
|
||||
batch_op.add_column(
|
||||
sa.Column(
|
||||
"logging_preference",
|
||||
sa.Enum("DISABLED", "ENABLED", "RECORD_IP", name="loggingmode"),
|
||||
server_default="ENABLED",
|
||||
nullable=False,
|
||||
),
|
||||
)
|
||||
else:
|
||||
op.add_column(
|
||||
"project",
|
||||
sa.Column(
|
||||
|
@ -179,6 +191,12 @@ def upgrade():
|
|||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
|
||||
bind = op.get_bind()
|
||||
if bind.engine.name == "sqlite":
|
||||
with op.batch_alter_table("project", recreate="always") as batch_op:
|
||||
batch_op.drop_column("logging_preference")
|
||||
else:
|
||||
op.drop_column("project", "logging_preference")
|
||||
op.drop_table("transaction")
|
||||
op.drop_index(
|
||||
|
|
Loading…
Reference in a new issue