"""migrate_naming_convention_user_entered_names Revision ID: 8582618f445e Revises: 9c12a0013d75 Create Date: 2022-08-02 09:36:35.251905 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = '8582618f445e' down_revision = '9c12a0013d75' branch_labels = None depends_on = None def upgrade(): bind = op.get_bind() bind.execute( f''' UPDATE "Campaign" SET naming_convention = name WHERE is_deleted is FALSE AND naming_convention_autogenerated is FALSE AND (source is NULL OR source = 'dec') ''') def downgrade(): pass