<?php

return <<<'SQL'
CREATE TABLE scan_import_rows (
    id CHAR(36) NOT NULL PRIMARY KEY,
    job_id CHAR(36) NOT NULL,
    page_id CHAR(36) NULL,
    row_index INT NOT NULL,
    member_id CHAR(36) NULL,
    member_name_raw VARCHAR(255) NULL,
    front_strokes_detected INT NOT NULL DEFAULT 0,
    back_strokes_detected INT NOT NULL DEFAULT 0,
    confidence DECIMAL(5,2) NULL,
    needs_review TINYINT(1) NOT NULL DEFAULT 1,
    corrected_front_strokes INT NULL,
    corrected_back_strokes INT NULL,
    posted_entry_id CHAR(36) NULL,
    created_at DATETIME NOT NULL,
    updated_at DATETIME NOT NULL,
    INDEX scan_import_rows_job_id_idx (job_id),
    INDEX scan_import_rows_member_id_idx (member_id),
    FOREIGN KEY (job_id) REFERENCES scan_import_jobs(id),
    FOREIGN KEY (page_id) REFERENCES scan_import_pages(id),
    FOREIGN KEY (member_id) REFERENCES members(id)
);
SQL;
