Hey guys! I’m moving all of our view and functions to files for better version control with git. I’m using sqlFile obviously.
However, I’m struggling with how to handle the granting of privileges. After some iterations, I decided to have the granting of privileges in a different file than the create/replace for each view/function. However, the problem is that some roles don’t exist in all environments, and when that happens, the whole changeSet appears to be rolledback.
For example, if I have the following…
REVOKE ALL ON FUNCTION some_function() FROM PUBLIC;
REVOKE ALL ON FUNCTION some_function() FROM schema_owner_role;
GRANT ALL ON FUNCTION some_function() TO schema_owner_role;
GRANT ALL ON FUNCTION some_function() TO another_good_role;
GRANT ALL ON FUNCTION some_function() TO role_that_does_not_exist;
GRANT ALL ON FUNCTION some_function() TO yet_another_good_role;
Even if I have failOnError=“false” and runInTransaction=“false”, the changeset does not appear as having been run in the databasechangelog table and when I look at the function, none of the grants appear to have worked. Is there any way to have liquibase ignore any errors and execute every sql statement through the end of a changeSet/sqlFile?
The alternative is to put every single statement in it’s own changeSet, each with failOnError=“false”, but then I’m going to have HUNDREDS, if not THOUSANDS of changeSets.
Any help/insight/suggestions would be greatly appreciated. Thanks!