Files
0pt/sql/005_iceberg_write_boundary_gap_closure.sql
T

21 lines
1.2 KiB
SQL

-- 0pt Iceberg write-path ownership: field-level gap closure pass
-- (docs/ICEBERG_WRITE_BOUNDARY.md "Live verification" section, 2026-07-13).
--
-- 004_iceberg_write_boundary.sql shipped opt_dataset_iceberg_mappings without
-- namespace_id/mapped_at. This session's task spec names those fields
-- literally (0pt.dataset_iceberg_mapping.schema.v1: dataset_id,
-- iceberg_table_id, namespace_id, mapped_at, mapped_by), and this session
-- also live-verified (real HTTP calls against api.st0re.siax.io) that
-- ST0RE's namespace registry (/v1/st0re/lakehouse/namespaces) returns a real
-- namespaceId distinct from the bare namespace name -- so namespace_id is a
-- genuine reference, not a renamed duplicate of the existing `namespace`
-- column. Both new columns are nullable additive columns; no data migration
-- needed since 004 has not been applied to a live database by any session
-- (same honest status as 002/003 before it).
ALTER TABLE opt_dataset_iceberg_mappings
ADD COLUMN IF NOT EXISTS namespace_id TEXT,
ADD COLUMN IF NOT EXISTS mapped_at TIMESTAMPTZ NOT NULL DEFAULT now();
CREATE INDEX IF NOT EXISTS opt_dataset_iceberg_mappings_namespace_idx ON opt_dataset_iceberg_mappings (namespace_id);