add indexes to domains and certificates tables to optimize load time
This commit is contained in:
19
lemur/migrations/versions/c87cb989af04_.py
Normal file
19
lemur/migrations/versions/c87cb989af04_.py
Normal file
@ -0,0 +1,19 @@
|
||||
"""Create an index on the domains table for the domain name
|
||||
Revision ID: c87cb989af04
|
||||
Revises: 9392b9f9a805
|
||||
Create Date: 2018-10-11 09:44:57.099854
|
||||
|
||||
"""
|
||||
|
||||
revision = 'c87cb989af04'
|
||||
down_revision = '9392b9f9a805'
|
||||
|
||||
from alembic import op
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_index(op.f('ix_domains_name'), 'domains', ['name'], unique=False)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_index(op.f('ix_domains_name'), table_name='domains')
|
23
lemur/migrations/versions/f2383bf08fbc_.py
Normal file
23
lemur/migrations/versions/f2383bf08fbc_.py
Normal file
@ -0,0 +1,23 @@
|
||||
"""Create index on certificates table for id desc
|
||||
|
||||
|
||||
Revision ID: f2383bf08fbc
|
||||
Revises: c87cb989af04
|
||||
Create Date: 2018-10-11 11:23:31.195471
|
||||
|
||||
"""
|
||||
|
||||
revision = 'f2383bf08fbc'
|
||||
down_revision = 'c87cb989af04'
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_index('ix_certificates_id_desc', 'certificates', [sa.text('id DESC')], unique=True,
|
||||
postgresql_using='btree')
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_index('ix_certificates_id_desc', table_name='certificates')
|
Reference in New Issue
Block a user