-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Datamigration for new Fulfillment type feature #6544
Conversation
Signed-off-by: Sujith <mail.sujithvn@gmail.com>
Signed-off-by: Sujith <mail.sujithvn@gmail.com>
Signed-off-by: Sujith <mail.sujithvn@gmail.com>
|
Signed-off-by: Sujith <mail.sujithvn@gmail.com>
Signed-off-by: Sujith <mail.sujithvn@gmail.com>
Signed-off-by: Sujith <mail.sujithvn@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few changes needed here
async function up({ db, progress }) { | ||
progress(0); | ||
|
||
await db.collection("Groups").updateMany({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just adds them to shop manager and owner which is fine if they used the Out of the Box permissions and made no changes, but what it actually should do is add it to any group that has the old equivalent permissions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we say "any group that has the old equivalent permissions", does it mean any group which would have the same entries in the array as of shop-manager and owner?
If the user has made a minor add/remove of any entry, then how do we decide whether that groups has to be considered or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zenweasel
As discussed, I have made the code change to update 'any' group that has the permissions.
As per the change, we are checking each group for any of the old permissions (related to shipping) and inserting the corresponding individual FFT permissions (using a mapper) in all of the impacted groups.
Signed-off-by: Sujith <mail.sujithvn@gmail.com>
This PR is replaced by 6633 |
Resolves #6472
Impact: breaking
Type: feature
This PR is replaced by #6633
Issue
Migrate data to the new format required for the new FFT plugins
Solution
We have 3 stages in a single migration;
Shipments
&FlatRateFulfillmentRestrictions
collections toFulfillment
&FulfillmentRestrictions
collections respectivelyFulfillment
collection with the newly introduced fields (fulfillmentType
&fulfillmentMethod
). Since the existing user base had only Shipping/Flatrate as the fulfillment type/method till date, we would be using those values to update collectionGroups
collection with the new permissionsBreaking changes
The 2nd stage above handles the breaking change where we would be using the possible existing values as the values or newly introduced fields.
Testing
In an existing installation, perform the data-migration. Update the installation to use the new version having fulfillment types. All activities in admin/shop (related to Products/Orders/FF-types/Catalogs/Carts) should continue to work without issues
To test migration steps, install api-migrations package and include the below entry in the
migrator.config.js
file.Run the command:
MONGO_URL=mongodb://localhost:27017/reaction npx migrator migrate