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

Uplift pni tristate fields #3762

Merged
merged 13 commits into from
Oct 11, 2019
Merged

Uplift pni tristate fields #3762

merged 13 commits into from
Oct 11, 2019

Conversation

Pomax
Copy link
Contributor

@Pomax Pomax commented Oct 9, 2019

Builds on #3757 and uplifts all NullBoolean fields to Boolean(null=True) (new recommended way to do things), save the four fields that needed to become the new ExtendedYesNoField (Yes/No/Unknown/Not applicable).

New code for this PR only: a8f3ba1 + 7510170

Related issues: #3729

One thing that we probably want to make sure works is running this on top of staging data, locally. This runs "from scratch" (using inv docker-new-env) but the more important question is whether these migrations won't break when presented with staging's data and schema

@Pomax Pomax added this to the Oct 21 milestone Oct 9, 2019
@Pomax Pomax requested a review from mmmavis October 9, 2019 23:05
@patjouk patjouk temporarily deployed to foundation-mofostaging-pr-3762 October 9, 2019 23:05 Inactive
@Pomax Pomax changed the base branch from master to 2019-pni-updates October 9, 2019 23:06
@Pomax Pomax requested a review from cadecairos October 9, 2019 23:06
@Pomax
Copy link
Contributor Author

Pomax commented Oct 9, 2019

@cadecairos I've added you for review mostly because I'm also touching some of the factory stuff, so making sure that all looks fine will help out a lot!

@Pomax Pomax requested a deployment to foundation-mofostaging-pr-3762 October 10, 2019 00:05 Abandoned
@patjouk patjouk temporarily deployed to foundation-mofostaging-pr-3762 October 10, 2019 00:08 Inactive
@kristinashu
Copy link

Awesome! I've check-off what has been done in the spreadsheet.

Copy link

@cadecairos cadecairos left a comment

Choose a reason for hiding this comment

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

no issues with the changes. Copied staging locally and applied the migrations without any issue, and the pni page looks fine afterwards. Let's try this on staging!

@Pomax
Copy link
Contributor Author

Pomax commented Oct 11, 2019

\o/

@Pomax Pomax temporarily deployed to foundation-mofostaging-pr-3762 October 11, 2019 18:46 Inactive
@@ -0,0 +1,83 @@
# Generated by Django 2.2.5 on 2019-10-09 20:34
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these are all NullBoolean to Boolean(null=True) updates

@Pomax Pomax temporarily deployed to foundation-mofostaging-pr-3762 October 11, 2019 18:49 Inactive
@Pomax Pomax temporarily deployed to foundation-mofostaging-pr-3762 October 11, 2019 18:49 Inactive
@Pomax Pomax requested a deployment to foundation-mofostaging-pr-3762 October 11, 2019 18:52 Abandoned
@patjouk patjouk temporarily deployed to foundation-mofostaging-pr-3762 October 11, 2019 18:53 Inactive
@@ -1,13 +1,24 @@
# Generated by Django 2.2.5 on 2019-10-09 00:10

from django.db import migrations, models
from networkapi.buyersguide.models import Product
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this change makes sure we use a Product based on the database schema, not what's in models.py (since models.py can change in the future, and then this migration would crash...)

('buyersguide', '0027_null_boolean_field'),
]

operations = [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

so this is a four stage uplife:

  1. build new fields, with unique names, that use the new 4-state field type
  2. migrate the 3-state data from the old fields as 4-state data to the new fields
  3. delete the old fields
  4. rename the new fields so they use the names of the old fields

This means that at the end of this migrations, nothing has really changed except the fields types got changed from NullBoolean to ExtendedYesNo, and some of the fields got renamed as per the spreadsheet

Copy link
Collaborator

@mmmavis mmmavis left a comment

Choose a reason for hiding this comment

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

Code makes sense to me and works well locally. 👍

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

5 participants