aurweb/migrations/versions/dd70103d2e82_add_sshpubkeys_pubkey_index.py
Kevin Morris 1a7f6e1fa9
feat(db): add an index for SSHPubKeys.PubKey
Speeds up SSHPubKeys.PubKey searches in a larger database.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2022-08-12 22:26:26 -07:00

28 lines
560 B
Python

"""add SSHPubKeys.PubKey index
Revision ID: dd70103d2e82
Revises: d64e5571bc8d
Create Date: 2022-08-12 21:30:26.155465
"""
import traceback
from alembic import op
# revision identifiers, used by Alembic.
revision = 'dd70103d2e82'
down_revision = 'd64e5571bc8d'
branch_labels = None
depends_on = None
def upgrade():
try:
op.create_index("SSHPubKeysPubKey", "SSHPubKeys", ["PubKey"])
except Exception:
traceback.print_exc()
print("failing silently...")
def downgrade():
op.drop_index("SSHPubKeysPubKey", "SSHPubKeys")