Possible to get deprecated settings in database via config migrate_to_db when namespaces don't change
This is something I encountered while testing config to database migrations for !2964 (closed) and is not something you'll typically encounter in 'normal' operation, but it's possible. Basically I have settings under a namespace. The settings are deprecated, but remain under the same namespace.
Steps to reproduce (using the branch from the MR or whatever branch this has already been merged to)
- Add 'new' settings to the config file
- E.g.
config :pleroma, :mrf_simple, reject: [{"instance.tld", "Some reason"}]
- E.g.
mix pleroma.config migrate_to_db
- See that it worked => OK
- Add deprecated setting in config files
- E.g.
config :pleroma, :mrf_simple, reject: ["instance.tld"]
- E.g.
mix pleroma.config migrate_to_db
- It migrates the settings from the config file again even though it's old settings!! => NOK
The reason is probably because the DB already has non-deprecated setting. What I assume happens is
- You run
mix pleroma.config migrate_to_db
- It loads the config files, but since configurable_from_database is true, it overwrites the deprecated values with the non-deprecated values from the database
- It checks the config, but only sees the non-deprecated settings from the DB so considers it to be correct
- It migrates the (deprecated) settings from the file
Expected behaviour is that it only checks the settings from the file before migrating since this is what it migrates.