Fix: migrations being generated when settings are altered #37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Versions:
There are two settings changes which can generate new migrations inside the installed durin files currently.
The first one is when you change the
DEFAULT_AUTO_FIELD
setting in django to something other thanmodels.BigAutoField
, it can be detected by django as a change in the durin provided models, which can lead to migrations being generated for durin models.This happens since durin does not explicitly provide an
AppConfig
class with thedefault_auto_field
property set. See this SO question for another explanation of the problem.The second is when you change one of the values which is directly referenced in one of the fields
default
argument (Client.token_ttl
field withDEFAULT_TOKEN_TTL
). If you change the value of these settings, it's interpreted as a change in the value of the argument, and it generates a migration.This one can be fixed by changing the arg to reference a function which reads the setting at run time.
Example migration generated inside the durin
migrations
directory when you change some of this settings:settings.py
: