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

new release #516

Merged
merged 1 commit into from
Nov 2, 2023
Merged

new release #516

merged 1 commit into from
Nov 2, 2023

Conversation

ashwin31
Copy link
Member

@ashwin31 ashwin31 commented Nov 2, 2023

No description provided.

Copy link

@code-review-doctor code-review-doctor bot left a 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.

Comment on lines +23 to +30
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),
),
]

Choose a reason for hiding this comment

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

Suggested change
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),

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.

@ashwin31 ashwin31 merged commit 3c4d14c into master Nov 2, 2023
3 checks passed
@ashwin31 ashwin31 deleted the new_release branch November 2, 2023 15:57
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.

1 participant