Add DB constaints and missing dependencies

Now when a role is removed, all its filters and their filterings are
removed as well. Same applies to permission removing. We also have
foreign keys that enforces valid filters and filterings.