-
Notifications
You must be signed in to change notification settings - Fork 902
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
new release #516
new release #516
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some food for thought. View full project report here.
operations = [ | ||
migrations.RunPython(set_unique_api_keys), | ||
migrations.AlterField( | ||
model_name='org', | ||
name='api_key', | ||
field=models.TextField(default=common.models.generate_unique_key, editable=False, unique=True), | ||
), | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operations = [ | |
migrations.RunPython(set_unique_api_keys), | |
migrations.AlterField( | |
model_name='org', | |
name='api_key', | |
field=models.TextField(default=common.models.generate_unique_key, editable=False, unique=True), | |
), | |
] | |
operations = [ | |
migrations.RunPython(set_unique_api_keys, migrations.RunPython.noop), | |
migrations.AlterField( | |
model_name='org', | |
name='api_key', | |
field=models.TextField( | |
default=common.models.generate_unique_key, editable=False, unique=True | |
), | |
), | |
] |
] | ||
|
||
operations = [ | ||
migrations.RunPython(set_unique_api_keys), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless a reverse_code
function is provided then the migration cannot be ran backwards. Django will throw an error if you try. This complicates rolling back production to the previous version of the app.
Solve this by either explicit writing a function that undoes the fowards
mutations, or simply do migrations.RunPython(set_unique_api_keys, migrations.RunPython.noop)
. Explained here.
No description provided.