feat: add export and backup commands

- nib export: dump all entities to JSON (stdout or --output file)
- nib backup: atomic SQLite backup via VACUUM INTO (WAL-safe)
- Store.Backup() method on db layer
- Tests for both commands
This commit is contained in:
2026-05-20 20:54:44 -04:00
parent 33f6d99ba7
commit 2152baeb4f
4 changed files with 229 additions and 0 deletions
+5
View File
@@ -51,6 +51,11 @@ func (s *Store) Close() error {
return s.db.Close()
}
func (s *Store) Backup(dst string) error {
_, err := s.db.Exec("VACUUM INTO ?", dst)
return err
}
const currentSchema = 4
var migrations = []func(db *sql.DB) error{