mirror of
https://github.com/zadam/trilium.git
synced 2025-11-08 14:25:51 +01:00
docs(dev): update database structure
This commit is contained in:
116
docs/Developer Guide/!!!meta.json
vendored
116
docs/Developer Guide/!!!meta.json
vendored
@@ -15,6 +15,20 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"mime": "text/html",
|
"mime": "text/html",
|
||||||
"attributes": [
|
"attributes": [
|
||||||
|
{
|
||||||
|
"type": "relation",
|
||||||
|
"name": "internalLink",
|
||||||
|
"value": "T2W7WCZrYZBU",
|
||||||
|
"isInheritable": false,
|
||||||
|
"position": 10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "relation",
|
||||||
|
"name": "internalLink",
|
||||||
|
"value": "cxfTSHIUQtt2",
|
||||||
|
"isInheritable": false,
|
||||||
|
"position": 20
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "label",
|
"type": "label",
|
||||||
"name": "label:shareAlias",
|
"name": "label:shareAlias",
|
||||||
@@ -35,20 +49,6 @@
|
|||||||
"value": "developer-guide",
|
"value": "developer-guide",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 30
|
"position": 30
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "relation",
|
|
||||||
"name": "internalLink",
|
|
||||||
"value": "T2W7WCZrYZBU",
|
|
||||||
"isInheritable": false,
|
|
||||||
"position": 40
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "relation",
|
|
||||||
"name": "internalLink",
|
|
||||||
"value": "cxfTSHIUQtt2",
|
|
||||||
"isInheritable": false,
|
|
||||||
"position": 50
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"format": "markdown",
|
"format": "markdown",
|
||||||
@@ -245,6 +245,13 @@
|
|||||||
"value": "database",
|
"value": "database",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 20
|
"position": 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "label",
|
||||||
|
"name": "iconClass",
|
||||||
|
"value": "bx bx-data",
|
||||||
|
"isInheritable": false,
|
||||||
|
"position": 30
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"format": "markdown",
|
"format": "markdown",
|
||||||
@@ -590,13 +597,6 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"mime": "text/html",
|
"mime": "text/html",
|
||||||
"attributes": [
|
"attributes": [
|
||||||
{
|
|
||||||
"type": "relation",
|
|
||||||
"name": "internalLink",
|
|
||||||
"value": "VIcWnKGs0sMh",
|
|
||||||
"isInheritable": false,
|
|
||||||
"position": 10
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
@@ -624,6 +624,13 @@
|
|||||||
"value": "notes",
|
"value": "notes",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 40
|
"position": 40
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "relation",
|
||||||
|
"name": "internalLink",
|
||||||
|
"value": "VIcWnKGs0sMh",
|
||||||
|
"isInheritable": false,
|
||||||
|
"position": 50
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"format": "markdown",
|
"format": "markdown",
|
||||||
@@ -765,6 +772,71 @@
|
|||||||
"format": "markdown",
|
"format": "markdown",
|
||||||
"dataFileName": "revisions.md",
|
"dataFileName": "revisions.md",
|
||||||
"attachments": []
|
"attachments": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"isClone": false,
|
||||||
|
"noteId": "6DG1au6rgOTl",
|
||||||
|
"notePath": [
|
||||||
|
"jdjRLhLV3TtI",
|
||||||
|
"MhwWMgxwDTZL",
|
||||||
|
"pRZhrVIGCbMu",
|
||||||
|
"vNMojjUN76jc",
|
||||||
|
"6DG1au6rgOTl"
|
||||||
|
],
|
||||||
|
"title": "sessions",
|
||||||
|
"notePosition": 66,
|
||||||
|
"prefix": null,
|
||||||
|
"isExpanded": false,
|
||||||
|
"type": "text",
|
||||||
|
"mime": "text/html",
|
||||||
|
"attributes": [
|
||||||
|
{
|
||||||
|
"type": "label",
|
||||||
|
"name": "iconClass",
|
||||||
|
"value": "bx bx-table",
|
||||||
|
"isInheritable": false,
|
||||||
|
"position": 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "label",
|
||||||
|
"name": "shareAlias",
|
||||||
|
"value": "sessions",
|
||||||
|
"isInheritable": false,
|
||||||
|
"position": 30
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"format": "markdown",
|
||||||
|
"dataFileName": "sessions.md",
|
||||||
|
"attachments": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"isClone": false,
|
||||||
|
"noteId": "zWY2LKmas9os",
|
||||||
|
"notePath": [
|
||||||
|
"jdjRLhLV3TtI",
|
||||||
|
"MhwWMgxwDTZL",
|
||||||
|
"pRZhrVIGCbMu",
|
||||||
|
"vNMojjUN76jc",
|
||||||
|
"zWY2LKmas9os"
|
||||||
|
],
|
||||||
|
"title": "user_data",
|
||||||
|
"notePosition": 76,
|
||||||
|
"prefix": null,
|
||||||
|
"isExpanded": false,
|
||||||
|
"type": "text",
|
||||||
|
"mime": "text/html",
|
||||||
|
"attributes": [
|
||||||
|
{
|
||||||
|
"type": "label",
|
||||||
|
"name": "iconClass",
|
||||||
|
"value": "bx bx-table",
|
||||||
|
"isInheritable": false,
|
||||||
|
"position": 20
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"format": "markdown",
|
||||||
|
"dataFileName": "user_data.md",
|
||||||
|
"attachments": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -817,7 +889,7 @@
|
|||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "Jg7clqogFOyD",
|
"value": "Jg7clqogFOyD",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 20
|
"position": 10
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "label",
|
"type": "label",
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
| `isProtected` | Integer | Non-null | 0 | `1` if the entity is [protected](../../../Concepts/Protected%20entities.md), `0` otherwise. |
|
| `isProtected` | Integer | Non-null | 0 | `1` if the entity is [protected](../../../Concepts/Protected%20entities.md), `0` otherwise. |
|
||||||
| `type` | Text | Non-null | `"text"` | The type of note (i.e. `text`, `file`, `code`, `relationMap`, `mermaid`, `canvas`). |
|
| `type` | Text | Non-null | `"text"` | The type of note (i.e. `text`, `file`, `code`, `relationMap`, `mermaid`, `canvas`). |
|
||||||
| `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. |
|
| `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. |
|
||||||
|
| `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. |
|
||||||
| `isDeleted` | Integer | Nullable | 0 | `1` if the entity is [deleted](../../../Concepts/Deleted%20notes.md), `0` otherwise. |
|
| `isDeleted` | Integer | Nullable | 0 | `1` if the entity is [deleted](../../../Concepts/Deleted%20notes.md), `0` otherwise. |
|
||||||
| `deleteId` | Text | Non-null | `null` | |
|
| `deleteId` | Text | Non-null | `null` | |
|
||||||
| `dateCreated` | Text | Non-null | | Localized creation date (e.g. `2023-11-08 18:43:44.204+0200`) |
|
| `dateCreated` | Text | Non-null | | Localized creation date (e.g. `2023-11-08 18:43:44.204+0200`) |
|
||||||
| `dateModified` | Text | Non-null | | Localized modification date (e.g. `2023-11-08 18:43:44.204+0200`) |
|
| `dateModified` | Text | Non-null | | Localized modification date (e.g. `2023-11-08 18:43:44.204+0200`) |
|
||||||
| `utcDateCreated` | Text | Non-null | | Creation date in UTC format (e.g. `2023-11-08 16:43:44.204Z`) |
|
| `utcDateCreated` | Text | Non-null | | Creation date in UTC format (e.g. `2023-11-08 16:43:44.204Z`) |
|
||||||
| `utcDateModified` | Text | Non-null | | Modification date in UTC format (e.g. `2023-11-08 16:43:44.204Z`) |
|
| `utcDateModified` | Text | Non-null | | Modification date in UTC format (e.g. `2023-11-08 16:43:44.204Z`) |
|
||||||
| `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. |
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# revisions
|
# revisions
|
||||||
| Column Name | Data Type | Nullity | Default value | Description |
|
| Column Name | Data Type | Nullity | Default value | Description |
|
||||||
| --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- |
|
||||||
| `revisionId` | TextText | Non-null | | Unique ID of the revision (e.g. `0GjgUqnEudI8`). |
|
| `revisionId` | Text | Non-null | | Unique ID of the revision (e.g. `0GjgUqnEudI8`). |
|
||||||
| `noteId` | Text | Non-null | | ID of the [note](notes.md) this revision belongs to. |
|
| `noteId` | Text | Non-null | | ID of the [note](notes.md) this revision belongs to. |
|
||||||
| `type` | Text | Non-null | `""` | The type of note (i.e. `text`, `file`, `code`, `relationMap`, `mermaid`, `canvas`). |
|
| `type` | Text | Non-null | `""` | The type of note (i.e. `text`, `file`, `code`, `relationMap`, `mermaid`, `canvas`). |
|
||||||
| `mime` | Text | Non-null | `""` | The MIME type of the note (e.g. `text/html`). |
|
| `mime` | Text | Non-null | `""` | The MIME type of the note (e.g. `text/html`). |
|
||||||
|
|||||||
8
docs/Developer Guide/Developer Guide/Architecture/Database/Database structure/sessions.md
vendored
Normal file
8
docs/Developer Guide/Developer Guide/Architecture/Database/Database structure/sessions.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# sessions
|
||||||
|
Contains user sessions for authentication purposes. The table is almost a direct mapping of the information that `express-session` requires.
|
||||||
|
|
||||||
|
| Column Name | Data Type | Nullity | Default value | Description |
|
||||||
|
| --- | --- | --- | --- | --- |
|
||||||
|
| `id` | Text | Non-null | | Unique, non-sequential ID of the session, directly as indicated by `express-session` |
|
||||||
|
| `data` | Text | Non-null | | The session information, in stringified JSON format. |
|
||||||
|
| `expires` | Integer | Non-null | | The expiration date of the session, extracted from the session information. Used to rapidly clean up expired sessions. |
|
||||||
17
docs/Developer Guide/Developer Guide/Architecture/Database/Database structure/user_data.md
vendored
Normal file
17
docs/Developer Guide/Developer Guide/Architecture/Database/Database structure/user_data.md
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# user_data
|
||||||
|
Contains the user information for two-factor authentication. This table is **not** used for multi-user.
|
||||||
|
|
||||||
|
Relevant files:
|
||||||
|
|
||||||
|
* `apps/server/src/services/encryption/open_id_encryption.ts`
|
||||||
|
|
||||||
|
| Column Name | Data Type | Nullity | Default value | Description |
|
||||||
|
| --- | --- | --- | --- | --- |
|
||||||
|
| `tmpID` | Integer | | | A sequential ID of the user. Since only one user is supported by Trilium, this value is always zero. |
|
||||||
|
| `username` | Text | | | The user name as returned from the OAuth operation. |
|
||||||
|
| `email` | Text | | | The email as returned from the OAuth operation. |
|
||||||
|
| `userIDEncryptedDataKey` | Text | | | An encrypted hash of the user subject identifier from the OAuth operation. |
|
||||||
|
| `userIDVerificationHash` | Text | | | A salted hash of the subject identifier from the OAuth operation. |
|
||||||
|
| `salt` | Text | | | The verification salt. |
|
||||||
|
| `derivedKey` | Text | | | A random secure token. |
|
||||||
|
| `isSetup` | Text | | `"false"` | Indicates that the user has been saved (`"true"`). |
|
||||||
@@ -383,7 +383,7 @@ for (const blob of orphanedBlobs) {
|
|||||||
|
|
||||||
**Process:**
|
**Process:**
|
||||||
|
|
||||||
```sh
|
```
|
||||||
# Check for vulnerabilities
|
# Check for vulnerabilities
|
||||||
npm audit
|
npm audit
|
||||||
|
|
||||||
@@ -424,7 +424,7 @@ npm audit fix --force
|
|||||||
|
|
||||||
**pnpm Patches:**
|
**pnpm Patches:**
|
||||||
|
|
||||||
```sh
|
```
|
||||||
# Create patch
|
# Create patch
|
||||||
pnpm patch @ckeditor/ckeditor5
|
pnpm patch @ckeditor/ckeditor5
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ Trilium implements a **bidirectional synchronization system** that allows users
|
|||||||
|
|
||||||
## Sync Architecture
|
## Sync Architecture
|
||||||
|
|
||||||
```mermaid
|
```
|
||||||
graph TB
|
graph TB
|
||||||
Desktop1[Desktop 1<br/>Client]
|
Desktop1[Desktop 1<br/>Client]
|
||||||
Desktop2[Desktop 2<br/>Client]
|
Desktop2[Desktop 2<br/>Client]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Documentation
|
# Documentation
|
||||||
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">
|
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">
|
||||||
|
|
||||||
* The _User Guide_ represents the user-facing documentation. This documentation can be browsed by users directly from within Trilium, by pressing <kbd>F1</kbd>.
|
* The _User Guide_ represents the user-facing documentation. This documentation can be browsed by users directly from within Trilium, by pressing <kbd>F1</kbd>.
|
||||||
* The _Developer's Guide_ represents a set of Markdown documents that present the internals of Trilium, for developers.
|
* The _Developer's Guide_ represents a set of Markdown documents that present the internals of Trilium, for developers.
|
||||||
|
|||||||
62
docs/User Guide/!!!meta.json
vendored
62
docs/User Guide/!!!meta.json
vendored
@@ -25,56 +25,35 @@
|
|||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "BFs8mudNFgCS",
|
"value": "gh7bpGYxajRS",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 20
|
"position": 20
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "relation",
|
||||||
|
"name": "internalLink",
|
||||||
|
"value": "BFs8mudNFgCS",
|
||||||
|
"isInheritable": false,
|
||||||
|
"position": 30
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "GTwFsgaA0lCt",
|
"value": "GTwFsgaA0lCt",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 30
|
"position": 40
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "label",
|
|
||||||
"name": "shareAlias",
|
|
||||||
"value": "user-guide",
|
|
||||||
"isInheritable": false,
|
|
||||||
"position": 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "label",
|
|
||||||
"name": "label:shareAlias",
|
|
||||||
"value": "promoted,alias=Slug,single,text",
|
|
||||||
"isInheritable": true,
|
|
||||||
"position": 20
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "label",
|
|
||||||
"name": "iconClass",
|
|
||||||
"value": "bx bx-help-circle",
|
|
||||||
"isInheritable": false,
|
|
||||||
"position": 30
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "poXkQfguuA0U",
|
"value": "poXkQfguuA0U",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 40
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "relation",
|
|
||||||
"name": "internalLink",
|
|
||||||
"value": "WOcw2SLH6tbX",
|
|
||||||
"isInheritable": false,
|
|
||||||
"position": 50
|
"position": 50
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "relation",
|
"type": "relation",
|
||||||
"name": "internalLink",
|
"name": "internalLink",
|
||||||
"value": "gh7bpGYxajRS",
|
"value": "WOcw2SLH6tbX",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 60
|
"position": 60
|
||||||
},
|
},
|
||||||
@@ -98,6 +77,27 @@
|
|||||||
"value": "9qPsTWBorUhQ",
|
"value": "9qPsTWBorUhQ",
|
||||||
"isInheritable": false,
|
"isInheritable": false,
|
||||||
"position": 90
|
"position": 90
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "label",
|
||||||
|
"name": "shareAlias",
|
||||||
|
"value": "user-guide",
|
||||||
|
"isInheritable": false,
|
||||||
|
"position": 10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "label",
|
||||||
|
"name": "label:shareAlias",
|
||||||
|
"value": "promoted,alias=Slug,single,text",
|
||||||
|
"isInheritable": true,
|
||||||
|
"position": 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "label",
|
||||||
|
"name": "iconClass",
|
||||||
|
"value": "bx bx-help-circle",
|
||||||
|
"isInheritable": false,
|
||||||
|
"position": 30
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"format": "markdown",
|
"format": "markdown",
|
||||||
|
|||||||
Reference in New Issue
Block a user