Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DB2 integration tests DAT-13113 #4293

Merged
merged 12 commits into from
Oct 20, 2023
filipelautert marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,18 @@
<loadData tableName="csvdata" file="changelogs/sample.data1.csv.gz"/>
</changeSet>

<changeSet id="createTableNamedPKRef" author="nvoxland">
<changeSet id="createTableNamedPKRef" author="nvoxland" dbms="db2">
<createTable tableName="createtablenamedpkref">
<column name="id" type="int">
<constraints primaryKey="true"/>
</column>
<column name="referee" type="int">
<constraints foreignKeyName="FK_REFTEST" references="CREATETABLENAMEDPK(id)"/>
</column>
</createTable>
</changeSet>

<changeSet id="createTableNamedPKRef" author="nvoxland" dbms="!db2">
<createTable tableName="createtablenamedpkref">
<column name="id" type="int">
<constraints primaryKey="true"/>
Expand Down Expand Up @@ -620,7 +631,13 @@
</preConditions>
</changeSet>

<changeSet id="fkExistsPrecondition" author="nvoxland">
<changeSet id="fkExistsPrecondition" author="nvoxland" dbms="db2">
<preConditions>
<foreignKeyConstraintExists foreignKeyTableName="CREATETABLENAMEDPKREF" foreignKeyName="FK_REFTEST"/>
</preConditions>
</changeSet>

<changeSet id="fkExistsPrecondition" author="nvoxland" dbms="!db2">
<preConditions>
<foreignKeyConstraintExists foreignKeyTableName="createtablenamedpkref" foreignKeyName="fk_reftest"/>
</preConditions>
Expand Down Expand Up @@ -701,7 +718,13 @@
</addColumn>
</changeSet>

<changeSet id="addColWithFK-checkConstraint" author="nvoxland">
<changeSet id="addColWithFK-checkConstraint" author="nvoxland" dbms="db2">
<preConditions onFailMessage="I couldn't find the FK set in addColWithFK">
<foreignKeyConstraintExists foreignKeyName="FK_TEST_FK_ADDCOL" foreignKeyTableName="COMMATEST"/>
</preConditions>
</changeSet>

<changeSet id="addColWithFK-checkConstraint" author="nvoxland" dbms="!db2">
<preConditions onFailMessage="I couldn't find the FK set in addColWithFK">
<foreignKeyConstraintExists foreignKeyName="fk_test_fk_addCol" foreignKeyTableName="commatest"/>
</preConditions>
Expand Down Expand Up @@ -1124,10 +1147,10 @@
<output target="stderr">Message using stderr target</output>
</changeSet>

<changeSet id="fkexists-without-table-setup" author="example">
<changeSet id="fkexists-without-table-setup" author="example" dbms="db2">
<sql>
CREATE TABLE fkexists_table1 (
id INT PRIMARY KEY
id INT PRIMARY KEY NOT NULL
)
</sql>
<sql>
Expand All @@ -1148,7 +1171,44 @@
</sql>
</rollback>
</changeSet>
<changeSet author="example" id="fkexists-without-table-check">
<changeSet id="fkexists-without-table-setup" author="example" dbms="!db2">
<sql>
CREATE TABLE fkexists_table1 (
id INT PRIMARY KEY
)
</sql>
<sql>
CREATE TABLE fkexists_table2 (
id INT,
id2 INT,
CONSTRAINT fkexists_1
FOREIGN KEY (id)
REFERENCES fkexists_table1 (id)
)
</sql>
<rollback>
<sql>
DROP TABLE fkexists_table1
</sql>
<sql>
DROP TABLE fkexists_table2
</sql>
</rollback>
</changeSet>

<changeSet author="example" id="fkexists-without-table-check" dbms="db2">
<preConditions>
<foreignKeyConstraintExists foreignKeyName="FKEXISTS_1"/>
<not>
<foreignKeyConstraintExists foreignKeyName="FKEXISTS_2"/>
</not>
</preConditions>
<addForeignKeyConstraint baseColumnNames="id2" baseTableName="fkexists_table2"
constraintName="fkexists_2"
referencedColumnNames="id" referencedTableName="fkexists_table1"/>
</changeSet>

<changeSet author="example" id="fkexists-without-table-check" dbms="!db2">
<preConditions>
<foreignKeyConstraintExists foreignKeyName="fkexists_1"/>
<not>
Expand All @@ -1159,14 +1219,22 @@
constraintName="fkexists_2"
referencedColumnNames="id" referencedTableName="fkexists_table1"/>
</changeSet>
<changeSet author="example" id="fkexists-without-table-check2">

<changeSet author="example" id="fkexists-without-table-check2" dbms="db2">
<preConditions>
<foreignKeyConstraintExists foreignKeyName="FKEXISTS_1"/>
<foreignKeyConstraintExists foreignKeyName="FKEXISTS_2"/>
</preConditions>
</changeSet>

<changeSet author="example" id="fkexists-without-table-check2" dbms="!db2">
<preConditions>
<foreignKeyConstraintExists foreignKeyName="fkexists_1"/>
<foreignKeyConstraintExists foreignKeyName="fkexists_2"/>
</preConditions>
</changeSet>

<changeSet id="example" author="view-if-exists" dbms="!oracle,!firebird">
<changeSet id="example" author="view-if-exists" dbms="!oracle,!firebird,!db2">
<dropView viewName="does_not_exist" ifExists="true"/>
</changeSet>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<changeSet id="2" author="nvoxland">
<addColumn tableName="magazine">
<column name="sku" type="varchar(50)" defaultValue="UNKNOWN">
<column name="sku" type="varchar(50)">
<constraints nullable="true"/>
</column>
</addColumn>
Expand Down