1 parent
fb9eab87eb
commit
d91212d24c
40 files changed
+585
-380
No files matched your search
+11
-26
@@ -1,6 +1,6 @@
|
||||
# Database schemas and migrations
|
||||
|
||||
RustBox 0.2.15 keeps SQL, blob storage and search as independent concerns:
|
||||
RustBox keeps SQL, blob storage and search as independent concerns.
|
||||
|
||||
```text
|
||||
database_backend = sqlite | mysql | pgsql
|
||||
@@ -9,41 +9,26 @@ storage.backend = filesystem | s3
|
||||
search.backend = disabled | local_tantivy | opensearch
|
||||
```
|
||||
|
||||
When `session_backend = "database"`, sessions live in the selected SQL database. `session_backend = "redis"` moves only session persistence to Redis/Redis Sentinel.
|
||||
|
||||
## Layout
|
||||
|
||||
```text
|
||||
migrations/
|
||||
├── sqlite/
|
||||
│ ├── schema.sql
|
||||
│ ├── V047__blob_keys_and_search_outbox.sql
|
||||
│ ├── V048__folder_counter_generation.sql
|
||||
│ ├── V049__blob_delete_outbox.sql
|
||||
│ └── V050__compact_rows_and_signature_mode.sql
|
||||
├── mysql/
|
||||
│ ├── schema.sql
|
||||
│ ├── V047__blob_keys_and_search_outbox.sql
|
||||
│ ├── V048__folder_counter_generation.sql
|
||||
│ ├── V049__blob_delete_outbox.sql
|
||||
│ └── V050__compact_rows_and_signature_mode.sql
|
||||
└── pgsql/
|
||||
├── schema.sql
|
||||
├── V047__blob_keys_and_search_outbox.sql
|
||||
├── V048__folder_counter_generation.sql
|
||||
├── V049__blob_delete_outbox.sql
|
||||
└── V050__compact_rows_and_signature_mode.sql
|
||||
├── sqlite/schema.sql
|
||||
├── mysql/schema.sql
|
||||
└── pgsql/schema.sql
|
||||
```
|
||||
|
||||
Each `schema.sql` is the current complete schema for fresh installations. The historical compatibility baseline remains **V046**. RustBox 0.2.1 adds **V047**, which adds attachment SHA-256 metadata and the durable search outbox used by external indexing. RustBox 0.2.8 adds **V048**, which adds the monotonic `folders.counter_generation` used to reject stale IMAP counter writes even when the numeric counts temporarily return to an earlier value. RustBox 0.2.13 adds **V049**, the durable `blob_delete_outbox` used to retry physical object deletion after metadata is removed. RustBox 0.2.14 adds **V050**, which stores the default-on compact wide-row preference and each identity's signature insertion mode (`silent` or `visible`).
|
||||
Each `schema.sql` is the complete V050 schema for fresh installations. Migrations V047-V049 have been consolidated into the **V049 compatibility baseline** and their standalone files are intentionally removed. V050 remains the single runtime migration. Because RustBox 0.2.15 has not been released yet, V050 includes `mail_preferences.compact_wide_rows`, `identities.signature_insert_mode`, `display_preferences.adaptive_email_colors` and `mail_preferences.message_loading_mode`.
|
||||
|
||||
Account data is isolated inside the selected physical database with a deterministic, collision-checked table prefix derived from the account hash. The `{{p}}` marker in tenant SQL is replaced by RustBox at provisioning/migration time. Sessions are global and therefore are not prefixed.
|
||||
`mail_preferences.message_loading_mode` defaults to `pagination`; `messages_per_page` defaults to 300. Supported modes are `pagination`, `progressive` and `all`.
|
||||
|
||||
Databases older than **V049** are no longer migrated directly by this build. Upgrade them to schema V049 first; this build then applies V050. **V051** is the next migration number after this snapshot.
|
||||
|
||||
Account data is isolated inside the selected physical database with a deterministic, collision-checked table prefix derived from the account hash. The `{{p}}` marker in tenant SQL is replaced by RustBox at provisioning time. Sessions are global and therefore are not prefixed.
|
||||
|
||||
## Runtime migrations
|
||||
|
||||
Every schema-changing release must add the same logical migration for all supported SQL engines and register it in `src/db/pool.rs`. Do not update only `schema.sql`: fresh installs use the baseline while existing installations use the numbered migration path.
|
||||
|
||||
RustBox 0.2.14 adds runtime migration **V050** on SQLite, MySQL and PostgreSQL. **V051** is the next migration number.
|
||||
V050 is the only runtime migration in this unreleased snapshot. Future schema-changing releases must add the same logical migration for SQLite, MySQL and PostgreSQL and register it in `src/db/pool.rs`.
|
||||
|
||||
Redis and Redis Sentinel do not use SQL migrations.
|
||||
|
||||
|
||||
Reference in new issue
Block a user