Files
sub2api-cn-relay-manager/internal/store/migrations/0006_reconcile_runs_batch_scope.sql
phamnazage-jpg 85d495dd16 feat(control-plane): harden host-scoped reconcile and acceptance evidence
- add batch-scoped reconcile_runs persistence and queries
- route batch detail and reconcile writes through batch_id/host_id
- refresh production boards with host-scope acceptance artifacts
- include latest real-host acceptance evidence for self_service and subscription
2026-05-18 22:22:22 +08:00

20 lines
913 B
SQL

CREATE TABLE reconcile_runs_v3 (
id INTEGER PRIMARY KEY AUTOINCREMENT,
batch_id INTEGER,
host_id INTEGER NOT NULL,
provider_id INTEGER NOT NULL,
status TEXT NOT NULL,
summary_json TEXT NOT NULL DEFAULT '{}',
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT fk_reconcile_runs_batch FOREIGN KEY (batch_id) REFERENCES import_batches(id) ON DELETE CASCADE,
CONSTRAINT fk_reconcile_runs_host FOREIGN KEY (host_id) REFERENCES hosts(id) ON DELETE CASCADE,
CONSTRAINT fk_reconcile_runs_provider FOREIGN KEY (provider_id) REFERENCES providers(id) ON DELETE CASCADE
);
INSERT INTO reconcile_runs_v3 (id, batch_id, host_id, provider_id, status, summary_json, created_at)
SELECT rr.id, NULL, rr.host_id, rr.provider_id, rr.status, rr.summary_json, rr.created_at
FROM reconcile_runs rr;
DROP TABLE reconcile_runs;
ALTER TABLE reconcile_runs_v3 RENAME TO reconcile_runs;