Add an index to the docker_image_id for faster lookup
This commit is contained in:
parent
d73747ce1d
commit
178c5a7ac0
2 changed files with 27 additions and 1 deletions
|
@ -386,7 +386,7 @@ class Image(BaseModel):
|
||||||
# to be globally unique we can't treat them as such for permissions and
|
# to be globally unique we can't treat them as such for permissions and
|
||||||
# security reasons. So rather than Repository <-> Image being many to many
|
# security reasons. So rather than Repository <-> Image being many to many
|
||||||
# each image now belongs to exactly one repository.
|
# each image now belongs to exactly one repository.
|
||||||
docker_image_id = CharField()
|
docker_image_id = CharField(index=True)
|
||||||
repository = ForeignKeyField(Repository)
|
repository = ForeignKeyField(Repository)
|
||||||
|
|
||||||
# '/' separated list of ancestory ids, e.g. /1/2/6/7/10/
|
# '/' separated list of ancestory ids, e.g. /1/2/6/7/10/
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
"""Add an index to the docker_image_id field
|
||||||
|
|
||||||
|
Revision ID: 313d297811c4
|
||||||
|
Revises: 204abf14783d
|
||||||
|
Create Date: 2014-11-13 12:40:57.414787
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '313d297811c4'
|
||||||
|
down_revision = '204abf14783d'
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.dialects import mysql
|
||||||
|
|
||||||
|
def upgrade(tables):
|
||||||
|
### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.create_index('image_docker_image_id', 'image', ['docker_image_id'], unique=False)
|
||||||
|
### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade(tables):
|
||||||
|
### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_index('image_docker_image_id', table_name='image')
|
||||||
|
### end Alembic commands ###
|
Reference in a new issue