"""migrate_ad_account_id_to_string Revision ID: 6d5d992b7d4a Revises: d407ce8193ec Create Date: 2023-05-24 12:39:53.301115 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql from migrations.fixtures.delphi_tables.views import DelphiViewsV9 from migrations.fixtures.delphi_tables.v9.data_refresher import DelphiTablesDataRefresher as DelphiTablesDataRefresherV9 # revision identifiers, used by Alembic. revision = '6d5d992b7d4a' down_revision = 'd407ce8193ec' branch_labels = None depends_on = None def upgrade(): bind = op.get_bind() delphi_views = DelphiViewsV9(bind) delphi_views.drop() op.alter_column('AdAccount', 'ad_account_id', existing_type=sa.INTEGER(), type_=sa.String(), existing_nullable=False) delphi_refresher = DelphiTablesDataRefresherV9() delphi_refresher.refresh(bind) def downgrade(): bind = op.get_bind() delphi_views = DelphiViewsV9(bind) delphi_views.drop() op.alter_column('AdAccount', 'ad_account_id', existing_type=sa.String(), type_=sa.INTEGER(), existing_nullable=False) delphi_refresher = DelphiTablesDataRefresherV9() delphi_refresher.refresh(bind)