"""update_claimed_projects_with_empty_names Revision ID: 5356915b3df4 Revises: 7b3e94e1aa5b Create Date: 2023-02-14 12:18:51.398199 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = '5356915b3df4' down_revision = '7b3e94e1aa5b' branch_labels = None depends_on = None def upgrade(): bind = op.get_bind() bind.execute('''UPDATE "Project" p SET name = ( case when p.source = 'PRS' then p.prs_title when p.source = 'CCP' then p.ccp_title end ) where name = '' and is_confidential is true and is_claimed is true''') def downgrade(): pass