Add an index for lookup by account to log entries
Also fixes the query to require one less join
This commit is contained in:
parent
d9b65b88e9
commit
0f46230493
4 changed files with 36 additions and 14 deletions
|
@ -0,0 +1,26 @@
|
|||
"""Add logentry index for lookup by account
|
||||
|
||||
Revision ID: 8981dabd329f
|
||||
Revises: 790d91952fa8
|
||||
Create Date: 2016-08-12 16:50:15.816120
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '8981dabd329f'
|
||||
down_revision = '790d91952fa8'
|
||||
|
||||
from alembic import op
|
||||
|
||||
def upgrade(tables):
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_index('logentry_account_id_datetime', 'logentry', ['account_id', 'datetime'], unique=False)
|
||||
op.create_index('logentry_performer_id_datetime', 'logentry', ['performer_id', 'datetime'], unique=False)
|
||||
### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade(tables):
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index('logentry_account_id_datetime', table_name='logentry')
|
||||
op.drop_index('logentry_performer_id_datetime', table_name='logentry')
|
||||
### end Alembic commands ###
|
Reference in a new issue