Reaction: Create migration files for upgrade from 1.0 to 1.5

Created on 25 Sep 2017  路  9Comments  路  Source: reactioncommerce/reaction

Extends / replaces #2604 with specifics.

The following are changes to be accounted for:

  • Primary Shop: Coming to Marketplace setting requires one shop to be labelled as primary. We need a migration to add a "shopType": "primary" to the main shop. (introduced in #2577)
  • Order billing: We need a migration to add shopId field to each billing object in Order.billing array. (introduced in #2682) (Also, confirm if needed on Cart too)
  • Order shipping: Similar to billing above. (Introduced in #2791)
  • Rebuild OrderSearch: OrderSearch collection needs to be rebuilt to match the changes in the Order Code (see existing similar migration, might just need to promote that exiting one).
  • Cart Product: Whole Product data is required on Carts (introduced in #2610). Hence, we need a migration to add that in for old orders.

All 9 comments

I got close to a WIP PR on this, but I'm currently resolving issue mentioned in "Added Units of Length" PR above (after merging with Marketplace)

Thanks for the update, let's get this knocked out today if possible :)

I'm about to open for review, a PR that address the 5 things listed on this ticket, but resolving these 5 revealed more 1.0-incompatible changes already in marketplace. Two new ones I just realized are around Order workflow and Refunds. I'll look into these and write up details for them description above, and continue with migration for them too.

For now, I'll write out "How To Test" section on the PR #2962, so anyone can jump in to start testing.

I get this error when going from 1.0 to 1.5 when I try to invite a shop owner.

20:30:29.721Z ERROR Reaction: Failed to shop/createShop
  Error: Units of length is required
      at getErrorObject (packages/aldeed_collection2-core.js:480:15)
      at [object Object].doValidate (packages/aldeed_collection2-core.js:462:13)
      at [object Object].Mongo.Collection.(anonymous function) (packages/aldeed_collection2-core.js:214:25)
      at [object Object].Mongo.Collection.(anonymous function) [as insert] (packages/dispatch_run-as-user.js:325:19)
      at [object Object].shopCreateShop (server/methods/core/shop.js:88:25)
      at packages/check.js:128:16
      at [object Object].EVp.withValue (packages/meteor.js:1134:15)
      at Object.exports.Match._failIfArgumentsAreNotAllChecked (packages/check.js:127:41)
      at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1765:18)
      at packages/ddp-server/livedata_server.js:1686:15
      at [object Object].EVp.withValue (packages/meteor.js:1134:15)
      at packages/ddp-server/livedata_server.js:1684:36
      at [object Object]._.extend.applyAsync (packages/ddp-server/livedata_server.js:1683:12)
      at [object Object]._.extend.apply (packages/ddp-server/livedata_server.js:1622:26)
      at [object Object]._.extend.call (packages/ddp-server/livedata_server.js:1604:17)
      at [object Object]._inviteShopOwner (server/methods/accounts/accounts.js:557:29)

I also get this error when trying to access "Localization and i18n" in the dashboard. Also seems related to migrating units of measure, as well as potentially not guarding against undefined vars.

TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined
    at composer (localizationSettings.js:121)
    at tracker.js:19
    at Tracker.Computation._compute (tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:339)
    at new Tracker.Computation (tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:229)
    at Object.Tracker.autorun (tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:613)
    at tracker.js:17
    at Object.Tracker.nonreactive (tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:640)
    at tracker.js:16
    at Container._subscribe (compose.js:85)
    at Container.componentWillMount (compose.js:27)
meteor.js?hash=6d285d84547b3dad9717a7c89c664b61b45ea3d8:942 Exception from Tracker recompute function:
meteor.js?hash=6d285d84547b3dad9717a7c89c664b61b45ea3d8:942 Invariant Violation: Attempted to update component `BlazeComponent` that has already been unmounted (or failed to mount).
    at invariant (http://localhost:3000/packages/modules.js?hash=d573608bcef03489bf3b4f2c8b08c63d337574d6:85878:15)
    at ReactCompositeComponentWrapper.updateComponent (http://localhost:3000/packages/modules.js?hash=d573608bcef03489bf3b4f2c8b08c63d337574d6:108479:63)
    at ReactCompositeComponentWrapper.receiveComponent (http://localhost:3000/packages/modules.js?hash=d573608bcef03489bf3b4f2c8b08c63d337574d6:108442:10)
    at Object.receiveComponent (http://localhost:3000/packages/modules.js?hash=d573608bcef03489bf3b4f2c8b08c63d337574d6:100993:22)
    at Object.updateChildren (http://localhost:3000/packages/modules.js?hash=d573608bcef03489bf3b4f2c8b08c63d337574d6:107705:25)
    at ReactDOMComponent._reconcilerUpdateChildren (http://localhost:3000/packages/modules.js?hash=d573608bcef03489bf3b4f2c8b08c63d337574d6:107239:32)
    at ReactDOMComponent._updateChildren (http://localhost:3000/packages/modules.js?hash=d573608bcef03489bf3b4f2c8b08c63d337574d6:107343:31)
    at ReactDOMComponent.updateChildren (http://localhost:3000/packages/modules.js?hash=d573608bcef03489bf3b4f2c8b08c63d337574d6:107330:12)
    at ReactDOMComponent._updateDOMChildren (http://localhost:3000/packages/modules.js?hash=d573608bcef03489bf3b4f2c8b08c63d337574d6:104707:12)
    at ReactDOMComponent.updateComponent (http://localhost:3000/packages/modules.js?hash=d573608bcef03489bf3b4f2c8b08c63d337574d6:104525:10)

One issue I'm seeing that could be resolved in the next ticket is that routes are different between 1.0 and 1.5.

I'm not really sure the best way to resolve this, as it will probably need some type of redirect, and it will be different depending on the shop, especially if any shops in the 1.0 -> 1.4.3 have I think what we need is some way to define redirects within the app. This really will only be an issue for SEO, as pathfor, etc have been updated internally, but that's a pretty huge issue for any live shop.
image

For anyone following this issue, we've merged #2962 which will server as "part 1 "of the migrations from 1.0 -> 1.5.

@impactmass will tag this issue when he creates the next PR to resolve the outstanding issues related to migrating an older shop.

Other issues reported above (apart from the redirect one) and a refunds error due to work done in #2022 should all be fixed in #3020 when merged

Resolved by #3020

Was this page helpful?
0 / 5 - 0 ratings