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

fix: Add missing Shops.layout migration #4609

Merged
merged 2 commits into from
Sep 7, 2018

Conversation

aldeed
Copy link
Contributor

@aldeed aldeed commented Sep 7, 2018

Resolves #4608 (hopefully also #4585)
Impact: minor
Type: bugfix

Issue

Migration 33 was added in v1.15.0 to change the "products" template name to "Products". It neglected to do this in the Shops collection, which also has layouts stored there. Depending on whether you are upgrading, whether your Packages collection is regenerated on startup, and what version your database is already on, this sometimes leads to the app starting as just a white screen with no errors in the console.

This is actually pretty likely to happen in an upgrade situation.

Solution

Adds another migration, covering what the first migration missed.

Other changes

I also made a couple minor fixes to migration 13. This was something I encountered while debugging. If any carts or orders do not have a shipping field set, then setting shipping.0.shopId in the migration actually creates a shipping object rather than an array. This is a known quirk of MongoDB. So I added a filter to run the migration only for documents that already have an array there.

Since this has only caused problems in a weird artificial situation I created, I opted to only fix the existing migration rather than write a new one.

Breaking changes

None

Testing

This is easiest to test if you already have a database that's causing this issue. Otherwise, you can fake it by manually creating the problem in your database and then verify the migration fixes it:

  1. In your primary shop, look at the layout array and find the item with workflow = "coreWorkflow". Change structure.template of that item to "products" (lowercase first letter).
  2. When you start the Meteor app (on release-1.16.0 branch, without this fix), it should now be a blank screen.
  3. Stop the app, check out this branch, start the app and verify that migration 38 runs. If you now refresh the browser, the app should appear normally.

@aldeed aldeed self-assigned this Sep 7, 2018
@zenweasel
Copy link
Collaborator

Tested via:

  1. Start app on v1.14.0
  2. Move to master and start app
  3. Observe blank screen
  4. Move to this branch
  5. Observe that page renders normally
    👍 🎉

Copy link
Collaborator

@zenweasel zenweasel left a comment

Choose a reason for hiding this comment

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

Tested. Verified fixed.

@aldeed aldeed merged commit 6545874 into release-1.16.0 Sep 7, 2018
@aldeed aldeed deleted the fix-4608-aldeed-shop-template-name-migration branch September 7, 2018 10:54
@spencern spencern mentioned this pull request Sep 7, 2018
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

2 participants