Skip to content

Conversation

Drenmi
Copy link
Contributor

@Drenmi Drenmi commented Aug 12, 2025

What is the problem?

In #33558 we removed automatic_backups_enabled setting, and instead rely on backup_frequency being blank to disable.

There was a big oversight there with the site setting type system, which will coerce the value to an integer. It also makes it so you can't blank the value out in the UI.

How does this fix it?

This is a "fix forward" solution where instead of "set to blank to disable" we do "set to 0 to disable". This works along the grain of the site setting type system for a workable fix where we don't have to deal with the irreversible migration in the previous change.

We can potentially go and add in "nullable" to the type system at a later point.

@github-actions github-actions bot added i18n PRs which update English locale files or i18n related code migrations-tooling PR which includes changes to migrations tooling labels Aug 12, 2025
@@ -8,7 +8,7 @@ class ScheduleBackup < ::Jobs::Scheduled
def execute(args)
delete_prior_to_n_days
return if !SiteSetting.enable_backups?
return if SiteSetting.backup_frequency.blank?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a problem, because if it is NULL in the database, the type system will coerce to 0 and it won't be blank?.

Co-authored-by: Martin Brennan <martin@discourse.org>
@Drenmi Drenmi merged commit 71ea236 into main Aug 12, 2025
13 of 15 checks passed
@Drenmi Drenmi deleted the fix/backup-frequency-disabling branch August 12, 2025 05:19
yuriyaran pushed a commit that referenced this pull request Aug 21, 2025
…34245)

In #33558 we removed automatic_backups_enabled setting, and instead rely on backup_frequency being blank to disable.

There was a big oversight there with the site setting type system, which will coerce the value to an integer. It also makes it so you can't blank the value out in the UI.

This is a "fix forward" solution where instead of "set to blank to disable" we do "set to 0 to disable". This works along the grain of the site setting type system for a workable fix where we don't have to deal with the irreversible migration in the previous change.

We can potentially go and add in "nullable" to the type system at a later point.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n PRs which update English locale files or i18n related code migrations-tooling PR which includes changes to migrations tooling
Development

Successfully merging this pull request may close these issues.

2 participants