mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
38 lines
2.0 KiB
Markdown
38 lines
2.0 KiB
Markdown
# TODO
|
|
|
|
## SQLite Backup & Data Integrity (docs/backup-plan.md)
|
|
|
|
### Phase 1 — WAL Mode
|
|
- [x] WAL mode already active (`PRAGMA journal_mode` → `wal`) — set in Database constructor
|
|
- [ ] Verify `-wal` and `-shm` sidecar files exist after writes
|
|
- [ ] Verify nginx/PHP write access to sidecar files on server
|
|
|
|
### Phase 2 — Audit Log
|
|
- [x] `admin_audit_log` table already exists (migration 009), `AdminLogger` already writes to it
|
|
- [x] Create the `audit_log` table for data-level audit (before/after row snapshots)
|
|
- [x] Create `Audit.php` helper class
|
|
- [x] Instrument all DELETE, UPDATE, INSERT operations on core tables (theses, tags, languages, thesis_files)
|
|
- [ ] Verify by triggering a test delete and querying `SELECT * FROM audit_log ORDER BY id DESC LIMIT 5`
|
|
|
|
### Phase 3 — Soft Deletes
|
|
- [x] Add `deleted_at` columns to `languages`, `tags`, `theses`
|
|
- [x] Rebuild views `v_theses_full` and `v_theses_public` with `deleted_at IS NULL` filters
|
|
- [x] Update `schema.sql` for fresh installs
|
|
- [x] Replace all hard DELETEs with soft deletes (`DELETE` → `UPDATE ... SET deleted_at = ...`)
|
|
- [x] Add `deleted_at IS NULL` to all SELECT queries touching these tables
|
|
- [x] Add admin "Corbeille" view for soft-deleted theses with Restore and Hard Delete actions
|
|
- [ ] Test each htmx-driven element (language search, tag search, repertoire filters) to confirm deleted entries don't appear
|
|
- [ ] Admin: add soft-deleted tags/languages view with restore option
|
|
|
|
### Phase 4 — Hourly Snapshots via Cronjob
|
|
- [x] Create `scripts/backup-sqlite.sh` (hot backup via `sqlite3 .backup`, gzip, retention pruning)
|
|
- [x] Test locally — backup created, restores correctly
|
|
- [x] Add `just backup-snapshot` command for local ad-hoc backups
|
|
- [ ] Deploy backup script to server (`/usr/local/bin/backup-sqlite.sh`)
|
|
- [ ] Create `/var/backups/xamxam/` directory on server
|
|
- [ ] Add cron jobs (hourly 30d + daily 90d)
|
|
- [ ] Test restore from production backup
|
|
|
|
### Phase 5 — Remote Sync *(for later)*
|
|
- [ ] (Deferred)
|