This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/data/migrations/versions/790d91952fa8_add_missing_indexes.py
Joseph Schorr 80a37fd295 Add various missing indexes
Indexes added:

Image::repository - Needed for model.image.get_repository_images_without_placements
RepositoryTag::image - Needed for model.tag.get_tags_for_image
RepositoryTag::repository - Needed for repository deletion
RepositoryBuild::phase - Needed for model.build.list_repository_builds sorting
RepositoryBuild::started - Needed for model.build.list_repository_builds sorting
RepositoryBuild::repository+started+phase - Needed for model.build.list_repository_builds
RepositoryBuild::started+logs_archived+phase - Needed for model.build.get_archivable_build lookup
2016-08-08 12:34:45 -04:00

29 lines
1.1 KiB
Python

"""Add missing indexes
Revision ID: 790d91952fa8
Revises: 1093d8b212bb
Create Date: 2016-08-03 17:05:06.675520
"""
# revision identifiers, used by Alembic.
revision = '790d91952fa8'
down_revision = '1093d8b212bb'
from alembic import op
import sqlalchemy as sa
def upgrade(tables):
### commands auto generated by Alembic - please adjust! ###
op.create_index('repositorybuild_repository_id_started_phase', 'repositorybuild', ['repository_id', 'started', 'phase'], unique=False)
op.create_index('repositorybuild_started', 'repositorybuild', ['started'], unique=False)
op.create_index('repositorybuild_started_logs_archived_phase', 'repositorybuild', ['started', 'logs_archived', 'phase'], unique=False)
### end Alembic commands ###
def downgrade(tables):
### commands auto generated by Alembic - please adjust! ###
op.drop_index('repositorybuild_started_logs_archived_phase', table_name='repositorybuild')
op.drop_index('repositorybuild_started', table_name='repositorybuild')
op.drop_index('repositorybuild_repository_id_started_phase', table_name='repositorybuild')
### end Alembic commands ###