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

Update fax to is_fax boolean label #3212

Closed
wants to merge 2 commits into from
Closed

Conversation

anselmbradford
Copy link
Member

@anselmbradford anselmbradford commented Aug 4, 2017

Changes

  • Changes fax boolean label to is_fax, per TODO comment.

Testing

  1. Run python cfgov/manage.py migrate.
  2. Create a browse page in Wagtail.
  3. Add a expandable.
  4. Add a Phone block to the expandable.
  5. Check that the Is this number a fax? checkbox works.

Screenshots

screen shot 2017-08-04 at 4 38 02 pm

Notes

Copy link
Member

@chosak chosak left a comment

Choose a reason for hiding this comment

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

Won't this break existing pages that have a value for fax stored in their database JSON value? There needs to be some kind of data migration to rename a block like this.

@Scotchester
Copy link
Contributor

@chosak The standard migration doesn't handle this? I'm confused.

@chosak
Copy link
Member

chosak commented Aug 7, 2017

@Scotchester no, because you're not renaming a Django model field, you're renaming a block in a Wagtail StreamField. Recall that StreamField content is stored as JSON in the database, e.g. there's a database column named for the field name (like content) that contains a JSON representation of all of the blocks.

Changing the field name would result in a Django migration that changed the DB column name. But just changing the block name doesn't trigger any kind of automatic migration of the DB content that already exists. The links @anselmbradford posted above are some examples of manual migrations we've done in the past to address this. See also this Wagtail issue on the subject.

@Scotchester
Copy link
Contributor

Ahhh, that makes sense, now. Thanks for the explanation, @chosak.

@willbarton
Copy link
Member

willbarton commented Aug 8, 2017

There's a section of the documentation on migrating stream fields: https://cfpb.github.io/consumerfinance.gov/migrations/

@Scotchester
Copy link
Contributor

@anselmbradford In light of the need to write a data migration for this, is it worth doing anymore?

@anselmbradford
Copy link
Member Author

I'm rotating to maintenance & response after next sprint, so thinking I'll re-visit this then. If it gets swamped by other priorities I'll close it.

@anselmbradford
Copy link
Member Author

😭

@Scotchester
Copy link
Contributor

Did you determine it's not worth the effort to write the migration?

@anselmbradford
Copy link
Member Author

anselmbradford commented Mar 15, 2018

Did you determine it's not worth the effort to write the migration?

Not so much, I was just keeping my word from my Dec 15 comment. #3213 seems actually bug-like and the semantics here could be incorporated into that, hopefully.

@Scotchester
Copy link
Contributor

I guess I just don't see the point of closing it if it's something that we still think is worth doing. But I take your point that it could be rolled into #3213.

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.

4 participants