meteor-roles icon indicating copy to clipboard operation
meteor-roles copied to clipboard

Migration Script should delete old roles

Open leprekon91 opened this issue 6 years ago • 4 comments

The migration scripts do not delete the old roles in the Roles collection:

{ "_id" : "admin", "children" : [ ] } //new role is created
{ "_id" : "u9jJZoAfaEApp6QBw", "name" : "admin" } // old role is still here

Shouldn't the old roles go the way of the dodo?

leprekon91 avatar Nov 28 '19 11:11 leprekon91

This is when updating from v1 to v2?

SimonSimCity avatar Nov 28 '19 11:11 SimonSimCity

After running those (one after the other):

Roles._forwardMigrate();
Roles._forwardMigrate2();

so v1 -> v2 and then immediatly v2 -> v3.

leprekon91 avatar Nov 28 '19 11:11 leprekon91

Thanks. As far as I've taken a look at it, this is when updating the database from v1 to v2 ... I've just started using this library in v2 and was quite surprised this could happen 😅

Please let me know if you'll have time to look into the first update script and create a PR - I'm on holiday for about a week but can have a look at it afterwards as my other spare-time activities allow.

SimonSimCity avatar Nov 28 '19 12:11 SimonSimCity

I've looked a bit into the update-script for another issue on this project and I do not see a reason to leave the old roles around. Still - I want to test it back and forth before removing them in the update-script. Everyone else is welcome to kick them out and provide some feedback here.

Specially helpful would it be if someone on a bigger codebase could share his experience on a forward and backward migration on 1.x to 2.x.

SimonSimCity avatar Dec 16 '19 16:12 SimonSimCity