-- 一次主动轮询形成的完整实时采集快照;原始 record/collector_sample 继续保留用于追溯。 CREATE TABLE t_test_realtime_snapshot ( snapshot_id BIGINT NOT NULL AUTO_INCREMENT, test_id BIGINT NOT NULL, binding_id BIGINT NOT NULL, channel_id BIGINT NOT NULL, collector_id BIGINT NOT NULL, capture_slot_utc DATETIME(3) NOT NULL, cabinet_sequence_id BIGINT NULL, cabinet_device_time_utc DATETIME(3) NULL, cabinet_device_time_raw VARCHAR(64) NULL, collector_sequence_id BIGINT NULL, collector_device_time_utc DATETIME(3) NULL, collector_device_time_raw VARCHAR(64) NULL, server_received_at_utc DATETIME(3) NOT NULL, cycle_no INT NULL, step_no INT NULL, step_type VARCHAR(64) NULL, step_name VARCHAR(191) NULL, voltage_v DECIMAL(30,12) NULL, current_a DECIMAL(30,12) NULL, capacity_ah DECIMAL(30,12) NULL, energy_wh DECIMAL(30,12) NULL, temperature DECIMAL(30,12) NULL, positive_potential DECIMAL(30,12) NULL, negative_potential DECIMAL(30,12) NULL, extension_measurements_json JSON NULL, content_sha256 BINARY(32) NOT NULL, PRIMARY KEY (snapshot_id), UNIQUE KEY uk_test_snapshot_slot (test_id, binding_id, capture_slot_utc), KEY idx_snapshot_test_time (test_id, capture_slot_utc), CONSTRAINT fk_realtime_snapshot_test FOREIGN KEY (test_id) REFERENCES t_test (test_id), CONSTRAINT fk_realtime_snapshot_binding FOREIGN KEY (binding_id) REFERENCES t_test_channel_binding (binding_id), CONSTRAINT fk_realtime_snapshot_channel FOREIGN KEY (channel_id) REFERENCES t_detection_channel (channel_id), CONSTRAINT fk_realtime_snapshot_collector FOREIGN KEY (collector_id) REFERENCES t_collector (collector_id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='主动轮询形成的完整实时采集快照';