Files
baby-nas/internal/db/migrations/0008_storage.sql
T
darroyo 27a52d2986 feat: add mergerfs mover and snapraid integration
New 'Almacenamiento' page with:
- Auto-detection of rsync, mergerfs, snapraid binaries and mergerfs mount
- Configurable pool settings (source/dest, macOS cleanup, rsync flags)
- Mergerfs mover with dry-run preview and live SSE output streaming
- SnapRAID diff/sync/scrub/check with live SSE output
- Async job system (1 concurrent job) with SSE streaming
- Job history table

Backend:
- internal/storage/ package with capabilities, mergerfs, snapraid, jobs
- storage_config and storage_jobs DB tables (migration 0008)
- GET/PUT /api/storage/config, GET /api/storage/capabilities
- POST/GET /api/storage/jobs, GET /api/storage/jobs/{id}/stream
- Storage operations disabled when NASCTL_EXEC_SYSTEM=false

Closes #new-feature
2026-07-06 23:23:22 -04:00

32 lines
1.3 KiB
SQL

CREATE TABLE IF NOT EXISTS storage_config (
id INTEGER PRIMARY KEY CHECK (id = 1),
mover_source TEXT NOT NULL DEFAULT '',
mover_dest TEXT NOT NULL DEFAULT '',
mover_clean_macos INTEGER NOT NULL DEFAULT 1,
mover_remove_source INTEGER NOT NULL DEFAULT 1,
mover_inplace INTEGER NOT NULL DEFAULT 1,
mover_rsync_options TEXT NOT NULL DEFAULT '',
snapraid_content TEXT NOT NULL DEFAULT '',
snapraid_data_dirs TEXT NOT NULL DEFAULT '',
snapraid_parity_dir TEXT NOT NULL DEFAULT '',
snapraid_scrub_plan INTEGER NOT NULL DEFAULT 8,
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
);
CREATE TABLE IF NOT EXISTS storage_jobs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
kind TEXT NOT NULL,
status TEXT NOT NULL DEFAULT 'queued',
args_json TEXT NOT NULL DEFAULT '{}',
pid INTEGER NOT NULL DEFAULT 0,
started_at TEXT,
finished_at TEXT,
exit_code INTEGER NOT NULL DEFAULT -1,
output TEXT NOT NULL DEFAULT '',
error TEXT NOT NULL DEFAULT '',
created_at TEXT NOT NULL DEFAULT (datetime('now'))
);
CREATE INDEX IF NOT EXISTS idx_storage_jobs_created ON storage_jobs(created_at DESC);
CREATE INDEX IF NOT EXISTS idx_storage_jobs_kind_created ON storage_jobs(kind, created_at DESC);