Files
arc53--docsgpt/application/alembic/versions/0014_device_token_hash_index.py
T
wehub-resource-sync fed8b2eed7
Build and push multi-arch DocsGPT Docker image / build (linux/amd64, ubuntu-latest, amd64) (push) Has been cancelled
Backend release / release (push) Has been cancelled
Bandit Security Scan / bandit_scan (push) Has been cancelled
Build and push multi-arch DocsGPT Docker image / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Has been cancelled
Build and push multi-arch DocsGPT Docker image / manifest (push) Has been cancelled
Build and push DocsGPT FE Docker image for development / build (linux/amd64, ubuntu-latest, amd64) (push) Has been cancelled
Build and push DocsGPT FE Docker image for development / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Has been cancelled
Build and push DocsGPT FE Docker image for development / manifest (push) Has been cancelled
Python linting / ruff (push) Has been cancelled
Run python tests with pytest / Run tests and count coverage (3.12) (push) Has been cancelled
React Widget Build / build (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:28:29 +08:00

30 lines
862 B
Python

"""0014 device token_hash index — index the per-request token lookup.
``find_by_token_hash`` runs on every CLI request but ``token_hash`` was
unindexed. Token uniqueness is guaranteed at generation, so a UNIQUE
index is safe (and doubles as a guard against accidental collisions).
Revision ID: 0014_device_token_hash_index
Revises: 0013_devices_approval_modes
"""
from typing import Sequence, Union
from alembic import op
revision: str = "0014_device_token_hash_index"
down_revision: Union[str, None] = "0013_devices_approval_modes"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.execute(
"CREATE UNIQUE INDEX devices_token_hash_uidx ON devices(token_hash);"
)
def downgrade() -> None:
op.execute("DROP INDEX IF EXISTS devices_token_hash_uidx;")