feat(mindspace): gate published page delivery

This commit is contained in:
john
2026-07-14 19:13:01 +08:00
parent ae9090948a
commit 27b11894f2
16 changed files with 448 additions and 39 deletions
+19
View File
@@ -171,6 +171,25 @@ CREATE TABLE IF NOT EXISTS h5_page_records (
CONSTRAINT fk_h5_page_cover_asset FOREIGN KEY (cover_image_asset_id) REFERENCES h5_assets(id) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Delivery contracts are separate from page/publication lifecycle records.
-- A contract gates only new agent-delivered workspace files; historical public
-- files without a contract remain accessible for backward compatibility.
CREATE TABLE IF NOT EXISTS h5_page_delivery_contracts (
id CHAR(36) PRIMARY KEY,
user_id CHAR(36) NOT NULL,
request_id VARCHAR(128) NOT NULL,
workspace_relative_path VARCHAR(512) NOT NULL,
data_mode ENUM('static', 'pg_required') NOT NULL DEFAULT 'static',
status ENUM('preparing', 'ready', 'failed') NOT NULL DEFAULT 'preparing',
failure_reason VARCHAR(1000) NULL,
created_at BIGINT NOT NULL,
ready_at BIGINT NULL,
updated_at BIGINT NOT NULL,
UNIQUE KEY uq_h5_delivery_contract_request_path (user_id, request_id, workspace_relative_path),
KEY idx_h5_delivery_contract_route (user_id, workspace_relative_path, updated_at),
CONSTRAINT fk_h5_delivery_contract_user FOREIGN KEY (user_id) REFERENCES h5_users(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS h5_page_versions (
id CHAR(36) PRIMARY KEY,
page_id CHAR(36) NOT NULL,