@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