Lots of things
This commit is contained in:
+7
-14
@@ -5,29 +5,21 @@ create table Users
|
||||
password varchar(255) not null,
|
||||
|
||||
constraint username unique (username)
|
||||
);
|
||||
) character set 'utf8mb4'
|
||||
collate 'utf8mb4_general_ci';
|
||||
|
||||
create table Notes
|
||||
(
|
||||
uuid binary(16) not null primary key,
|
||||
title varchar(50) not null,
|
||||
content text not null,
|
||||
user_id int not null,
|
||||
updated_at datetime null,
|
||||
|
||||
constraint Notes_fk_user foreign key (user_id) references Users (id) on delete cascade
|
||||
);
|
||||
|
||||
create table Chapters
|
||||
(
|
||||
id int auto_increment primary key,
|
||||
number int not null,
|
||||
title varchar(50) not null,
|
||||
content text not null,
|
||||
note_uuid binary(16) not null,
|
||||
constraint Chapters_fk_note foreign key (note_uuid) references Notes (uuid) on delete cascade
|
||||
);
|
||||
|
||||
create index note_uuid on Chapters (note_uuid);
|
||||
) character set 'utf8mb4'
|
||||
collate 'utf8mb4_general_ci';
|
||||
|
||||
create index user_id on Notes (user_id);
|
||||
|
||||
@@ -37,6 +29,7 @@ create table Tags
|
||||
name varchar(50) not null,
|
||||
note_uuid binary(16) not null,
|
||||
constraint Tags_fk_note foreign key (note_uuid) references Notes (uuid) on delete cascade
|
||||
);
|
||||
) character set 'utf8mb4'
|
||||
collate 'utf8mb4_general_ci';
|
||||
|
||||
create index note_uuid on Tags (note_uuid);
|
||||
Reference in New Issue
Block a user