Implement governed tabular source snapshots
This commit is contained in:
@@ -0,0 +1 @@
|
||||
"""Connectors migrations."""
|
||||
@@ -0,0 +1 @@
|
||||
"""Connectors migration revisions."""
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
"""v0.1.14 Connectors baseline
|
||||
|
||||
Revision ID: e6b7c8d9f0a1
|
||||
Revises: None
|
||||
Create Date: 2026-07-28 00:00:00.000000
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "e6b7c8d9f0a1"
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_table(
|
||||
"connector_tabular_sources",
|
||||
sa.Column("id", sa.String(length=36), nullable=False),
|
||||
sa.Column("tenant_id", sa.String(length=36), nullable=False),
|
||||
sa.Column("provider", sa.String(length=50), nullable=False),
|
||||
sa.Column("source_name", sa.String(length=120), nullable=False),
|
||||
sa.Column("name", sa.String(length=300), nullable=False),
|
||||
sa.Column("description", sa.Text(), nullable=True),
|
||||
sa.Column("status", sa.String(length=30), nullable=False),
|
||||
sa.Column("schema_version", sa.Integer(), nullable=False),
|
||||
sa.Column("schema", sa.JSON(), nullable=False),
|
||||
sa.Column("rows", sa.JSON(), nullable=False),
|
||||
sa.Column("fingerprint", sa.String(length=64), nullable=False),
|
||||
sa.Column("row_count", sa.Integer(), nullable=False),
|
||||
sa.Column("byte_count", sa.Integer(), nullable=False),
|
||||
sa.Column("metadata", sa.JSON(), nullable=False),
|
||||
sa.Column("created_by", sa.String(length=255), nullable=True),
|
||||
sa.Column("updated_by", sa.String(length=255), nullable=True),
|
||||
sa.Column("deleted_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_connector_tabular_sources")),
|
||||
sa.UniqueConstraint(
|
||||
"tenant_id",
|
||||
"source_name",
|
||||
name="uq_connector_tabular_source_name",
|
||||
),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_connector_tabular_sources_created_by"),
|
||||
"connector_tabular_sources",
|
||||
["created_by"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_connector_tabular_sources_deleted_at"),
|
||||
"connector_tabular_sources",
|
||||
["deleted_at"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_connector_tabular_sources_fingerprint"),
|
||||
"connector_tabular_sources",
|
||||
["fingerprint"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_connector_tabular_sources_provider"),
|
||||
"connector_tabular_sources",
|
||||
["provider"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_connector_tabular_sources_status"),
|
||||
"connector_tabular_sources",
|
||||
["status"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_connector_tabular_sources_tenant_id"),
|
||||
"connector_tabular_sources",
|
||||
["tenant_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_connector_tabular_sources_updated_by"),
|
||||
"connector_tabular_sources",
|
||||
["updated_by"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
"ix_connector_tabular_sources_tenant_status",
|
||||
"connector_tabular_sources",
|
||||
["tenant_id", "status"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
"ix_connector_tabular_sources_tenant_updated",
|
||||
"connector_tabular_sources",
|
||||
["tenant_id", "updated_at"],
|
||||
unique=False,
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index(
|
||||
"ix_connector_tabular_sources_tenant_updated",
|
||||
table_name="connector_tabular_sources",
|
||||
)
|
||||
op.drop_index(
|
||||
"ix_connector_tabular_sources_tenant_status",
|
||||
table_name="connector_tabular_sources",
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_connector_tabular_sources_updated_by"),
|
||||
table_name="connector_tabular_sources",
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_connector_tabular_sources_tenant_id"),
|
||||
table_name="connector_tabular_sources",
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_connector_tabular_sources_status"),
|
||||
table_name="connector_tabular_sources",
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_connector_tabular_sources_provider"),
|
||||
table_name="connector_tabular_sources",
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_connector_tabular_sources_fingerprint"),
|
||||
table_name="connector_tabular_sources",
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_connector_tabular_sources_deleted_at"),
|
||||
table_name="connector_tabular_sources",
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_connector_tabular_sources_created_by"),
|
||||
table_name="connector_tabular_sources",
|
||||
)
|
||||
op.drop_table("connector_tabular_sources")
|
||||
Reference in New Issue
Block a user