CREATE TABLE semantic_corrections (
  id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  project_id BIGINT UNSIGNED NOT NULL,
  semantic_definition_id BIGINT UNSIGNED NOT NULL,
  original_value TEXT NULL,
  corrected_value TEXT NOT NULL,
  reason TEXT NULL,
  source VARCHAR(32) NOT NULL,
  confidence DECIMAL(3,2) NOT NULL,
  created_by VARCHAR(255) NOT NULL,
  created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  KEY idx_semantic_corrections_definition (project_id, semantic_definition_id),
  CONSTRAINT fk_semantic_corrections_project FOREIGN KEY (project_id) REFERENCES projects (id),
  CONSTRAINT fk_semantic_corrections_definition FOREIGN KEY (semantic_definition_id) REFERENCES semantic_definitions (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
