The previous SAVEPOINT approach failed because Go's tx.Exec() stops at
the first error and never reaches the ROLLBACK TO statements. This caused
every subsequent startup to re-run migration 0002, fail on the first
ALTER (column already exists from a prior partial run), and crash.
Fix runMigration() to:
- Execute migrations without a wrapping transaction (DDL in SQLite is
auto-commit anyway)
- Treat "duplicate column name" / "already exists" errors as success
and record the migration anyway, covering cases where a previous
failed attempt already partially modified the schema
Also simplify 0002_nfs_structured.sql back to plain ALTER TABLE
statements (no SAVEPOINT needed with the new Go-level tolerance).
Bump VERSION 0.1.9 -> 0.1.10
- Add schema_migrations table to track applied migrations
- Migrate() now checks if a migration was already applied before running
- 0002 rewritten to use SAVEPOINT+ROLLBACK per column, making it safe
to run even if some columns were partially added previously
- Each migration runs in its own transaction; INSERT into schema_migrations
only happens if the SQL executes without error
- Bump VERSION 0.1.8 -> 0.1.9
SQLite does not support adding multiple columns in a single ALTER TABLE
statement. The previous migration tried to add 6 columns at once and
caused a syntax error, crashing the service at startup.
Bump VERSION 0.1.7 -> 0.1.8
- Bump VERSION 0.1.6 -> 0.1.7
- Change systemctl start -> try-restart in postinst script so that
upgrading the package actually restarts nasctl with the new binary
Backend:
- Add source/used_by/available/error fields to diskUsage in system status
- collectDiskUsage() now reads /proc/mounts, samba shares and NFS exports from DB
- Paths are deduplicated; shared paths list all shares/exports using them
- syscall.Statfs errors surface as available=false with user-facing error
- collectServiceStatus made a method of Server (receiver consistency)
Frontend:
- Settings page now shows two cards: mount points and shared resources
- Each path shows source badge (Sistema/Mount/SMB/NFS), used_by chips, progress bar
- Unavailable paths show amber warning instead of progress bar
- DiskUsage interface updated with new fields
- NFSExport interface updated with structured fields (fsid, async, etc)
- NFS page updated to use new export fields
Adds auto-detection of pre-existing Samba shares and NFS exports when
nasctl is installed on a host that already has these configs.
New package internal/importer parses smb.conf (INI-style) and
/etc/exports (line-based) and imports them into SQLite.
Imported shares/exports are marked dirty so the user must review
and apply manually before any file is overwritten.
Backup: before the first Apply, each module backs up the original
config to <path>.nasctl.bak.<timestamp> (one time only).
New CLI flag --import-on-boot / NASCTL_IMPORT_ON_BOOT env var
(default false, opt-in).
New API endpoints:
GET /api/import/status
POST /api/import/samba
POST /api/import/nfs
New DB methods ReplaceSambaShares/ReplaceNFSExports (transactional
replace-all), guarded by import.samba.done / import.nfs.done
settings flags.