modification that prevents the error (UserRole matching query does not exist) on a database that already contains users with no permissions assigned