gabriel / musehub public

0083_add_musehub_auth_keys_revoked_at.py file-level

at sha256:0 · View file ↗ · Intel ↗

History
1 files
1 commits
0 hotspots
0 🧊 dead
0 💥 blast risk
sha256:1 fix: getting-started page's muse --version sample output showed musehub… · gabriel · Oct 23, 2026
1 """Add revoked_at to musehub_auth_keys
2
3 musehub#223 -- revoke_key() previously hard-deleted the key row, so there
4 was no way to distinguish "revoked" from "never registered" for
5 GET /api/keys/{key_id}/status. Switches to soft-delete: revoked_at NULL
6 means active. All existing rows are active (NULL default), no backfill
7 needed.
8
9 Revision ID: 0083
10 Revises: 0082
11 """
12 from __future__ import annotations
13
14 from typing import Sequence, Union
15
16 from alembic import op
17 import sqlalchemy as sa
18
19
20 # revision identifiers, used by Alembic.
21 revision: str = '0083'
22 down_revision: Union[str, None] = '0082'
23 branch_labels: Union[str, Sequence[str], None] = None
24 depends_on: Union[str, Sequence[str], None] = None
25
26
27 def upgrade() -> None:
28 op.add_column(
29 'musehub_auth_keys',
30 sa.Column('revoked_at', sa.DateTime(timezone=True), nullable=True),
31 )
32
33
34 def downgrade() -> None:
35 op.drop_column('musehub_auth_keys', 'revoked_at')