aurweb/test/test_migration.py
Kevin Morris 6c7e274968
feat(db): add an index for SSHPubKeys.PubKey (#2)
Speeds up SSHPubKeys.PubKey searches in a larger database.

Fixed form of the original commit which was reverted,
1a7f6e1fa9

Signed-off-by: Kevin Morris <kevr@0cost.org>
2022-08-13 19:52:50 -07:00

23 lines
519 B
Python

import pytest
from sqlalchemy import inspect
from aurweb.db import get_engine
from aurweb.models.ssh_pub_key import SSHPubKey
@pytest.fixture(autouse=True)
def setup(db_test):
return
def test_sshpubkeys_pubkey_index():
insp = inspect(get_engine())
indexes = insp.get_indexes(SSHPubKey.__tablename__)
found_pk = False
for idx in indexes:
if idx.get("name") == "SSHPubKeysPubKey":
assert idx.get("column_names") == ["PubKey"]
found_pk = True
assert found_pk