Files

29 lines
1.1 KiB
SQL

-- SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
create table `files_file` (
`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,
`status` text not null,
`storage_key` text not null,
`filename` text not null,
`content_type` text not null,
`size` integer,
`sha256` text,
`uploaded_by` char(36) not null,
`stored_at` text,
`upload_id` text,
`declared_size` integer,
`part_size` integer,
`deleting_at` text
) engine=InnoDB default charset=utf8mb4;
alter table `files_file` add constraint `files_file_org_id_workspace_id_project_id_storage_key_key` unique (`org_id`, `workspace_id`, `project_id`, `storage_key`);
create index `files_file_org_id_workspace_id_project_id_status_idx` on `files_file` (`org_id`, `workspace_id`, `project_id`, `status`(191));
create index `files_file_org_id_workspace_id_project_id_sha256_idx` on `files_file` (`org_id`, `workspace_id`, `project_id`, `sha256`(191));