@startuml hide circle skinparam nodesep 60 entity "note" { *id : uuid <> -- *shortid : text alias : text *viewcount : number *ownerId : uuid <> description: text title: text } entity "user" { *id : uuid <> -- *userName : text *displayName : text *createdAt : date *updatedAt : date photo : text email : text } entity "auth_token"{ *id : number <> -- *userId : uuid *keyId: text *accessToken : text *label: text *createdAt: date lastUsed: number validUntil: number } 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" { *id : text -- *expiredAt : number *json : text } entity "revision" { *id : number <> -- *noteId : uuid <> *content : text *patch : text *createdAt : date *length : number } entity "authorship" { *id : uuid <> -- *userId : uuid > *startPos : number *endPos : number *createdAt : date *updatedAt : date } entity "revision_authorship" { *revisionId : number <> *authorshipId : uuid <> } entity "author_colors" { *noteId : uuid <> *userId : uuid <> -- *color : text } entity "note_user_permission" { *userId : uuid <> *noteId : 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 "note_group_permission" { *groupId : number <> *noteId : uuid <> -- *canEdit : boolean } entity "tag" { *id: number <> *name: text } entity "media_upload" { *id : text <> -- *noteId : uuid <> *userId : uuid <> *backendType: text backendData: text *createdAt : date } user "1" -- "0..*" note: owner user "1" -u- "1..*" identity user "1" - "1..*" auth_token: authTokens user "1" -l- "1..*" session user "1" - "0..*" media_upload user "0..*" -- "0..*" note user "1" - "0..*" authorship (user, note) . author_colors revision "0..*" - "0..*" authorship (revision, authorship) .. revision_authorship media_upload "0..*" -- "1" note note "1" - "1..*" revision note "0..*" -l- "0..*" tag note "0..*" -- "0..*" group user "0..*" -- "0..*" note (user, note) . note_user_permission (note, group) . note_group_permission @enduml