Skip to content

Commit 3359ff5

Browse files
committed
docs(dev): update database structure
1 parent 421c1f2 commit 3359ff5

File tree

9 files changed

+152
-55
lines changed

9 files changed

+152
-55
lines changed

docs/Developer Guide/!!!meta.json

Lines changed: 94 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@
1515
"type": "text",
1616
"mime": "text/html",
1717
"attributes": [
18+
{
19+
"type": "relation",
20+
"name": "internalLink",
21+
"value": "T2W7WCZrYZBU",
22+
"isInheritable": false,
23+
"position": 10
24+
},
25+
{
26+
"type": "relation",
27+
"name": "internalLink",
28+
"value": "cxfTSHIUQtt2",
29+
"isInheritable": false,
30+
"position": 20
31+
},
1832
{
1933
"type": "label",
2034
"name": "label:shareAlias",
@@ -35,20 +49,6 @@
3549
"value": "developer-guide",
3650
"isInheritable": false,
3751
"position": 30
38-
},
39-
{
40-
"type": "relation",
41-
"name": "internalLink",
42-
"value": "T2W7WCZrYZBU",
43-
"isInheritable": false,
44-
"position": 40
45-
},
46-
{
47-
"type": "relation",
48-
"name": "internalLink",
49-
"value": "cxfTSHIUQtt2",
50-
"isInheritable": false,
51-
"position": 50
5252
}
5353
],
5454
"format": "markdown",
@@ -245,6 +245,13 @@
245245
"value": "database",
246246
"isInheritable": false,
247247
"position": 20
248+
},
249+
{
250+
"type": "label",
251+
"name": "iconClass",
252+
"value": "bx bx-data",
253+
"isInheritable": false,
254+
"position": 30
248255
}
249256
],
250257
"format": "markdown",
@@ -590,13 +597,6 @@
590597
"type": "text",
591598
"mime": "text/html",
592599
"attributes": [
593-
{
594-
"type": "relation",
595-
"name": "internalLink",
596-
"value": "VIcWnKGs0sMh",
597-
"isInheritable": false,
598-
"position": 10
599-
},
600600
{
601601
"type": "relation",
602602
"name": "internalLink",
@@ -624,6 +624,13 @@
624624
"value": "notes",
625625
"isInheritable": false,
626626
"position": 40
627+
},
628+
{
629+
"type": "relation",
630+
"name": "internalLink",
631+
"value": "VIcWnKGs0sMh",
632+
"isInheritable": false,
633+
"position": 50
627634
}
628635
],
629636
"format": "markdown",
@@ -765,6 +772,71 @@
765772
"format": "markdown",
766773
"dataFileName": "revisions.md",
767774
"attachments": []
775+
},
776+
{
777+
"isClone": false,
778+
"noteId": "6DG1au6rgOTl",
779+
"notePath": [
780+
"jdjRLhLV3TtI",
781+
"MhwWMgxwDTZL",
782+
"pRZhrVIGCbMu",
783+
"vNMojjUN76jc",
784+
"6DG1au6rgOTl"
785+
],
786+
"title": "sessions",
787+
"notePosition": 66,
788+
"prefix": null,
789+
"isExpanded": false,
790+
"type": "text",
791+
"mime": "text/html",
792+
"attributes": [
793+
{
794+
"type": "label",
795+
"name": "iconClass",
796+
"value": "bx bx-table",
797+
"isInheritable": false,
798+
"position": 20
799+
},
800+
{
801+
"type": "label",
802+
"name": "shareAlias",
803+
"value": "sessions",
804+
"isInheritable": false,
805+
"position": 30
806+
}
807+
],
808+
"format": "markdown",
809+
"dataFileName": "sessions.md",
810+
"attachments": []
811+
},
812+
{
813+
"isClone": false,
814+
"noteId": "zWY2LKmas9os",
815+
"notePath": [
816+
"jdjRLhLV3TtI",
817+
"MhwWMgxwDTZL",
818+
"pRZhrVIGCbMu",
819+
"vNMojjUN76jc",
820+
"zWY2LKmas9os"
821+
],
822+
"title": "user_data",
823+
"notePosition": 76,
824+
"prefix": null,
825+
"isExpanded": false,
826+
"type": "text",
827+
"mime": "text/html",
828+
"attributes": [
829+
{
830+
"type": "label",
831+
"name": "iconClass",
832+
"value": "bx bx-table",
833+
"isInheritable": false,
834+
"position": 20
835+
}
836+
],
837+
"format": "markdown",
838+
"dataFileName": "user_data.md",
839+
"attachments": []
768840
}
769841
]
770842
}
@@ -817,7 +889,7 @@
817889
"name": "internalLink",
818890
"value": "Jg7clqogFOyD",
819891
"isInheritable": false,
820-
"position": 20
892+
"position": 10
821893
},
822894
{
823895
"type": "label",

docs/Developer Guide/Developer Guide/Architecture/Database/Database structure/notes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
| `isProtected` | Integer | Non-null | 0 | `1` if the entity is [protected](../../../Concepts/Protected%20entities.md), `0` otherwise. |
77
| `type` | Text | Non-null | `"text"` | The type of note (i.e. `text`, `file`, `code`, `relationMap`, `mermaid`, `canvas`). |
88
| `mime` | Text | Non-null | `"text/html"` | The MIME type of the note (e.g. `text/html`).. Note that it can be an empty string in some circumstances, but not null. |
9+
| `blobId` | Text | Nullable | `null` | The corresponding ID from <a class="reference-link" href="blobs.md">blobs</a>. Although it can theoretically be `NULL`, haven't found any such note yet. |
910
| `isDeleted` | Integer | Nullable | 0 | `1` if the entity is [deleted](../../../Concepts/Deleted%20notes.md), `0` otherwise. |
1011
| `deleteId` | Text | Non-null | `null` | |
1112
| `dateCreated` | Text | Non-null | | Localized creation date (e.g. `2023-11-08 18:43:44.204+0200`) |
1213
| `dateModified` | Text | Non-null | | Localized modification date (e.g. `2023-11-08 18:43:44.204+0200`) |
1314
| `utcDateCreated` | Text | Non-null | | Creation date in UTC format (e.g. `2023-11-08 16:43:44.204Z`) |
14-
| `utcDateModified` | Text | Non-null | | Modification date in UTC format (e.g. `2023-11-08 16:43:44.204Z`) |
15-
| `blobId` | Text | Nullable | `null` | The corresponding ID from <a class="reference-link" href="blobs.md">blobs</a>. Although it can theoretically be `NULL`, haven't found any such note yet. |
15+
| `utcDateModified` | Text | Non-null | | Modification date in UTC format (e.g. `2023-11-08 16:43:44.204Z`) |

docs/Developer Guide/Developer Guide/Architecture/Database/Database structure/revisions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# revisions
22
| Column Name | Data Type | Nullity | Default value | Description |
33
| --- | --- | --- | --- | --- |
4-
| `revisionId` | TextText | Non-null | | Unique ID of the revision (e.g. `0GjgUqnEudI8`). |
4+
| `revisionId` | Text | Non-null | | Unique ID of the revision (e.g. `0GjgUqnEudI8`). |
55
| `noteId` | Text | Non-null | | ID of the [note](notes.md) this revision belongs to. |
66
| `type` | Text | Non-null | `""` | The type of note (i.e. `text`, `file`, `code`, `relationMap`, `mermaid`, `canvas`). |
77
| `mime` | Text | Non-null | `""` | The MIME type of the note (e.g. `text/html`). |
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# sessions
2+
Contains user sessions for authentication purposes. The table is almost a direct mapping of the information that `express-session` requires.
3+
4+
| Column Name | Data Type | Nullity | Default value | Description |
5+
| --- | --- | --- | --- | --- |
6+
| `id` | Text | Non-null | | Unique, non-sequential ID of the session, directly as indicated by `express-session` |
7+
| `data` | Text | Non-null | | The session information, in stringified JSON format. |
8+
| `expires` | Integer | Non-null | | The expiration date of the session, extracted from the session information. Used to rapidly clean up expired sessions. |
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# user_data
2+
Contains the user information for two-factor authentication. This table is **not** used for multi-user.
3+
4+
Relevant files:
5+
6+
* `apps/server/src/services/encryption/open_id_encryption.ts`
7+
8+
| Column Name | Data Type | Nullity | Default value | Description |
9+
| --- | --- | --- | --- | --- |
10+
| `tmpID` | Integer | | | A sequential ID of the user. Since only one user is supported by Trilium, this value is always zero. |
11+
| `username` | Text | | | The user name as returned from the OAuth operation. |
12+
| `email` | Text | | | The email as returned from the OAuth operation. |
13+
| `userIDEncryptedDataKey` | Text | | | An encrypted hash of the user subject identifier from the OAuth operation. |
14+
| `userIDVerificationHash` | Text | | | A salted hash of the subject identifier from the OAuth operation. |
15+
| `salt` | Text | | | The verification salt. |
16+
| `derivedKey` | Text | | | A random secure token. |
17+
| `isSetup` | Text | | `"false"` | Indicates that the user has been saved (`"true"`). |

docs/Developer Guide/Developer Guide/Architecture/Security.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ for (const blob of orphanedBlobs) {
383383

384384
**Process:**
385385

386-
```sh
386+
```
387387
# Check for vulnerabilities
388388
npm audit
389389
@@ -424,7 +424,7 @@ npm audit fix --force
424424

425425
**pnpm Patches:**
426426

427-
```sh
427+
```
428428
# Create patch
429429
pnpm patch @ckeditor/ckeditor5
430430

docs/Developer Guide/Developer Guide/Concepts/Synchronisation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Trilium implements a **bidirectional synchronization system** that allows users
99

1010
## Sync Architecture
1111

12-
```mermaid
12+
```
1313
graph TB
1414
Desktop1[Desktop 1<br/>Client]
1515
Desktop2[Desktop 2<br/>Client]

docs/Developer Guide/Developer Guide/Documentation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Documentation
2-
There are multiple types of documentation for Trilium:<img class="image-style-align-right" src="api/images/45okJ9xpVO32/Documentation_image.png" width="205" height="162">
2+
There are multiple types of documentation for Trilium:<img class="image-style-align-right" src="api/images/OrRMknW5zkc4/Documentation_image.png" width="205" height="162">
33

44
* The _User Guide_ represents the user-facing documentation. This documentation can be browsed by users directly from within Trilium, by pressing <kbd>F1</kbd>.
55
* The _Developer's Guide_ represents a set of Markdown documents that present the internals of Trilium, for developers.

docs/User Guide/!!!meta.json

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,56 +25,35 @@
2525
{
2626
"type": "relation",
2727
"name": "internalLink",
28-
"value": "BFs8mudNFgCS",
28+
"value": "gh7bpGYxajRS",
2929
"isInheritable": false,
3030
"position": 20
3131
},
3232
{
3333
"type": "relation",
3434
"name": "internalLink",
35-
"value": "GTwFsgaA0lCt",
36-
"isInheritable": false,
37-
"position": 30
38-
},
39-
{
40-
"type": "label",
41-
"name": "shareAlias",
42-
"value": "user-guide",
43-
"isInheritable": false,
44-
"position": 10
45-
},
46-
{
47-
"type": "label",
48-
"name": "label:shareAlias",
49-
"value": "promoted,alias=Slug,single,text",
50-
"isInheritable": true,
51-
"position": 20
52-
},
53-
{
54-
"type": "label",
55-
"name": "iconClass",
56-
"value": "bx bx-help-circle",
35+
"value": "BFs8mudNFgCS",
5736
"isInheritable": false,
5837
"position": 30
5938
},
6039
{
6140
"type": "relation",
6241
"name": "internalLink",
63-
"value": "poXkQfguuA0U",
42+
"value": "GTwFsgaA0lCt",
6443
"isInheritable": false,
6544
"position": 40
6645
},
6746
{
6847
"type": "relation",
6948
"name": "internalLink",
70-
"value": "WOcw2SLH6tbX",
49+
"value": "poXkQfguuA0U",
7150
"isInheritable": false,
7251
"position": 50
7352
},
7453
{
7554
"type": "relation",
7655
"name": "internalLink",
77-
"value": "gh7bpGYxajRS",
56+
"value": "WOcw2SLH6tbX",
7857
"isInheritable": false,
7958
"position": 60
8059
},
@@ -98,6 +77,27 @@
9877
"value": "9qPsTWBorUhQ",
9978
"isInheritable": false,
10079
"position": 90
80+
},
81+
{
82+
"type": "label",
83+
"name": "shareAlias",
84+
"value": "user-guide",
85+
"isInheritable": false,
86+
"position": 10
87+
},
88+
{
89+
"type": "label",
90+
"name": "label:shareAlias",
91+
"value": "promoted,alias=Slug,single,text",
92+
"isInheritable": true,
93+
"position": 20
94+
},
95+
{
96+
"type": "label",
97+
"name": "iconClass",
98+
"value": "bx bx-help-circle",
99+
"isInheritable": false,
100+
"position": 30
101101
}
102102
],
103103
"format": "markdown",

0 commit comments

Comments
 (0)