Initial curated RAGcore source from c16667f0c9397e2bfc8dd0255b114fba23c8d05e
This commit is contained in:
commit
7ca726caf2
659 files changed
+98171
No files matched your search
@@ -0,0 +1,72 @@
|
||||
"""Create the distributed alias-lock and compensating-rollback saga log."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision = "0011_index_operations"
|
||||
down_revision = "0010_citations"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute(sa.text("CREATE SCHEMA IF NOT EXISTS indexes"))
|
||||
op.create_table(
|
||||
"index_build_operations",
|
||||
sa.Column("id", sa.Uuid(), primary_key=True),
|
||||
sa.Column("alias_name", sa.String(128), nullable=False),
|
||||
sa.Column("operation", sa.String(32), nullable=False),
|
||||
sa.Column("status", sa.String(32), nullable=False),
|
||||
sa.Column("owner_token", sa.String(64), nullable=False),
|
||||
sa.Column("collection_name", sa.String(128), nullable=False),
|
||||
sa.Column("previous_collection", sa.String(128), nullable=True),
|
||||
sa.Column(
|
||||
"steps",
|
||||
sa.JSON(),
|
||||
nullable=False,
|
||||
server_default=sa.text("'[]'"),
|
||||
),
|
||||
sa.Column("started_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("lease_until", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("finished_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("error_code", sa.String(128), nullable=True),
|
||||
sa.Column(
|
||||
"error_details",
|
||||
sa.JSON(),
|
||||
nullable=False,
|
||||
server_default=sa.text("'{}'"),
|
||||
),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
|
||||
schema="indexes",
|
||||
)
|
||||
op.create_index(
|
||||
"ux_indexes_operations_active_alias",
|
||||
"index_build_operations",
|
||||
["alias_name"],
|
||||
unique=True,
|
||||
schema="indexes",
|
||||
postgresql_where=sa.text("status = 'in_progress'"),
|
||||
)
|
||||
op.create_index(
|
||||
"ix_indexes_operations_alias_started",
|
||||
"index_build_operations",
|
||||
["alias_name", "started_at"],
|
||||
schema="indexes",
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index(
|
||||
"ix_indexes_operations_alias_started",
|
||||
table_name="index_build_operations",
|
||||
schema="indexes",
|
||||
)
|
||||
op.drop_index(
|
||||
"ux_indexes_operations_active_alias",
|
||||
table_name="index_build_operations",
|
||||
schema="indexes",
|
||||
)
|
||||
op.drop_table("index_build_operations", schema="indexes")
|
||||
op.execute(sa.text("DROP SCHEMA IF EXISTS indexes"))
|
||||
Reference in new issue
Block a user