I’ve been using liquibase for a while now and often came across with the need to add/delete/update a single procedure/function part of an Oracle package.
The usual way we do it is to put the whole CREATE OR REPLACE PACKAGE/PACKAGE BODY into a separate file and run it as a separate liquibase change.
When there are a lot of precedures/functions included in that package not only that you end up with a big file to run but also it is a concern with the testing as in theory unintentional changes can slip inside that package.
You can argue that code review processes / unit tests should pick this up soon enough as they happen. However we all know that some may be support/maintenance packages that are not normally exercised by automatic builds.
I am aware that the only way to add/remove/update a function in an Oracle package is by using CREATE OR UPDATE PACKAGE/PACKAGE BODY.
However I was wondering whether there is something like providing only the procedure/function to ADD/UPDATE/DELETE in liquibase and liquibase will generate and run the CREATE OR UPDATE PACKAGE for us based on the current package definition taking from the database metadata.
Say using something like below:
SELECT dbms_metadata.get_ddl('PACKAGE_BODY', ‘MY_PACKAGE’, 'SOME OWNER’) from dual INTO some_var
Then doing the right string manipulation and running it.
If this functionality is not supported yet I think it can be easily implemented as an oracle liquibase extension.
The reason I am suggesting an oracle liquibase extensionis because I am not sure how other database vendors deal with this sorts of updates.
I am just a liquibase user and never dag in liquibase internals but if this not supported yet and is considered needed, I have quite a bit of experience with java programming and I will volunteer to add support for it if considered useful. I just need some directions about the overall liquibase design to put the right code in the right place.
What the other liquibase users think.
Regards,
Julian