Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store integer settings as integer #19478

Merged
merged 1 commit into from
Oct 26, 2022

Conversation

zunda
Copy link
Contributor

@zunda zunda commented Oct 26, 2022

This change introduces INTEGER_KEYS for the settings with values to be stored as Integer.

Without typecasting the retention period settings to Integer, they are stored as String:

>  SELECT var,value FROM settings WHERE var LIKE '%retention_period';
              var               |  value
--------------------------------+----------
 media_cache_retention_period   | --- '14'+
                                |
 backups_retention_period       | --- '7' +
                                |
 content_cache_retention_period | --- ''  +
                                |
(3 rows)

This makes app/models/content_retention_policy.rb detect the settings as unset:

$ rails c
> Setting.media_cache_retention_period
=> "14"
> Setting.media_cache_retention_period.is_a?(Integer)
=> false
> ContentRetentionPolicy.current.media_cache_retention_period
=> nil

@Gargron Gargron merged commit 52ebfb7 into mastodon:main Oct 26, 2022
kadoshita pushed a commit to kadoshita/mastodon that referenced this pull request Nov 19, 2022
nametoolong pushed a commit to nametoolong/nuage that referenced this pull request Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants