fix(recovery): restore source removed by production documentation merge

This commit is contained in:
2026-11-10 03:42:10 +01:00
parent 585bdd4b44
commit 3d2fc6f913
957 changed files with 115754 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
-- Durable canonical metadata for 0pt dataset versions.
-- Bytes remain canonical ST0RE artifacts referenced by artifact_refs.
CREATE TABLE IF NOT EXISTS opt_dataset_versions (
dataset_id text NOT NULL REFERENCES opt_datasets(dataset_id) ON DELETE RESTRICT,
version integer NOT NULL CHECK (version > 0),
tenant_id text NOT NULL,
project_id text NOT NULL,
artifact_refs text[] NOT NULL CHECK (cardinality(artifact_refs) > 0),
schema_version text NOT NULL,
record_count bigint CHECK (record_count IS NULL OR record_count >= 0),
description text,
created_at timestamptz NOT NULL DEFAULT now(),
created_by text NOT NULL,
correlation_id text,
idempotency_key text,
PRIMARY KEY (dataset_id, version)
);
CREATE UNIQUE INDEX IF NOT EXISTS opt_dataset_versions_idempotency_idx
ON opt_dataset_versions (tenant_id, idempotency_key)
WHERE idempotency_key IS NOT NULL;
CREATE INDEX IF NOT EXISTS opt_dataset_versions_tenant_dataset_idx
ON opt_dataset_versions (tenant_id, dataset_id, version DESC);
COMMENT ON TABLE opt_dataset_versions IS
'Immutable 0pt dataset-version metadata. Content bytes remain in ST0RE artifacts.';