fix(storage): persist mover_warning_threshold in DB read/write

This commit is contained in:
2026-07-07 00:51:59 -04:00
parent 197b2ad13e
commit 24425b8b39
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -23,6 +23,7 @@ func scanStorageConfig(row interface {
&c.SnapraidDataDirs,
&c.SnapraidParityDir,
&c.SnapraidScrubPlan,
&c.MoverWarningThreshold,
&createdAt,
); err != nil {
return StorageConfig{}, err
@@ -35,7 +36,7 @@ func scanStorageConfig(row interface {
}
func (d *DB) GetStorageConfig() (StorageConfig, error) {
row := d.conn.QueryRow(`SELECT id, mover_source, mover_dest, mover_clean_macos, mover_remove_source, mover_inplace, mover_rsync_options, snapraid_content, snapraid_data_dirs, snapraid_parity_dir, snapraid_scrub_plan, updated_at FROM storage_config WHERE id = 1`)
row := d.conn.QueryRow(`SELECT id, mover_source, mover_dest, mover_clean_macos, mover_remove_source, mover_inplace, mover_rsync_options, snapraid_content, snapraid_data_dirs, snapraid_parity_dir, snapraid_scrub_plan, mover_warning_threshold, updated_at FROM storage_config WHERE id = 1`)
c, err := scanStorageConfig(row)
if err == sql.ErrNoRows {
return StorageConfig{ID: 1, MoverCleanMacOS: true, MoverRemoveSource: true, MoverInplace: true, SnapraidScrubPlan: 8}, nil
@@ -51,11 +52,11 @@ func (d *DB) UpdateStorageConfig(c StorageConfig) error {
UPDATE storage_config
SET mover_source=?, mover_dest=?, mover_clean_macos=?, mover_remove_source=?, mover_inplace=?,
mover_rsync_options=?, snapraid_content=?, snapraid_data_dirs=?, snapraid_parity_dir=?,
snapraid_scrub_plan=?, updated_at=datetime('now')
snapraid_scrub_plan=?, mover_warning_threshold=?, updated_at=datetime('now')
WHERE id=1`,
c.MoverSource, c.MoverDest, toInt(c.MoverCleanMacOS), toInt(c.MoverRemoveSource), toInt(c.MoverInplace),
c.MoverRsyncOptions, c.SnapraidContent, c.SnapraidDataDirs, c.SnapraidParityDir,
c.SnapraidScrubPlan, c.ID,
c.SnapraidScrubPlan, c.MoverWarningThreshold, c.ID,
)
if err != nil {
return fmt.Errorf("update storage config: %w", err)