indexing the not after field in the cert table

This commit is contained in:
Hossein Shafagh 2019-05-30 08:55:30 -07:00
parent 3680d523d4
commit 13d46ae42e
2 changed files with 28 additions and 0 deletions

View File

@ -106,6 +106,8 @@ class Certificate(db.Model):
not_before = Column(ArrowType) not_before = Column(ArrowType)
not_after = Column(ArrowType) not_after = Column(ArrowType)
not_after_ix = Index('ix_certificates_not_after', not_after.desc())
date_created = Column(ArrowType, PassiveDefault(func.now()), nullable=False) date_created = Column(ArrowType, PassiveDefault(func.now()), nullable=False)
signing_algorithm = Column(String(128)) signing_algorithm = Column(String(128))

View File

@ -0,0 +1,26 @@
"""adding index on the not_after field
Revision ID: b33c838cb669
Revises: 318b66568358
Create Date: 2019-05-30 08:42:05.294109
"""
# revision identifiers, used by Alembic.
revision = 'b33c838cb669'
down_revision = '318b66568358'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_index('ix_certificates_not_after', 'certificates', [sa.text('not_after DESC')], unique=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index('ix_certificates_not_after', table_name='certificates')
# ### end Alembic commands ###