docs(dev): update database structure

This commit is contained in:
Elian Doran
2025-11-04 22:53:42 +02:00
parent 421c1f257e
commit 3359ff5470
9 changed files with 157 additions and 60 deletions

View File

@@ -6,10 +6,10 @@
| `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`). |
| `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. |
| `deleteId` | Text | Non-null | `null` | |
| `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`) |
| `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`) |
| `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. |
| `utcDateModified` | Text | Non-null | | Modification date in UTC format (e.g. `2023-11-08 16:43:44.204Z`) |

View File

@@ -1,7 +1,7 @@
# revisions
| 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. |
| `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`). |

View 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. |

View 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"`). |

View File

@@ -383,7 +383,7 @@ for (const blob of orphanedBlobs) {
**Process:**
```sh
```
# Check for vulnerabilities
npm audit
@@ -424,7 +424,7 @@ npm audit fix --force
**pnpm Patches:**
```sh
```
# Create patch
pnpm patch @ckeditor/ckeditor5

View File

@@ -9,7 +9,7 @@ Trilium implements a **bidirectional synchronization system** that allows users
## Sync Architecture
```mermaid
```
graph TB
Desktop1[Desktop 1<br/>Client]
Desktop2[Desktop 2<br/>Client]

View File

@@ -1,5 +1,5 @@
# 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 _Developer's Guide_ represents a set of Markdown documents that present the internals of Trilium, for developers.