Fixed database migration issue with postgresql. #2664

pull/2683/head
morpheus65535 3 months ago
parent c11bdf34fa
commit 25098e5e07

@ -7,6 +7,7 @@ Create Date: 2024-02-16 10:32:39.123456
"""
from alembic import op
import sqlalchemy as sa
from app.database import TableLanguagesProfiles
# revision identifiers, used by Alembic.
@ -19,6 +20,9 @@ bind = op.get_context().bind
def upgrade():
op.execute(sa.update(TableLanguagesProfiles)
.values({TableLanguagesProfiles.originalFormat: 0})
.where(TableLanguagesProfiles.originalFormat.is_(None)))
if bind.engine.name == 'postgresql':
with op.batch_alter_table('table_languages_profiles') as batch_op:
batch_op.alter_column('originalFormat', type_=sa.Integer())

Loading…
Cancel
Save