Start Core Hub FastAPI replacement foundation

This commit is contained in:
2026-06-27 11:41:26 +02:00
parent 75963233b6
commit 1e87adbcbb
37 changed files with 3292 additions and 30 deletions

View File

@@ -0,0 +1,65 @@
"""initial core hub tables
Revision ID: 20260627_0001
Revises:
Create Date: 2026-06-27
"""
from collections.abc import Sequence
import sqlalchemy as sa
from alembic import op
revision: str = "20260627_0001"
down_revision: str | None = None
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None
def upgrade() -> None:
op.create_table(
"hubs",
sa.Column("id", sa.String(length=36), primary_key=True),
sa.Column("slug", sa.String(length=120), nullable=False),
sa.Column("name", sa.String(length=240), nullable=False),
sa.Column("status", sa.String(length=40), nullable=False),
sa.Column("description", sa.Text(), nullable=True),
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
)
op.create_index("ix_hubs_slug", "hubs", ["slug"], unique=True)
op.create_table(
"hub_capability_manifests",
sa.Column("id", sa.String(length=36), primary_key=True),
sa.Column("hub_slug", sa.String(length=120), nullable=False),
sa.Column("manifest_version", sa.String(length=40), nullable=False),
sa.Column("body_json", sa.Text(), nullable=False),
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
)
op.create_index(
"ix_hub_capability_manifests_hub_slug",
"hub_capability_manifests",
["hub_slug"],
)
op.create_table(
"api_consumers",
sa.Column("id", sa.String(length=36), primary_key=True),
sa.Column("slug", sa.String(length=120), nullable=False),
sa.Column("name", sa.String(length=240), nullable=False),
sa.Column("key_prefix", sa.String(length=32), nullable=True),
sa.Column("key_hash", sa.String(length=255), nullable=True),
sa.Column("status", sa.String(length=40), nullable=False),
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
)
op.create_index("ix_api_consumers_slug", "api_consumers", ["slug"], unique=True)
def downgrade() -> None:
op.drop_index("ix_api_consumers_slug", table_name="api_consumers")
op.drop_table("api_consumers")
op.drop_index("ix_hub_capability_manifests_hub_slug", table_name="hub_capability_manifests")
op.drop_table("hub_capability_manifests")
op.drop_index("ix_hubs_slug", table_name="hubs")
op.drop_table("hubs")