After deleting that one entry to fix the uniqueness issue i still have 3 entries for that moduleID
Remember we're talking about the dbo.ModulePermissions table and not the dbo.Modules table. (unless the dbo.Modules table doesn't hold want i think it does, and every time i had say HTML module, it gets a new ID - if so the below assumption isn't quite correct)
There's no reason a single module can't have multiple permissions even on the same portal (let alone different portals)
ex: module with edit permissons for role X and for user Y - that would be two permissions rows as far i understand it - one rwo permiting role X to edit and one row permiting user y (that for some reason isn't in role X) to edit. Then i could even add a 3rd permission allowing all users to view the module. - So there even in a single portal our module already has 3 permission lines.
With the new índex that should be ok - but in my case i had the module in, then for some reason it was deleted from the page (but still remained in the recycle bin) than was added again, and BAM - 2 entries with the same values and with the new índex a uniqueness issue.
in my case - 494, 1, 0, <null> - am assuming permissionsID 1 is view so for module 494 si had two entries allowing everyone to see module with ID 494 xecept one was in portal 0 and the other had <null> as portalID.