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:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user