This is weird. On DB2, when I diff a changelog to an empty database, then apply the resulting changelog from the diff, Liquibase gets confused which schema is being referred to.
I have 2 schemas that I’m trying to apply (TEST_SCHEMA & SIMPLE_SCHEMA) and I’m getting this exception where it’s using SIMPLE_SCHEMA for the referenced table of a Foreign Key instead of TEST_SCHEMA:
- liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE TEST_SCHEMA.NULL_WITH_DEFAULT_TBL ADD CONSTRAINT FK_0002 FOREIGN KEY (INTEGER_UNIQ) REFERENCES SIMPLE_SCHEMA.NOT_NULL_TBL(INTEGER_UNIQ) ON UPDATE NO ACTION ON DELETE NO ACTION
but if I just do a Diff and output to SQL I see this:
- ALTER TABLE TEST_SCHEMA.NULL_WITH_DEFAULT_TBL ADD CONSTRAINT FK_0002 FOREIGN KEY (INTEGER_UNIQ) REFERENCES TEST_SCHEMA.NOT_NULL_TBL(INTEGER_UNIQ) ON UPDATE NO ACTION ON DELETE NO ACTION;
and the XML looks right also:
although it’s missing: referencedTableSchemaName=“TEST_SCHEMA”