# RustBox database schema and migrations RustBox keeps one complete fresh-install schema per supported SQL backend: - `sqlite/schema.sql` - `mysql/schema.sql` - `pgsql/schema.sql` ## Compatibility baseline The consolidated compatibility baseline is **V050**. Historical migrations V047-V050 are already represented by the complete `schema.sql` files and are intentionally not shipped as standalone runtime migrations in this source tree. Databases older than V050 must first be upgraded with a RustBox release that can reach V050. RustBox 0.2.16 accepts V050 databases and migrates them forward normally. ## V051 — RustBox 0.2.16 V051 adds the preferences introduced in 0.2.16: - `display_preferences.adaptive_email_colors`, default `0` / disabled; - `mail_preferences.message_loading_mode`, default `pagination`. `mail_preferences.messages_per_page` remains `300` by default. Supported message loading modes are `pagination`, `progressive` and `all`. Fresh installations already contain the V051 columns in `schema.sql` and are registered at the latest schema version. Existing V050 tenants execute `V051__adaptive_email_colors_and_message_loading_mode.sql` before application queries use the new columns. ## V052 — RustBox 0.2.22 V052 adds the `snoozed_messages` table used by the Snooze feature introduced in 0.2.22: a message can be hidden from its folder listing in the client until a chosen wake time, without being moved on the real IMAP server. The table is local cache state only (no IMAP side effects) and has no foreign keys, matching `message_tags`' existing exemption from forward-referencing foreign keys in the MySQL/PostgreSQL schemas. Fresh installations already contain `snoozed_messages` in `schema.sql` and are registered at the latest schema version. Existing V051 tenants execute `V052__snooze.sql`. The next migration number is **V053**. ## Migration rules Any future schema-changing release must: 1. update all three complete `schema.sql` files; 2. add the same logical numbered migration for SQLite, MySQL and PostgreSQL; 3. register that migration in `src/db/pool.rs`; 4. extend the offline migration tests in `scripts/validate-release-static.py`.