multidb
This commit is contained in:
@@ -36,3 +36,27 @@ Use the **Page** button in the editor. RustPad creates a permanent public `/s/<t
|
||||
## Limit uploadu
|
||||
|
||||
The maximum size of a single file is configured with `UPLOAD_MAX_SIZE_MB` w `.env`, np. `UPLOAD_MAX_SIZE_MB=50`. The default is 20 MB. After changing it, restart the project with `./dev.sh`.
|
||||
|
||||
## Wybór bazy danych
|
||||
|
||||
RustPad wybiera silnik na podstawie `DATABASE_URL`:
|
||||
|
||||
- SQLite: `sqlite:///data/db/rustpad.db?mode=rwc&journal_mode=WAL&busy_timeout=5000`
|
||||
- PostgreSQL: `postgres://rustpad:rustpad@postgres:5432/rustpad`
|
||||
- MySQL: `mysql://rustpad:rustpad@mysql:3306/rustpad`
|
||||
|
||||
SQLite pozostaje domyślną bazą dla developmentu i małych instalacji. Tryb WAL pozwala czytać podczas zapisu, ale SQLite nadal wykonuje tylko jeden zapis naraz. `busy_timeout=5000` powoduje krótkie oczekiwanie zamiast natychmiastowego błędu `database is locked`. Przy wielu równoczesnych edytorach lub wielu instancjach aplikacji zalecany jest PostgreSQL albo MySQL.
|
||||
|
||||
Opcjonalne bazy w Docker Compose:
|
||||
|
||||
```bash
|
||||
# PostgreSQL
|
||||
docker compose --profile postgres up -d postgres
|
||||
DATABASE_URL=postgres://rustpad:rustpad@postgres:5432/rustpad docker compose up -d rustpad
|
||||
|
||||
# MySQL
|
||||
docker compose --profile mysql up -d mysql
|
||||
DATABASE_URL=mysql://rustpad:rustpad@mysql:3306/rustpad docker compose up -d rustpad
|
||||
```
|
||||
|
||||
Migracje są rozdzielone w `migrations/sqlite`, `migrations/postgres` i `migrations/mysql`. Zapytania aplikacji znajdują się centralnie w `src/queries.rs`, a `src/database.rs` odpowiada za wybór sterownika i konfigurację połączenia.
|
||||
|
||||
Reference in New Issue
Block a user