1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-21 23:32:31 +00:00

Fixed database migration issue with postgresql. #2664

This commit is contained in:
morpheus65535 2024-09-26 21:37:34 -04:00
parent c11bdf34fa
commit 25098e5e07

View file

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