Skip to content

Commit

Permalink
no log: hide warning during initial database migration
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheus65535 committed Nov 19, 2023
1 parent a10e5db commit d64d6b0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions migrations/versions/dc09994b7e65_.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy import exc as sa_exc
import warnings

try:
from psycopg2.errors import UndefinedObject
Expand Down Expand Up @@ -46,6 +48,7 @@ def column_type(table_name, column_name):

def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
warnings.filterwarnings("ignore", category=sa_exc.SAWarning)

# Update announcements table
with op.batch_alter_table('table_announcements') as batch_op:
Expand Down Expand Up @@ -266,6 +269,8 @@ def upgrade():
'table_movies_rootfolder_pkey CASCADE;')
batch_op.alter_column(column_name='id', existing_type=sa.INTEGER(), nullable=False, autoincrement=True)
batch_op.create_primary_key(constraint_name='pk_table_movies_rootfolder', columns=['id'])

warnings.filterwarnings("default", category=sa_exc.SAWarning)
# ### end Alembic commands ###


Expand Down

0 comments on commit d64d6b0

Please sign in to comment.