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,86 @@
|
||||
"""Durable profile, ModelForge route, and Qdrant collection selection.
|
||||
|
||||
Revision ID: 0021_embedding_selection
|
||||
Revises: 0020_source_sync_schedule
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision = "0021_embedding_selection"
|
||||
down_revision = "0020_source_sync_schedule"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_table(
|
||||
"embedding_selection_state",
|
||||
sa.Column("singleton_id", sa.Integer(), primary_key=True),
|
||||
sa.Column("generation", sa.Integer(), nullable=False),
|
||||
sa.Column("initialized", sa.Boolean(), nullable=False),
|
||||
sa.Column("active_selection", sa.JSON(), nullable=True),
|
||||
sa.Column("previous_selection", sa.JSON(), nullable=True),
|
||||
sa.Column(
|
||||
"updated_at",
|
||||
sa.DateTime(timezone=True),
|
||||
nullable=False,
|
||||
server_default=sa.func.now(),
|
||||
),
|
||||
schema="profiles",
|
||||
)
|
||||
op.create_table(
|
||||
"embedding_selection_operations",
|
||||
sa.Column("operation_id", sa.Uuid(as_uuid=True), primary_key=True),
|
||||
sa.Column("action", sa.String(length=16), nullable=False),
|
||||
sa.Column("expected_generation", sa.Integer(), nullable=False),
|
||||
sa.Column("request_fingerprint", sa.String(length=64), nullable=False),
|
||||
sa.Column("result_generation", sa.Integer(), nullable=False),
|
||||
sa.Column("result_selection", sa.JSON(), nullable=False),
|
||||
sa.Column(
|
||||
"operation_evidence",
|
||||
sa.JSON(),
|
||||
nullable=False,
|
||||
server_default=sa.text("'{}'::json"),
|
||||
),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
schema="profiles",
|
||||
)
|
||||
op.create_index(
|
||||
"ix_profiles_embedding_selection_operations_created_at",
|
||||
"embedding_selection_operations",
|
||||
["created_at"],
|
||||
schema="profiles",
|
||||
)
|
||||
op.bulk_insert(
|
||||
sa.table(
|
||||
"embedding_selection_state",
|
||||
sa.Column("singleton_id", sa.Integer()),
|
||||
sa.Column("generation", sa.Integer()),
|
||||
sa.Column("initialized", sa.Boolean()),
|
||||
sa.Column("active_selection", sa.JSON()),
|
||||
sa.Column("previous_selection", sa.JSON()),
|
||||
schema="profiles",
|
||||
),
|
||||
[
|
||||
{
|
||||
"singleton_id": 1,
|
||||
"generation": 0,
|
||||
"initialized": False,
|
||||
"active_selection": None,
|
||||
"previous_selection": None,
|
||||
}
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index(
|
||||
"ix_profiles_embedding_selection_operations_created_at",
|
||||
table_name="embedding_selection_operations",
|
||||
schema="profiles",
|
||||
)
|
||||
op.drop_table("embedding_selection_operations", schema="profiles")
|
||||
op.drop_table("embedding_selection_state", schema="profiles")
|
||||
Reference in new issue
Block a user