Update database schema.

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2020-08-12 19:47:22 +02:00
parent fbd89977cd
commit 2050f5acc2
No known key found for this signature in database
GPG key ID: 6017AF117F9756CB

View file

@ -5,38 +5,74 @@ hide circle
' avoid problems with angled crows feet ' avoid problems with angled crows feet
skinparam linetype ortho skinparam linetype ortho
entity "Note" as note { entity "Note" {
*id : uuid <<generated>> *id : uuid <<generated>>
-- --
*shortid : text *shortid : text
*alias : text *alias : text
*viewcount : number *viewcount : number
*owner_id : uuid <<FK User>> *ownerId : uuid <<FK User>>
} }
entity "User" as user { entity "User" {
*id : uuid <<generated>> *id : uuid <<generated>>
-- --
*e1_id : number <<FK>> *userName : text
other_details : text *displayName : text
*createdAt : date
*updatedAt : date
photo : text
email : text
} }
entity "Revision" as revision { entity "AuthToken" as authToken{
*id : number <<generated>>
--
*userId : uuid
*accessToken : text
}
entity "Identity" {
*id : number
--
*userId : uuid <<FK User>>
' 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 <<generated>> *id : uuid <<generated>>
-- --
*note_id : uuid <<FK Note>> *noteId : uuid <<FK Note>>
*content : text *content : text
*patch : text *patch : text
*createdAt : date *createdAt : date
*length : number *length : number
*authorship : text *authorship : text
} }
entity "Authorship" as authorship { entity "Authorship" {
*id : uuid <<generated>> *id : uuid <<generated>>
-- --
*user_id : uuid <FK User>> *userId : uuid <FK User>>
*startPos : number *startPos : number
*endPos : number *endPos : number
*createdAt : date *createdAt : date
@ -44,13 +80,21 @@ entity "Authorship" as authorship {
} }
entity "RevisionAuthorship" { entity "RevisionAuthorship" {
*revision_id : uuid <<FK Revision>> *revisionId : uuid <<FK Revision>>
*authorship_id : uuid <<FK Authorship>> *authorshipId : uuid <<FK Authorship>>
} }
entity "AuthorColors" {
*noteId : uuid <<FK Note>>
*userId : uuid <<FK User>>
--
*color : text
}
entity "NoteUserPermission" { entity "NoteUserPermission" {
*user_id : uuid <<FK User>> *userId : uuid <<FK User>>
*note_id : uuid <<FK Note>> *noteId : uuid <<FK Note>>
-- --
*canEdit : boolean *canEdit : boolean
} }
@ -62,26 +106,29 @@ entity "Group" {
*displayName : text *displayName : text
' Is set to denote a special group ' Is set to denote a special group
' Special groups are used to map the old share settings like "everyone can edit" ' 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 *special : boolean
} }
entity "NoteGroupPermission" { entity "NoteGroupPermission" {
*group_id : number <<FK Group>> *groupId : number <<FK Group>>
*note_id : uuid <<FK Note>> *noteId : uuid <<FK Note>>
-- --
*canEdit : boolean *canEdit : boolean
} }
revision -left[hidden]- note Note "1" - "1..*" Revision
Revision "0..*" - "0..*" Authorship
note "1" - "1..*" revision (Revision, Authorship) .. RevisionAuthorship
revision "0..*" - "0..*" authorship Authorship "1" - "1" User
(revision, authorship) .. RevisionAuthorship Note "1" - "0..*" User : owner
authorship "1" - "1" user Note "1" - "0..*" NoteUserPermission
note "1" - "0..*" user NoteUserPermission "1" - "1" User
note "1" - "0..*" NoteUserPermission Note "1" - "0..*" NoteGroupPermission
NoteUserPermission "1" - "1" user
note "1" - "0..*" NoteGroupPermission
NoteGroupPermission "1" - "1" Group NoteGroupPermission "1" - "1" Group
@enduml Identity "1..*" - "1" User
authToken "1..*" - "1" User
seesion "1..*" - "1" User
Note "0..*" - "0..*" User : color
(Note, User) .. AuthorColors
@enduml