Files
app/backend/fluksio/alembic/versions/b7d2e9c4a1f3_worker_token.py
T

38 lines
1.1 KiB
Python

"""worker_token
Every worker credential a superuser mints, by the `jti` it carries, so one can
be listed and revoked without rotating the key that signs them all.
Revision ID: b7d2e9c4a1f3
Revises: f8c3e5a91d27
Create Date: 2026-10-06
"""
import sqlalchemy as sa
import sqlmodel.sql.sqltypes
from alembic import op
# revision identifiers, used by Alembic.
revision = "b7d2e9c4a1f3"
down_revision = "f8c3e5a91d27"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"worker_token",
sa.Column("jti", sqlmodel.sql.sqltypes.AutoString(length=32), nullable=False),
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False),
sa.Column("labels", sa.JSON(), nullable=True),
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
sa.Column("expires_at", sa.DateTime(timezone=True), nullable=False),
sa.Column("revoked_at", sa.DateTime(timezone=True), nullable=True),
sa.PrimaryKeyConstraint("jti"),
)
def downgrade():
op.drop_table("worker_token")