bmc_hub/migrations/1032_project_ct_archive_files.sql
Christian 1cfe5aee76 feat(migrations): add AI benchmark and vTiger archive tables
- Created tables for AI benchmark runs and results to facilitate model evaluation.
- Added expected answers column to benchmark results.
- Introduced tables for internet connection change cases and vTiger archive management, including records, relations, and checkpoints.
- Implemented triggers to enforce append-only behavior for vTiger archive records and files.
- Enhanced solution management with soft delete capabilities for sag_solutions and knowledge_articles.

feat(scripts): add CRM benchmarking script for Ollama models

- Developed a Python script to benchmark CRM models exposed through Ollama, including various test cases and scoring mechanisms.

test(tests): add comprehensive tests for new features

- Implemented tests for internet change case service, vTiger archive functionality, and sag solution knowledge management.
- Ensured coverage for edge cases and error handling in the new features.
2026-08-31 13:01:35 +02:00

22 lines
964 B
SQL

-- Project CT: preserve actual vTiger document bytes before the subscription ends.
CREATE TABLE IF NOT EXISTS vtiger_archive_files (
id BIGSERIAL PRIMARY KEY,
version_id BIGINT NOT NULL REFERENCES vtiger_archive_versions(id) ON DELETE RESTRICT,
document_vtiger_id VARCHAR(120) NOT NULL,
resource_vtiger_id VARCHAR(120) NOT NULL,
filename TEXT NOT NULL,
content_type TEXT,
size_bytes BIGINT NOT NULL,
content_sha256 VARCHAR(64) NOT NULL,
content BYTEA NOT NULL,
archived_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
UNIQUE(document_vtiger_id, resource_vtiger_id, content_sha256)
);
CREATE INDEX IF NOT EXISTS idx_vtiger_archive_files_version
ON vtiger_archive_files(version_id);
DROP TRIGGER IF EXISTS trg_vtiger_archive_files_immutable ON vtiger_archive_files;
CREATE TRIGGER trg_vtiger_archive_files_immutable
BEFORE UPDATE OR DELETE ON vtiger_archive_files
FOR EACH ROW EXECUTE FUNCTION deny_vtiger_archive_mutation();