create table `documents_document` ( `id` char(36) primary key, `version` integer not null, `created_at` datetime(6) not null, `updated_at` datetime(6) not null, `org_id` char(36) not null, `workspace_id` char(36) not null, `project_id` char(36) not null, `file_id` char(36) not null, `filename` text not null, `status` text not null, `ocr_job_id` integer, `page_count` integer, `proposed_count` integer, `failure_code` text, `finished_at` text ) engine=InnoDB default charset=utf8mb4; alter table `documents_document` add constraint `documents_document_org_id_workspace_id_project_id_file_id_key` unique (`org_id`, `workspace_id`, `project_id`, `file_id`); create index `documents_document_org_id_workspace_id_project_id_status_idx` on `documents_document` (`org_id`, `workspace_id`, `project_id`, `status`(191)); create table `documents_line` ( `id` char(36) primary key, `version` integer not null, `created_at` datetime(6) not null, `updated_at` datetime(6) not null, `org_id` char(36) not null, `workspace_id` char(36) not null, `project_id` char(36) not null, `document_id` char(36) not null, `proposal_id` char(36) not null, `label` text not null, `value` text not null, `page` integer not null, `position` integer not null, `quote` text not null, `edited` boolean not null, `approved_by` text not null ) engine=InnoDB default charset=utf8mb4; alter table `documents_line` add constraint `documents_line_org_id_workspace_id_project_id_proposal_id_key` unique (`org_id`, `workspace_id`, `project_id`, `proposal_id`); create index `documents_line_org_id_workspace_id_project_id_document_id_idx` on `documents_line` (`org_id`, `workspace_id`, `project_id`, `document_id`);