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 a5ffbb6e7f
commit cac19834a2
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3

View file

@ -5,26 +5,62 @@ hide circle
' avoid problems with angled crows feet
skinparam linetype ortho
entity "Note" as note {
entity "Note" {
*id : uuid <<generated>>
--
*shortid : text
*alias : text
*viewcount : number
*owner_id : uuid <<FK User>>
*ownerId : uuid <<FK User>>
}
entity "User" as user {
entity "User" {
*id : uuid <<generated>>
--
*e1_id : number <<FK>>
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 <<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>>
--
*note_id : uuid <<FK Note>>
*noteId : uuid <<FK Note>>
*content : text
*patch : text
*createdAt : date
@ -33,10 +69,10 @@ entity "Revision" as revision {
}
entity "Authorship" as authorship {
entity "Authorship" {
*id : uuid <<generated>>
--
*user_id : uuid <FK User>>
*userId : uuid <FK User>>
*startPos : number
*endPos : number
*createdAt : date
@ -44,13 +80,21 @@ entity "Authorship" as authorship {
}
entity "RevisionAuthorship" {
*revision_id : uuid <<FK Revision>>
*authorship_id : uuid <<FK Authorship>>
*revisionId : uuid <<FK Revision>>
*authorshipId : uuid <<FK Authorship>>
}
entity "AuthorColors" {
*noteId : uuid <<FK Note>>
*userId : uuid <<FK User>>
--
*color : text
}
entity "NoteUserPermission" {
*user_id : uuid <<FK User>>
*note_id : uuid <<FK Note>>
*userId : uuid <<FK User>>
*noteId : uuid <<FK Note>>
--
*canEdit : boolean
}
@ -67,21 +111,24 @@ entity "Group" {
}
entity "NoteGroupPermission" {
*group_id : number <<FK Group>>
*note_id : uuid <<FK Note>>
*groupId : number <<FK Group>>
*noteId : uuid <<FK Note>>
--
*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
Identity "1..*" - "1" User
authToken "1..*" - "1" User
seesion "1..*" - "1" User
Note "0..*" - "0..*" User : color
(Note, User) .. AuthorColors
@enduml