docs: Add database concept and schema
This commit is contained in:
parent
1ce103b59d
commit
64397a0b74
1 changed files with 132 additions and 0 deletions
132
doc/modules/ROOT/db-schema.adoc
Normal file
132
doc/modules/ROOT/db-schema.adoc
Normal file
|
@ -0,0 +1,132 @@
|
|||
# Items database object and table schema
|
||||
|
||||
The base schema of the item objects are data and link object, which have both a
|
||||
type. This way you could model the description "Chassis contains Mainboard" or
|
||||
"Service runs on Server".
|
||||
|
||||
.Object schema concept
|
||||
[plantuml, format=svg]
|
||||
----
|
||||
@startuml
|
||||
|
||||
left to right direction
|
||||
scale 200 width
|
||||
|
||||
header Concept
|
||||
title General object and link
|
||||
|
||||
object data1
|
||||
object data2
|
||||
object link1
|
||||
|
||||
data1 : id: "uuid"
|
||||
data1 : type: "data type"
|
||||
data1 : data: "json"
|
||||
|
||||
data2 : id: "uuid"
|
||||
data2 : type: "data type"
|
||||
data2 : data: "json"
|
||||
|
||||
link1 : id: "uuid"
|
||||
link1 : type: "link type"
|
||||
link1 : from: "data.id"
|
||||
link1 : to: "data.id"
|
||||
|
||||
|
||||
data1::id <- link1::from
|
||||
link1::to -> data2::id
|
||||
@enduml
|
||||
----
|
||||
|
||||
.Object schema example
|
||||
[plantuml, format=svg]
|
||||
----
|
||||
@startuml
|
||||
|
||||
left to right direction
|
||||
scale 400 width
|
||||
|
||||
header Example
|
||||
title Chassis contains Mainboard
|
||||
|
||||
object data3
|
||||
object data4
|
||||
object link2
|
||||
|
||||
data3 : id: "afd61751-dbee-4010-91dc-1263155d6a56"
|
||||
data3 : type: "Chassis"
|
||||
data3 : data: "{\n"serial": "12345678"\n}"
|
||||
|
||||
data4 : id: "96dcf778-0875-437f-adc0-03545f9f06be"
|
||||
data4 : type: "Mainboard"
|
||||
data4 : data: "{\n "serial": "ABCDEFGHI"\n}"
|
||||
|
||||
link2 : id: "f4402dbb-05db-4903-a378-5bff14cf91ca"
|
||||
link2 : type: "contains"
|
||||
link2 : from: "afd61751-dbee-4010-91dc-1263155d6a56"
|
||||
link2 : to: "96dcf778-0875-437f-adc0-03545f9f06be"
|
||||
|
||||
|
||||
data3::id <- link2::from
|
||||
link2::to -> data4::id
|
||||
|
||||
@enduml
|
||||
|
||||
----
|
||||
|
||||
.Table schema
|
||||
[plantuml, format=svg]
|
||||
----
|
||||
@startuml
|
||||
|
||||
left to right direction
|
||||
' scale 350 width
|
||||
' skinparam linetype ortho
|
||||
|
||||
entity link_schema #eee8d5 {
|
||||
* id: "uuid"
|
||||
--
|
||||
* type: "a|b|c"
|
||||
}
|
||||
|
||||
entity link #fdf6e3 {
|
||||
* id: "uuid"
|
||||
--
|
||||
* type: "schema_link"
|
||||
* from: "data.id uuid"
|
||||
* to: "data.id uuid"
|
||||
}
|
||||
|
||||
note right of link_schema #add1b2
|
||||
link_schema has only an 'object_type'
|
||||
end note
|
||||
|
||||
entity data_schema #eee8d5 {
|
||||
* id: "uuid"
|
||||
--
|
||||
* type: "x|y|z"
|
||||
* schema: "json"
|
||||
}
|
||||
|
||||
entity data #fdf6e3 {
|
||||
* id: "uuid"
|
||||
--
|
||||
* type: "data_schema"
|
||||
* data: "data_schema.schema json"
|
||||
}
|
||||
|
||||
|
||||
link::from -> data::id #A9DCDF
|
||||
data::id <- link::to #A9DCDF
|
||||
|
||||
|
||||
link_schema::type -> link::type
|
||||
|
||||
data_schema::type -> data::type
|
||||
data::data <- data_schema::schema
|
||||
|
||||
|
||||
|
||||
|
||||
@enduml
|
||||
----
|
Loading…
Reference in a new issue