34 lines
1.4 KiB
SQL
34 lines
1.4 KiB
SQL
create table `notes_attachment` (
|
|
`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,
|
|
`note_id` char(36) not null,
|
|
`file_id` char(36) not null,
|
|
`attached_by` char(36) not null
|
|
) engine=InnoDB default charset=utf8mb4;
|
|
|
|
alter table `notes_attachment` add constraint `notes_attachment_org_id_workspace_id_project_id_note_id_f729c083` unique (`org_id`, `workspace_id`, `project_id`, `note_id`, `file_id`);
|
|
|
|
create index `notes_attachment_org_id_workspace_id_project_id_note_id_idx` on `notes_attachment` (`org_id`, `workspace_id`, `project_id`, `note_id`);
|
|
|
|
create index `notes_attachment_org_id_workspace_id_project_id_file_id_idx` on `notes_attachment` (`org_id`, `workspace_id`, `project_id`, `file_id`);
|
|
|
|
create table `notes_note` (
|
|
`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,
|
|
`title` text not null,
|
|
`body` text not null,
|
|
`created_by` char(36) not null
|
|
) engine=InnoDB default charset=utf8mb4;
|
|
|
|
create index `notes_note_org_id_workspace_id_project_id_created_by_idx` on `notes_note` (`org_id`, `workspace_id`, `project_id`, `created_by`);
|