gabriel / musehub public
0083_add_musehub_auth_keys_revoked_at.py python
35 lines 933 B
Raw
sha256:0ce9daa6cc1a86e370a7c023184881065b392d52dd276b224582d7b936d9644a feat: GET /api/keys/{key_id}/status + key revocation soft-d… Sonnet 5 minor ⚠ breaking 2 days ago
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')
File History 1 commit
sha256:0ce9daa6cc1a86e370a7c023184881065b392d52dd276b224582d7b936d9644a feat: GET /api/keys/{key_id}/status + key revocation soft-d… Sonnet 5 minor ⚠ 2 days ago