From cac19834a2d4c91deccad40a86a09c8613ef1644 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Wed, 12 Aug 2020 19:47:22 +0200 Subject: [PATCH] Update database schema. Signed-off-by: David Mehren --- docs/dev/db-schema.plantuml | 105 ++++++++++++++++++++++++++---------- 1 file changed, 76 insertions(+), 29 deletions(-) diff --git a/docs/dev/db-schema.plantuml b/docs/dev/db-schema.plantuml index 57e017a57..06047ca63 100644 --- a/docs/dev/db-schema.plantuml +++ b/docs/dev/db-schema.plantuml @@ -5,38 +5,74 @@ hide circle ' avoid problems with angled crows feet skinparam linetype ortho -entity "Note" as note { +entity "Note" { *id : uuid <> -- *shortid : text *alias : text *viewcount : number - *owner_id : uuid <> + *ownerId : uuid <> } -entity "User" as user { +entity "User" { *id : uuid <> -- - *e1_id : number <> - other_details : text + *userName : text + *displayName : text + *createdAt : date + *updatedAt : date + photo : text + email : text } -entity "Revision" as revision { +entity "AuthToken" as authToken{ + *id : number <> + -- + *userId : uuid + *accessToken : text +} + +entity "Identity" { + *id : number + -- + *userId : uuid <> + ' Identifies the external login provider and is set in the config + *providerName : text + *syncSource : boolean + *createdAt : date + *updatedAt : date + ' The unique identifier of a user from the login provider + providerUserId : text + ' Token used to access the OAuth provider in the users name. Can be NULL + oauthAccessToken : text + ' Password hash. Can be NULL + passwordHash : text +} + +entity "Session" as seesion { + *id : text + -- + *expiredAt : number + *json : text +} + + +entity "Revision" { *id : uuid <> -- - *note_id : uuid <> + *noteId : uuid <> *content : text *patch : text *createdAt : date *length : number *authorship : text - + } -entity "Authorship" as authorship { +entity "Authorship" { *id : uuid <> -- - *user_id : uuid > + *userId : uuid > *startPos : number *endPos : number *createdAt : date @@ -44,13 +80,21 @@ entity "Authorship" as authorship { } entity "RevisionAuthorship" { - *revision_id : uuid <> - *authorship_id : uuid <> + *revisionId : uuid <> + *authorshipId : uuid <> } +entity "AuthorColors" { + *noteId : uuid <> + *userId : uuid <> + -- + *color : text +} + + entity "NoteUserPermission" { - *user_id : uuid <> - *note_id : uuid <> + *userId : uuid <> + *noteId : uuid <> -- *canEdit : boolean } @@ -62,26 +106,29 @@ entity "Group" { *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 + ' or "logged in users can view" to the group permission system *special : boolean } - + entity "NoteGroupPermission" { - *group_id : number <> - *note_id : uuid <> + *groupId : number <> + *noteId : 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 +Note "1" - "1..*" Revision +Revision "0..*" - "0..*" Authorship +(Revision, Authorship) .. RevisionAuthorship +Authorship "1" - "1" User +Note "1" - "0..*" User : owner +Note "1" - "0..*" NoteUserPermission +NoteUserPermission "1" - "1" User +Note "1" - "0..*" NoteGroupPermission NoteGroupPermission "1" - "1" Group -@enduml \ No newline at end of file +Identity "1..*" - "1" User +authToken "1..*" - "1" User +seesion "1..*" - "1" User +Note "0..*" - "0..*" User : color +(Note, User) .. AuthorColors +@enduml