From aa462674bc5171eb575d5c52074c527958de1902 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Mon, 27 Jul 2020 22:35:12 +0200 Subject: [PATCH] Add (still incomplete) database schema Signed-off-by: David Mehren --- docs/dev/db-schema.plantuml | 87 +++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 docs/dev/db-schema.plantuml diff --git a/docs/dev/db-schema.plantuml b/docs/dev/db-schema.plantuml new file mode 100644 index 000000000..57e017a57 --- /dev/null +++ b/docs/dev/db-schema.plantuml @@ -0,0 +1,87 @@ +@startuml +' hide the spot +hide circle + +' avoid problems with angled crows feet +skinparam linetype ortho + +entity "Note" as note { + *id : uuid <> + -- + *shortid : text + *alias : text + *viewcount : number + *owner_id : uuid <> +} + +entity "User" as user { + *id : uuid <> + -- + *e1_id : number <> + other_details : text +} + +entity "Revision" as revision { + *id : uuid <> + -- + *note_id : uuid <> + *content : text + *patch : text + *createdAt : date + *length : number + *authorship : text + +} + +entity "Authorship" as authorship { + *id : uuid <> + -- + *user_id : uuid > + *startPos : number + *endPos : number + *createdAt : date + *updatedAt : date +} + +entity "RevisionAuthorship" { + *revision_id : uuid <> + *authorship_id : uuid <> +} + +entity "NoteUserPermission" { + *user_id : uuid <> + *note_id : uuid <> + -- + *canEdit : boolean +} + +entity "Group" { + *id : number <> + -- + *name : text <> + *displayName : text + ' Is set to denote a special group + ' Special groups are used to map the old share settings like "everyone can edit" + ' or "logged in users can view" to the group permission system + *special : boolean + } + + entity "NoteGroupPermission" { + *group_id : number <> + *note_id : uuid <> + -- + *canEdit : boolean +} + +revision -left[hidden]- note + +note "1" - "1..*" revision +revision "0..*" - "0..*" authorship +(revision, authorship) .. RevisionAuthorship +authorship "1" - "1" user +note "1" - "0..*" user +note "1" - "0..*" NoteUserPermission +NoteUserPermission "1" - "1" user +note "1" - "0..*" NoteGroupPermission +NoteGroupPermission "1" - "1" Group +@enduml \ No newline at end of file