Meteor-Community-Packages / meteor-roles

Authorization package for Meteor, compatible with built-in accounts packages
http://meteor-community-packages.github.io/meteor-roles/
MIT License
920 stars 167 forks source link

How to run migration script from V1 -> V3 #352

Open jdipallo opened 1 year ago

jdipallo commented 1 year ago

Hello:

We have upgraded an old Meteor JS project (1.3.2.4) to current. This project was using V1 of alaning roles.

Question 1) How can we upgrade from V1 -> V3 2) The documentation to migrate from V1 -> V2 and V2 -> V3 specifies the meteor shell. We don't have Meteor installed in Production therefore no Meteor shell.

As we are barely using Roles, (very simply there are admin's and that's about it), I've examined the roles collection and role-assignment join collection. In my local dev env, I have simply dropped the roles collection, recreated it like the alaning docs specify and then created the role-assignment collection pointing to the userID and corresponding role. This seems to have setup things where everything works. am I missing anything else or any other ideas to assist is running this migration script? And, where can i see the code for this migration script?

Thank you kindly

leonardoventurini commented 1 year ago

In the past all I have done was run these methods listed here, one after the other in a migration not the shell:

https://github.com/Meteor-Community-Packages/meteor-roles#roles-migration

Roles._forwardMigrate2()
Roles._forwardMigrate3()

They should be available globally I think.

You can use a database migration tool like this one:

https://packosphere.com/percolate/migrations/0.8.6

Hope it helps.

StorytellerCZ commented 1 year ago

@jdipallo did @leonardoventurini solution work for you?

jdipallo commented 1 year ago

@StorytellerCZ Hello. No, that solution didn’t work for me. Simply manually modifying as I described seems to work thus far. thanks