30 lines
918 B
Python
30 lines
918 B
Python
"""Release 2: client certificates — cert_type + username columns.
|
|
|
|
Revision ID: r2_0003
|
|
Revises: r2_0002
|
|
Create Date: 2026-09-19
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision: str = "r2_0003"
|
|
down_revision: Union[str, None] = "r2_0002"
|
|
branch_labels: Union[str, Sequence[str] | None] = None
|
|
depends_on: Union[str, Sequence[str] | None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column(
|
|
"certificates",
|
|
sa.Column("cert_type", sa.String(20), nullable=False, server_default="server"),
|
|
)
|
|
op.add_column("certificates", sa.Column("username", sa.String(100), nullable=True))
|
|
op.create_index("ix_certificates_username", "certificates", ["username"])
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("ix_certificates_username", table_name="certificates")
|
|
op.drop_column("certificates", "username")
|
|
op.drop_column("certificates", "cert_type") |