Missing FK Constraint bug during addColumn?

I tried to add a couple of new columns with one column as a foreign key to another table and it didn�t create the FK constraint.  Am I doing something wrong or is this a bug?

Rick Cromer

Here�s the XML for the change set.

     
       
           
               
           
           
               
           
       
     

When I run updateSQL or update the creation of the foreign key is not made.  Here�s the updateSQL output below:

– Ran at: 5/22/09 10:50 AM
– Against: POST3@jdbc:oracle:thin:@loghost:1521:ENTICE
– LiquiBase version: 1.9.1
– *********************************************************************
SELECT COUNT(*) FROM DATABASECHANGELOGLOCK WHERE ID=1;

– Changeset post3Schema.xml::182::cruml::(MD5Sum: fedff0f6941fcc8c1866949687d3fb43)

– Add new columns to the DID_LOT table

ALTER TABLE DID_LOT ADD VENDOR_ID NUMBER(10);

ALTER TABLE DID_LOT ADD LOAD_DATE DATE DEFAULT SYSDATE NOT NULL;

INSERT INTO DATABASECHANGELOG (DATEEXECUTED, AUTHOR, LIQUIBASE, DESCRIPTION, COMMENTS, MD5SUM, ID, FILENAME) VALUES (SYSDATE, ‘cruml’, ‘1.9.1’, ‘Add Column’, ‘Add new columns to the DID_LOT table’, ‘fedff0f6941fcc8c1866949687d3fb43’, ‘182’, ‘post3Schema.xml’);

– Release Database Lock

UPDATE DATABASECHANGELOGLOCK SET LOCKEDBY = NULL, LOCKGRANTED = NULL, LOCKED = 0 WHERE  ID = 1;

I would guess that the addColumn parser is not looking for the foreign key attribute like it should.  For now, the best workaround would be to add the column, then use the addForeignKey tag.

Nathan

Should I submit a bug on this or have you already done that?

I don’t think I did.  If you could add it, that would be great.

Thanks,
Nathan

Added as bug CORE-384.

Nathan, I attached a fix for this bug based on the 1.9.3 source files.  Hope this helps.

Rick Cromer

Great, thanks a lot!  I will get it applied.

As a side note, the repository does have write access to anyone with a log in, so you could apply it directly rather than submitting patches if you find that easier.

Either way is perfectly fine with me.

Nathan