Merge pull request #908 from jakedt/addindices
Add indices for the security worker fields on Image
This commit is contained in:
commit
7e029184f5
2 changed files with 28 additions and 2 deletions
|
@ -576,8 +576,8 @@ class Image(BaseModel):
|
|||
v1_json_metadata = TextField(null=True)
|
||||
v1_checksum = CharField(null=True)
|
||||
|
||||
security_indexed = BooleanField(default=False)
|
||||
security_indexed_engine = IntegerField(default=-1)
|
||||
security_indexed = BooleanField(default=False, index=True)
|
||||
security_indexed_engine = IntegerField(default=-1, index=True)
|
||||
|
||||
# We use a proxy here instead of 'self' in order to disable the foreign key constraint
|
||||
parent = ForeignKeyField(_ImageProxy, index=True, null=True, related_name='children')
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
"""Add indices for security worker queries.
|
||||
|
||||
Revision ID: 1b2bb93ceb82
|
||||
Revises: 22af01f81722
|
||||
Create Date: 2015-11-18 13:27:41.161898
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '1b2bb93ceb82'
|
||||
down_revision = '22af01f81722'
|
||||
|
||||
from alembic import op
|
||||
|
||||
def upgrade(tables):
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_index('image_security_indexed', 'image', ['security_indexed'], unique=False)
|
||||
op.create_index('image_security_indexed_engine', 'image', ['security_indexed_engine'], unique=False)
|
||||
### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade(tables):
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index('image_security_indexed_engine', table_name='image')
|
||||
op.drop_index('image_security_indexed', table_name='image')
|
||||
### end Alembic commands ###
|
Reference in a new issue