Add Primary Key - extension tag

Hi,

I have been creating some extension for Oracle DB, most of all new specialised tags (not defined in LiquideBase, for example CREATE TRIGGER and DROP TRIGGER for Oracle). Everything work fine until I added tag ADD PRIMARY KEY which is defined in LiquideBase (I wanted to extend this tag by adding attributes: DEFERRABLE and INITIALLYDEFERRED).

What’s my problem?

    http://www.liquibase.org/xml/ns/dbchangelog"        xmlns:ora="http://www.liquibase.org/xml/ns/dbchangelog-ext"        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog ../../../../../java/liquibase/ext/ora/xml/dbchangelog-2.0.xsd        http://www.liquibase.org/xml/ns/dbchangelog-ext ../../../../../java/liquibase/ext/ora/xml/dbchangelog-ext.xsd">

     
         
         

         
           
     

In this case  ADD PRIMARY KEY should be created by rules from LiquiBase, but classes from extension are used (package liquibase.ext.ora.addprimarykey;)

I suppose that it doesn’t work because classes names in LiquiBase and my extension are same (but package is different!). Because of that, classes from extensin override classes from LiquiBase and tag  is maintained by extension classes.

Is there any way I should follow? Do I have to rename my tag and classes names?

dalt

There is a “priority” parameter that gets passed to the AbstractChange superclass if you are extending that class.  If there are multiple classes that use the same tag name, liquibase picks the one with the highest priority.  The built-in liquibase priorities should all be 1, so if you pass in a higher value it should use your class for all addPrimaryKey tags.

Nathan

Thanks, it doesn’t solve my problem, but it changes my point of view.

dalt

I’ll take a look at the code and try to figure out why your extension isn’t running. 

It did get me thinking about how the extension framework should work in general, and posted a question on how to best handle overlapping change tag implementations: http://liquibase.org/forum/index.php?topic=104.0

Nathan