Files
saqel/backend/migrations/20260909_zz_video_review_evidence.sql
T

16 lines
1.0 KiB
SQL

-- Immutable evidence records are required before a reviewer can approve a video.
CREATE TABLE IF NOT EXISTS `video_review_evidence` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`video_review_job_id` BIGINT UNSIGNED NOT NULL,
`transcript_asset_id` BIGINT UNSIGNED NOT NULL,
`visual_evidence_asset_id` BIGINT UNSIGNED NOT NULL,
`coverage_json` JSON NOT NULL,
`submitted_by` BIGINT UNSIGNED NOT NULL,
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uq_review_evidence_job` (`video_review_job_id`),
CONSTRAINT `fk_review_evidence_job` FOREIGN KEY (`video_review_job_id`) REFERENCES `video_review_jobs` (`id`) ON DELETE CASCADE,
CONSTRAINT `fk_review_evidence_transcript` FOREIGN KEY (`transcript_asset_id`) REFERENCES `content_assets` (`id`) ON DELETE RESTRICT,
CONSTRAINT `fk_review_evidence_visual` FOREIGN KEY (`visual_evidence_asset_id`) REFERENCES `content_assets` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;