def upgrade(migrate_engine):

    meta = MetaData(bind=migrate_engine)

    # Indexes can't be changed, we need to create the new one and delete
    # the old one

    instances = Table('instances', meta, autoload=True)

    for index in instances.indexes:
        if [c.name for c in index.columns] == ['project_id', 'deleted']:
            LOG.info(_LI('Skipped adding instances_project_id_deleted_idx '
                         'because an equivalent index already exists.'))
            break
    else:
        index = Index('instances_project_id_deleted_idx',
                      instances.c.project_id, instances.c.deleted)
        index.create()

    for index in instances.indexes:
        if [c.name for c in index.columns] == ['project_id']:
            index.drop()
Processed records are hidden.
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/db/sqlalchemy/migrate_repo/versions/274_update_instances_project_id_index.py/upgrade--crossover with--dataset/ETHPy150Open upconsulting/IsisCB/isiscb/zotero/admin.py/DraftAuthorityAdmin.get_queryset