Add an index to the image storage uuid to improve performance.
This commit is contained in:
parent
987eb4f9fa
commit
4ad592e7ce
2 changed files with 23 additions and 1 deletions
|
@ -257,7 +257,7 @@ class EmailConfirmation(BaseModel):
|
|||
|
||||
|
||||
class ImageStorage(BaseModel):
|
||||
uuid = CharField(default=uuid_generator)
|
||||
uuid = CharField(default=uuid_generator, index=True)
|
||||
checksum = CharField(null=True)
|
||||
created = DateTimeField(null=True)
|
||||
comment = TextField(null=True)
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
"""Add an index to the uuid in the image storage table.
|
||||
|
||||
Revision ID: b1d41e2071b
|
||||
Revises: 9a1087b007d
|
||||
Create Date: 2014-10-06 18:42:10.021235
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'b1d41e2071b'
|
||||
down_revision = '9a1087b007d'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade(tables):
|
||||
op.create_index('imagestorage_uuid', 'imagestorage', ['uuid'], unique=True)
|
||||
|
||||
|
||||
def downgrade(tables):
|
||||
op.drop_index('imagestorage_uuid', table_name='imagestorage')
|
Reference in a new issue