6ede33ccdb
Build and Push Docker Images / create_manifest (web, surfsense-web, , cpu) (push) Has been cancelled
Build and Push Docker Images / finalize_release (push) Has been cancelled
Obsidian Plugin Lint / lint (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / compute_version (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / verify_digests (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, , cpu) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda, cuda) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda126, cuda126) (push) Has been cancelled
54 lines
1.7 KiB
Python
54 lines
1.7 KiB
Python
"""add embedding_cache_sets table for content-addressed embedding reuse
|
|
|
|
Revision ID: 163
|
|
Revises: 162
|
|
"""
|
|
|
|
from collections.abc import Sequence
|
|
|
|
from alembic import op
|
|
|
|
revision: str = "163"
|
|
down_revision: str | None = "162"
|
|
branch_labels: str | Sequence[str] | None = None
|
|
depends_on: str | Sequence[str] | None = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.execute(
|
|
"""
|
|
CREATE TABLE IF NOT EXISTS embedding_cache_sets (
|
|
id SERIAL PRIMARY KEY,
|
|
markdown_sha256 VARCHAR(64) NOT NULL,
|
|
embedding_model VARCHAR(255) NOT NULL,
|
|
embedding_dim INTEGER NOT NULL,
|
|
chunker_kind VARCHAR(8) NOT NULL,
|
|
chunker_version INTEGER NOT NULL,
|
|
storage_backend VARCHAR(32) NOT NULL,
|
|
storage_key TEXT NOT NULL,
|
|
size_bytes BIGINT NOT NULL,
|
|
chunk_count INTEGER NOT NULL DEFAULT 0,
|
|
times_reused BIGINT NOT NULL DEFAULT 0,
|
|
last_used_at TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
|
|
CONSTRAINT uq_embedding_cache_sets_key
|
|
UNIQUE (markdown_sha256, embedding_model, chunker_kind, chunker_version)
|
|
);
|
|
"""
|
|
)
|
|
|
|
op.execute(
|
|
"CREATE INDEX IF NOT EXISTS ix_embedding_cache_sets_last_used_at "
|
|
"ON embedding_cache_sets(last_used_at);"
|
|
)
|
|
op.execute(
|
|
"CREATE INDEX IF NOT EXISTS ix_embedding_cache_sets_created_at "
|
|
"ON embedding_cache_sets(created_at);"
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.execute("DROP INDEX IF EXISTS ix_embedding_cache_sets_created_at;")
|
|
op.execute("DROP INDEX IF EXISTS ix_embedding_cache_sets_last_used_at;")
|
|
op.execute("DROP TABLE IF EXISTS embedding_cache_sets;")
|