From f06355f3bbeabdcfafd87cfa801cacf879f55f0d Mon Sep 17 00:00:00 2001 From: rberezen Date: Tue, 17 Dec 2024 08:32:47 -0700 Subject: [PATCH] DAT-19145 Basic template to setup Informix (#933) * DAT-19145 Basic template to setup Informix --------- Co-authored-by: Tamelianovych Co-authored-by: PavloTytarchuk <55182440+PavloTytarchuk@users.noreply.github.com> Co-authored-by: Taras Amelianovych <97164517+Tamelianovych@users.noreply.github.com> --- .github/workflows/main.yml | 6 +- pom.xml | 5 + .../foundational/FoundationalTest.groovy | 2 + .../informix/addDefaultValueComputed.xml | 14 +++ .../informix/addDefaultValueDate.xml | 16 ++++ .../informix/addDefaultValueNumeric.xml | 16 ++++ .../changelogs/informix/alterSequence.xml | 26 ++++++ .../changelogs/informix/createFunction.xml | 24 +++++ .../changelogs/informix/createPackage.xml | 23 +++++ .../changelogs/informix/createPackageBody.xml | 23 +++++ .../changelogs/informix/createProcedure.txt | 3 + .../changelogs/informix/createProcedure.xml | 20 ++++ .../informix/createProcedureFromFile.xml | 20 ++++ .../changelogs/informix/createSequence.xml | 19 ++++ .../changelogs/informix/createTrigger.xml | 40 ++++++++ .../changelogs/informix/dropDefaultValue.xml | 16 ++++ .../changelogs/informix/dropProcedure.xml | 19 ++++ .../changelogs/informix/dropSequence.xml | 18 ++++ .../changelogs/informix/dropTrigger.xml | 42 +++++++++ .../informix/addDefaultValue.json | 15 +++ .../informix/addDefaultValueBoolean.json | 15 +++ .../informix/addDefaultValueNumeric.json | 15 +++ .../informix/alterSequence.json | 13 +++ .../informix/createTableTimestamp.json | 28 ++++++ .../expectedSnapshot/informix/createView.json | 13 +++ .../informix/dropDefaultValue.json | 17 ++++ .../informix/addCheckConstraint.sql | 3 + .../informix/addDefaultValueComputed.sql | 9 ++ .../informix/addDefaultValueDate.sql | 4 + .../informix/addDefaultValueSequenceNext.sql | 3 + .../informix/addUniqueConstraint.sql | 3 + .../expectedSql/informix/createFunction.sql | 3 + .../expectedSql/informix/createPackage.sql | 3 + .../informix/createPackageBody.sql | 3 + .../expectedSql/informix/createProcedure.sql | 3 + .../informix/createProcedureFromFile.sql | 3 + .../expectedSql/informix/createTrigger.sql | 3 + .../informix/disableCheckConstraint.sql | 3 + .../expectedSql/informix/disableTrigger.sql | 3 + .../informix/dropCheckConstraint.sql | 3 + .../expectedSql/informix/dropFunction.sql | 3 + .../expectedSql/informix/dropTrigger.sql | 3 + .../informix/enableCheckConstraint.sql | 3 + .../expectedSql/informix/enableTrigger.sql | 3 + .../expectedSql/informix/renameSequence.sql | 3 + .../expectedSql/informix/renameTrigger.sql | 3 + .../expectedSql/informix/renameView.sql | 3 + .../expectedSql/informix/setColumnRemarks.sql | 3 + .../expectedSql/informix/setTableRemarks.sql | 3 + .../changelogs/informix/loadUpdateData.csv | 4 + .../changelogs/informix/loadUpdateData.xml | 24 +++++ src/test/resources/automation-runner.sh | 10 +- src/test/resources/docker/create-infra.sh | 6 ++ src/test/resources/docker/docker-compose.yml | 31 +++++++ src/test/resources/docker/informix-init.sql | 93 +++++++++++++++++++ src/test/resources/harness-config.yml | 15 +++ 56 files changed, 723 insertions(+), 4 deletions(-) create mode 100644 src/main/resources/liquibase/harness/change/changelogs/informix/addDefaultValueComputed.xml create mode 100644 src/main/resources/liquibase/harness/change/changelogs/informix/addDefaultValueDate.xml create mode 100644 src/main/resources/liquibase/harness/change/changelogs/informix/addDefaultValueNumeric.xml create mode 100644 src/main/resources/liquibase/harness/change/changelogs/informix/alterSequence.xml create mode 100644 src/main/resources/liquibase/harness/change/changelogs/informix/createFunction.xml create mode 100644 src/main/resources/liquibase/harness/change/changelogs/informix/createPackage.xml create mode 100644 src/main/resources/liquibase/harness/change/changelogs/informix/createPackageBody.xml create mode 100644 src/main/resources/liquibase/harness/change/changelogs/informix/createProcedure.txt create mode 100644 src/main/resources/liquibase/harness/change/changelogs/informix/createProcedure.xml create mode 100644 src/main/resources/liquibase/harness/change/changelogs/informix/createProcedureFromFile.xml create mode 100644 src/main/resources/liquibase/harness/change/changelogs/informix/createSequence.xml create mode 100644 src/main/resources/liquibase/harness/change/changelogs/informix/createTrigger.xml create mode 100644 src/main/resources/liquibase/harness/change/changelogs/informix/dropDefaultValue.xml create mode 100644 src/main/resources/liquibase/harness/change/changelogs/informix/dropProcedure.xml create mode 100644 src/main/resources/liquibase/harness/change/changelogs/informix/dropSequence.xml create mode 100644 src/main/resources/liquibase/harness/change/changelogs/informix/dropTrigger.xml create mode 100644 src/main/resources/liquibase/harness/change/expectedSnapshot/informix/addDefaultValue.json create mode 100644 src/main/resources/liquibase/harness/change/expectedSnapshot/informix/addDefaultValueBoolean.json create mode 100644 src/main/resources/liquibase/harness/change/expectedSnapshot/informix/addDefaultValueNumeric.json create mode 100644 src/main/resources/liquibase/harness/change/expectedSnapshot/informix/alterSequence.json create mode 100644 src/main/resources/liquibase/harness/change/expectedSnapshot/informix/createTableTimestamp.json create mode 100644 src/main/resources/liquibase/harness/change/expectedSnapshot/informix/createView.json create mode 100644 src/main/resources/liquibase/harness/change/expectedSnapshot/informix/dropDefaultValue.json create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/addCheckConstraint.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/addDefaultValueComputed.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/addDefaultValueDate.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/addDefaultValueSequenceNext.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/addUniqueConstraint.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/createFunction.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/createPackage.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/createPackageBody.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/createProcedure.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/createProcedureFromFile.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/createTrigger.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/disableCheckConstraint.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/disableTrigger.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/dropCheckConstraint.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/dropFunction.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/dropTrigger.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/enableCheckConstraint.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/enableTrigger.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/renameSequence.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/renameTrigger.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/renameView.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/setColumnRemarks.sql create mode 100644 src/main/resources/liquibase/harness/change/expectedSql/informix/setTableRemarks.sql create mode 100644 src/main/resources/liquibase/harness/data/changelogs/informix/loadUpdateData.csv create mode 100644 src/main/resources/liquibase/harness/data/changelogs/informix/loadUpdateData.xml create mode 100644 src/test/resources/docker/informix-init.sql diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c0698032e..ca038b0ff 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -93,7 +93,9 @@ on: "hsqldb-2.5", "firebird-3", "firebird-4", - "db2-luw" + "db2-luw", + "informix-12.10", + "informix-14.10" ] jobs: @@ -118,7 +120,7 @@ jobs: "postgres-12","postgres-13","postgres-14","postgres-15","postgres-16","mariadb-10.2","mariadb-10.3","mariadb-10.4","mariadb-10.5","mariadb-10.6", "mariadb-10.7","mssql-2017","H2Database-2.2","crdb-23.1","crdb-23.2","crdb-24.1", "edb-postgres-12","edb-postgres-13","edb-postgres-14","edb-postgres-15","edb-postgres-16", - "edb-edb-12","edb-edb-13","edb-edb-14","edb-edb-15","edb-edb-16","derby","sqlite","hsqldb-2.4","hsqldb-2.5","firebird-3","firebird-4","db2-luw"]' }} + "edb-edb-12","edb-edb-13","edb-edb-14","edb-edb-15","edb-edb-16","derby","sqlite","hsqldb-2.4","hsqldb-2.5","firebird-3","firebird-4","db2-luw","informix-12.10","informix-14.10"]' }} testClasses: ${{ inputs.testClasses || 'LiquibaseHarnessSuiteTest' }} steps: - uses: actions/checkout@v4 diff --git a/pom.xml b/pom.xml index 4b8a87ec0..317d04104 100644 --- a/pom.xml +++ b/pom.xml @@ -187,6 +187,11 @@ mssql-jdbc 12.8.1.jre11 + + com.ibm.informix + jdbc + 4.50.11 + com.h2database h2 diff --git a/src/main/groovy/liquibase/harness/compatibility/foundational/FoundationalTest.groovy b/src/main/groovy/liquibase/harness/compatibility/foundational/FoundationalTest.groovy index f979da139..eb435648c 100644 --- a/src/main/groovy/liquibase/harness/compatibility/foundational/FoundationalTest.groovy +++ b/src/main/groovy/liquibase/harness/compatibility/foundational/FoundationalTest.groovy @@ -107,6 +107,8 @@ class FoundationalTest extends Specification { if (shouldOpenNewConnection(connection, "sqlite")) { newConnection = DriverManager.getConnection(testInput.url, testInput.username, testInput.password) resultSet = newConnection.createStatement().executeQuery("SELECT * FROM DATABASECHANGELOG") + } else if (shouldOpenNewConnection(connection, "informix")) { + resultSet = ((JdbcConnection) connection).createStatement().executeQuery("SELECT * FROM DATABASECHANGELOG") } else { resultSet = ((JdbcConnection) connection).createStatement().executeQuery("SELECT * FROM DATABASECHANGELOG") connection.autoCommit ?: connection.commit() diff --git a/src/main/resources/liquibase/harness/change/changelogs/informix/addDefaultValueComputed.xml b/src/main/resources/liquibase/harness/change/changelogs/informix/addDefaultValueComputed.xml new file mode 100644 index 000000000..a78dd036f --- /dev/null +++ b/src/main/resources/liquibase/harness/change/changelogs/informix/addDefaultValueComputed.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/src/main/resources/liquibase/harness/change/changelogs/informix/addDefaultValueDate.xml b/src/main/resources/liquibase/harness/change/changelogs/informix/addDefaultValueDate.xml new file mode 100644 index 000000000..56dbaf9f7 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/changelogs/informix/addDefaultValueDate.xml @@ -0,0 +1,16 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/changelogs/informix/addDefaultValueNumeric.xml b/src/main/resources/liquibase/harness/change/changelogs/informix/addDefaultValueNumeric.xml new file mode 100644 index 000000000..f714b52c8 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/changelogs/informix/addDefaultValueNumeric.xml @@ -0,0 +1,16 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/changelogs/informix/alterSequence.xml b/src/main/resources/liquibase/harness/change/changelogs/informix/alterSequence.xml new file mode 100644 index 000000000..bad59e011 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/changelogs/informix/alterSequence.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + diff --git a/src/main/resources/liquibase/harness/change/changelogs/informix/createFunction.xml b/src/main/resources/liquibase/harness/change/changelogs/informix/createFunction.xml new file mode 100644 index 000000000..68a42ec7b --- /dev/null +++ b/src/main/resources/liquibase/harness/change/changelogs/informix/createFunction.xml @@ -0,0 +1,24 @@ + + + + CREATE FUNCTION test_function() + RETURNS BOOLEAN + LANGUAGE SPL + BEGIN + LET trace_message = 'Test function executed'; + TRACE trace_message; + RETURN TRUE; -- Use TRUE or appropriate value as needed. + END; + + + + + + \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/changelogs/informix/createPackage.xml b/src/main/resources/liquibase/harness/change/changelogs/informix/createPackage.xml new file mode 100644 index 000000000..600825143 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/changelogs/informix/createPackage.xml @@ -0,0 +1,23 @@ + + + + + CREATE FUNCTION test_function() + RETURNS BOOLEAN + LANGUAGE SPL + BEGIN + LET trace_message = 'Test function executed'; + TRACE trace_message; + RETURN TRUE; -- Use TRUE or appropriate value as needed. + END; + + + + + \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/changelogs/informix/createPackageBody.xml b/src/main/resources/liquibase/harness/change/changelogs/informix/createPackageBody.xml new file mode 100644 index 000000000..804a87ec2 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/changelogs/informix/createPackageBody.xml @@ -0,0 +1,23 @@ + + + + + CREATE FUNCTION test_function() + RETURNS BOOLEAN + LANGUAGE SPL + BEGIN + LET trace_message = 'Test function executed'; + TRACE trace_message; + RETURN TRUE; -- Use TRUE or appropriate value as needed. + END; + + + + + \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/changelogs/informix/createProcedure.txt b/src/main/resources/liquibase/harness/change/changelogs/informix/createProcedure.txt new file mode 100644 index 000000000..460b62ee9 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/changelogs/informix/createProcedure.txt @@ -0,0 +1,3 @@ +CREATE PROCEDURE test_procedure ( per_cent INT) + UPDATE stock SET unit_price = unit_price + (unit_price * (per_cent/100) ); + END PROCEDURE \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/changelogs/informix/createProcedure.xml b/src/main/resources/liquibase/harness/change/changelogs/informix/createProcedure.xml new file mode 100644 index 000000000..06be7d70c --- /dev/null +++ b/src/main/resources/liquibase/harness/change/changelogs/informix/createProcedure.xml @@ -0,0 +1,20 @@ + + + + + test procedure + CREATE PROCEDURE test_procedure ( per_cent INT) + UPDATE stock SET unit_price = unit_price + (unit_price * (per_cent/100) ); + END PROCEDURE + + + + + + \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/changelogs/informix/createProcedureFromFile.xml b/src/main/resources/liquibase/harness/change/changelogs/informix/createProcedureFromFile.xml new file mode 100644 index 000000000..bb701454f --- /dev/null +++ b/src/main/resources/liquibase/harness/change/changelogs/informix/createProcedureFromFile.xml @@ -0,0 +1,20 @@ + + + + + test procedure + + + + + + + \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/changelogs/informix/createSequence.xml b/src/main/resources/liquibase/harness/change/changelogs/informix/createSequence.xml new file mode 100644 index 000000000..8004e4a07 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/changelogs/informix/createSequence.xml @@ -0,0 +1,19 @@ + + + + + + + + + + diff --git a/src/main/resources/liquibase/harness/change/changelogs/informix/createTrigger.xml b/src/main/resources/liquibase/harness/change/changelogs/informix/createTrigger.xml new file mode 100644 index 000000000..045de2e60 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/changelogs/informix/createTrigger.xml @@ -0,0 +1,40 @@ + + + + test procedure + CREATE FUNCTION test_function() + RETURNS BOOLEAN + LANGUAGE SPL + BEGIN + LET trace_message = 'Test function executed'; + TRACE trace_message; + RETURN TRUE; + END; + + + DROP FUNCTION test_function() + + + + CREATE TRIGGER test_trigger + BEFORE INSERT ON your_table_name + FOR EACH ROW + EXECUTE FUNCTION test_function(); + + + + + + \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/changelogs/informix/dropDefaultValue.xml b/src/main/resources/liquibase/harness/change/changelogs/informix/dropDefaultValue.xml new file mode 100644 index 000000000..6fbbe9e5b --- /dev/null +++ b/src/main/resources/liquibase/harness/change/changelogs/informix/dropDefaultValue.xml @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/src/main/resources/liquibase/harness/change/changelogs/informix/dropProcedure.xml b/src/main/resources/liquibase/harness/change/changelogs/informix/dropProcedure.xml new file mode 100644 index 000000000..07f4e9a8c --- /dev/null +++ b/src/main/resources/liquibase/harness/change/changelogs/informix/dropProcedure.xml @@ -0,0 +1,19 @@ + + + + + test procedure + + + + + + diff --git a/src/main/resources/liquibase/harness/change/changelogs/informix/dropSequence.xml b/src/main/resources/liquibase/harness/change/changelogs/informix/dropSequence.xml new file mode 100644 index 000000000..ce8b16bdd --- /dev/null +++ b/src/main/resources/liquibase/harness/change/changelogs/informix/dropSequence.xml @@ -0,0 +1,18 @@ + + + + + + + + + diff --git a/src/main/resources/liquibase/harness/change/changelogs/informix/dropTrigger.xml b/src/main/resources/liquibase/harness/change/changelogs/informix/dropTrigger.xml new file mode 100644 index 000000000..2d960c438 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/changelogs/informix/dropTrigger.xml @@ -0,0 +1,42 @@ + + + + test procedure + CREATE FUNCTION test_function() + RETURNS BOOLEAN + LANGUAGE SPL + BEGIN + LET trace_message = 'Test function executed'; + TRACE trace_message; + RETURN TRUE; + END; + + + DROP FUNCTION test_function() + + + + CREATE TRIGGER test_trigger + BEFORE INSERT ON your_table_name + FOR EACH ROW + EXECUTE FUNCTION test_function(); + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/addDefaultValue.json b/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/addDefaultValue.json new file mode 100644 index 000000000..cb6558445 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/addDefaultValue.json @@ -0,0 +1,15 @@ +{ + "snapshot": { + "objects": { + "liquibase.structure.core.Column": [ + { + "column": { + "defaultValue": "title_test", + "name": "title", + "nullable": true + } + } + ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/addDefaultValueBoolean.json b/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/addDefaultValueBoolean.json new file mode 100644 index 000000000..658445dfc --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/addDefaultValueBoolean.json @@ -0,0 +1,15 @@ +{ + "snapshot": { + "objects": { + "liquibase.structure.core.Column": [ + { + "column": { + "defaultValue": "T\\!\\{liquibase.statement.DatabaseFunction\\}", + "name": "booleancolumn", + "nullable": true + } + } + ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/addDefaultValueNumeric.json b/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/addDefaultValueNumeric.json new file mode 100644 index 000000000..6a116b302 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/addDefaultValueNumeric.json @@ -0,0 +1,15 @@ +{ + "snapshot": { + "objects": { + "liquibase.structure.core.Column": [ + { + "column": { + "defaultValue": "100000000\\!\\{java.lang.Integer\\}", + "name": "numericColumn", + "nullable": true + } + } + ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/alterSequence.json b/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/alterSequence.json new file mode 100644 index 000000000..f1c16d223 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/alterSequence.json @@ -0,0 +1,13 @@ +{ + "snapshot": { + "objects": { + "liquibase.structure.core.Sequence": [ + { + "sequence": { + "name": "test_sequence" + } + } + ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/createTableTimestamp.json b/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/createTableTimestamp.json new file mode 100644 index 000000000..d7bc4c8f6 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/createTableTimestamp.json @@ -0,0 +1,28 @@ +{ + "snapshot": { + "objects": { + "liquibase.structure.core.Table": [ + { + "table": { + "name": "lms_create_table_test" + } + } + ], + "liquibase.structure.core.Column": [ + { + "column": { + "name": "lms_test_id" + } + }, + { + "column": { + "name": "lms_test_timestamp", + "type": { + "typeName": "datetime year to fraction(5)" + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/createView.json b/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/createView.json new file mode 100644 index 000000000..4281f444c --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/createView.json @@ -0,0 +1,13 @@ +{ + "snapshot": { + "objects": { + "liquibase.structure.core.View": [ + { + "view": { + "definition": "select x0.id, x0.first_name, x0.last_name, x0.email from (select x1.id, x1.first_name, x1.last_name, x1.email from authors x1 ) x0(id, first_name, last_name, email)", + "name": "test_view" + } + }] + } + } +} \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/dropDefaultValue.json b/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/dropDefaultValue.json new file mode 100644 index 000000000..d700c07f7 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSnapshot/informix/dropDefaultValue.json @@ -0,0 +1,17 @@ +{ + "snapshot": { + "objects": { + "liquibase.structure.core.Column": [ + { + "column": { + "name": "title", + "nullable": true, + "type": { + "typeName": "varchar" + } + } + } + ] + } + } +} diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/addCheckConstraint.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/addCheckConstraint.sql new file mode 100644 index 000000000..55a67dde4 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/addCheckConstraint.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Bug on Liquibase side: Change Type 'pro:addCheckConstraint' is not allowed for Informix Dynamic Server DAT-19230 \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/addDefaultValueComputed.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/addDefaultValueComputed.sql new file mode 100644 index 000000000..43c1ef09d --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/addDefaultValueComputed.sql @@ -0,0 +1,9 @@ +INVALID TEST + +-- Bug on Liquibase side: incorrect generated sql DAT-19231 +-- Actual: +-- ALTER TABLE testdb:informix.posts +-- MODIFY (inserted_date date DEFAULT DATETIME YEAR TO FRACTION(5) DEFAULT CURRENT YEAR TO FRACTION(5)); +-- Expected: +-- ALTER TABLE testdb:informix.posts +-- MODIFY (inserted_date DATETIME YEAR TO FRACTION(5) DEFAULT CURRENT YEAR TO FRACTION(5)); \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/addDefaultValueDate.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/addDefaultValueDate.sql new file mode 100644 index 000000000..707217485 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/addDefaultValueDate.sql @@ -0,0 +1,4 @@ +INVALID TEST + +-- Bug on Liquibase side: Incorrect SQL generated on rollback defaultValueDate DAT-19231 + --[Failed SQL: (-201) ALTER TABLE testdb:informix.authors MODIFY (dateTimeColumn datetime)] \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/addDefaultValueSequenceNext.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/addDefaultValueSequenceNext.sql new file mode 100644 index 000000000..1982e0a92 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/addDefaultValueSequenceNext.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Informix does not support using a sequence’s NEXTVAL directly in a DEFAULT clause \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/addUniqueConstraint.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/addUniqueConstraint.sql new file mode 100644 index 000000000..3874406a3 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/addUniqueConstraint.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Bug on Liquibase side: Missing UniqueConstraints in Liquibase Snapshot output DAT-19232 \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/createFunction.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/createFunction.sql new file mode 100644 index 000000000..adaa35efc --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/createFunction.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Bug on Liquibase side: Change Type 'pro:createFunction' is not allowed for Informix Dynamic Server DAT-19230 \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/createPackage.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/createPackage.sql new file mode 100644 index 000000000..005138ab2 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/createPackage.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Informix does not support packages \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/createPackageBody.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/createPackageBody.sql new file mode 100644 index 000000000..666c7a764 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/createPackageBody.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Informix does not support package bodies \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/createProcedure.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/createProcedure.sql new file mode 100644 index 000000000..78b01fd55 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/createProcedure.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Bug on Liquibase side: Missing Procedures in Liquibase Snapshot output DAT-19232 \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/createProcedureFromFile.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/createProcedureFromFile.sql new file mode 100644 index 000000000..78b01fd55 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/createProcedureFromFile.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Bug on Liquibase side: Missing Procedures in Liquibase Snapshot output DAT-19232 \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/createTrigger.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/createTrigger.sql new file mode 100644 index 000000000..06d0fc77a --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/createTrigger.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Bug on Liquibase side: Change Type 'pro:createTrigger' is not allowed for Informix Dynamic Server DAT-19230 \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/disableCheckConstraint.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/disableCheckConstraint.sql new file mode 100644 index 000000000..55a67dde4 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/disableCheckConstraint.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Bug on Liquibase side: Change Type 'pro:addCheckConstraint' is not allowed for Informix Dynamic Server DAT-19230 \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/disableTrigger.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/disableTrigger.sql new file mode 100644 index 000000000..06d0fc77a --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/disableTrigger.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Bug on Liquibase side: Change Type 'pro:createTrigger' is not allowed for Informix Dynamic Server DAT-19230 \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/dropCheckConstraint.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/dropCheckConstraint.sql new file mode 100644 index 000000000..55a67dde4 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/dropCheckConstraint.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Bug on Liquibase side: Change Type 'pro:addCheckConstraint' is not allowed for Informix Dynamic Server DAT-19230 \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/dropFunction.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/dropFunction.sql new file mode 100644 index 000000000..adaa35efc --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/dropFunction.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Bug on Liquibase side: Change Type 'pro:createFunction' is not allowed for Informix Dynamic Server DAT-19230 \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/dropTrigger.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/dropTrigger.sql new file mode 100644 index 000000000..06d0fc77a --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/dropTrigger.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Bug on Liquibase side: Change Type 'pro:createTrigger' is not allowed for Informix Dynamic Server DAT-19230 \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/enableCheckConstraint.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/enableCheckConstraint.sql new file mode 100644 index 000000000..55a67dde4 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/enableCheckConstraint.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Bug on Liquibase side: Change Type 'pro:addCheckConstraint' is not allowed for Informix Dynamic Server DAT-19230 \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/enableTrigger.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/enableTrigger.sql new file mode 100644 index 000000000..06d0fc77a --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/enableTrigger.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Bug on Liquibase side: Change Type 'pro:createTrigger' is not allowed for Informix Dynamic Server DAT-19230 \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/renameSequence.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/renameSequence.sql new file mode 100644 index 000000000..71f844506 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/renameSequence.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Informix does not support renameSequence \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/renameTrigger.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/renameTrigger.sql new file mode 100644 index 000000000..06d0fc77a --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/renameTrigger.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Bug on Liquibase side: Change Type 'pro:createTrigger' is not allowed for Informix Dynamic Server DAT-19230 \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/renameView.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/renameView.sql new file mode 100644 index 000000000..5a466f774 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/renameView.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Informix does not support renameView \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/setColumnRemarks.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/setColumnRemarks.sql new file mode 100644 index 000000000..b6af43a36 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/setColumnRemarks.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Informix does not support setColumnRemarks \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/change/expectedSql/informix/setTableRemarks.sql b/src/main/resources/liquibase/harness/change/expectedSql/informix/setTableRemarks.sql new file mode 100644 index 000000000..dc4c06138 --- /dev/null +++ b/src/main/resources/liquibase/harness/change/expectedSql/informix/setTableRemarks.sql @@ -0,0 +1,3 @@ +INVALID TEST + +-- Informix does not support setTableRemarks \ No newline at end of file diff --git a/src/main/resources/liquibase/harness/data/changelogs/informix/loadUpdateData.csv b/src/main/resources/liquibase/harness/data/changelogs/informix/loadUpdateData.csv new file mode 100644 index 000000000..3fec2c40f --- /dev/null +++ b/src/main/resources/liquibase/harness/data/changelogs/informix/loadUpdateData.csv @@ -0,0 +1,4 @@ +id;first_name;last_name;email;birthdate;added +1;Adam;Gods;test1@example.com;1000-02-27;2000-02-04T02:32:00 +7;Noah;Lamekhs;test2@example.com;2000-02-27;1994-12-10T01:00:00 +8;Muhammad;Ibn Abdullah;test3@example.com;3000-02-27;2000-12-10T01:00:00 diff --git a/src/main/resources/liquibase/harness/data/changelogs/informix/loadUpdateData.xml b/src/main/resources/liquibase/harness/data/changelogs/informix/loadUpdateData.xml new file mode 100644 index 000000000..ab4f4fa13 --- /dev/null +++ b/src/main/resources/liquibase/harness/data/changelogs/informix/loadUpdateData.xml @@ -0,0 +1,24 @@ + + + + + + + + DELETE FROM authors WHERE id = 1; + INSERT INTO authors (id, first_name, last_name, email, birthdate, added) VALUES (1, 'Eileen', 'Lubowitz', 'ppaucek@example.org', TO_DATE('1991-03-04', '%Y-%m-%d'), TO_DATE('2004-05-30 02:08:25', '%Y-%m-%d %H:%M:%S'));; + DELETE FROM authors WHERE id = 7; + DELETE FROM authors WHERE id = 8; + + + + diff --git a/src/test/resources/automation-runner.sh b/src/test/resources/automation-runner.sh index b17f36e0e..d91890c1c 100755 --- a/src/test/resources/automation-runner.sh +++ b/src/test/resources/automation-runner.sh @@ -132,10 +132,16 @@ case $db in test_command mvn -ntp -Dtest=$tc -DdbName=firebird -DdbVersion=4 test ;; "db2-luw") - test_command mvn -ntp -Dtest=$tc -DdbName=db2-luw test - ;; + test_command mvn -ntp -Dtest=$tc -DdbName=db2-luw test + ;; "snowflake") test_command mvn -ntp -Dtest=$tc -DdbName=snowflake -DrollbackStrategy=rollbackByTag test ;; + "informix-12.10") + test_command mvn -ntp -Dtest=$tc -DdbName=informix -DdbVersion=12 test + ;; + "informix-14.10") + test_command mvn -ntp -Dtest=$tc -DdbName=informix -DdbVersion=14 test + ;; esac diff --git a/src/test/resources/docker/create-infra.sh b/src/test/resources/docker/create-infra.sh index 6d14efd8c..5e2757445 100755 --- a/src/test/resources/docker/create-infra.sh +++ b/src/test/resources/docker/create-infra.sh @@ -66,6 +66,12 @@ case $db in exit 0 ;; + # informix needs a bit more time to start + "informix-12.10"|"informix-14.10") + docker compose up -d $db + sleep 60 + ;; + # standard startup *) docker compose up -d $db diff --git a/src/test/resources/docker/docker-compose.yml b/src/test/resources/docker/docker-compose.yml index 1e82ead9c..8ca368c15 100644 --- a/src/test/resources/docker/docker-compose.yml +++ b/src/test/resources/docker/docker-compose.yml @@ -342,6 +342,37 @@ services: depends_on: - crdb-24.1 + informix-12.10: + image: ibmcom/informix-developer-database:12.10.FC12W1DE + container_name: informix-db + hostname: ifx + ports: + - "9088:9088" + environment: + LICENSE: "accept" + INIT_FILE: "sch_init_informix.custom.sql" + SIZE: "custom" + restart: always + privileged: true + volumes: + - "./informix-init.sql:/opt/ibm/data/sch_init_informix.custom.sql" + + informix-14.10: + image: icr.io/informix/informix-developer-database:14.10.FC7W1DE + container_name: informix-db + hostname: ifx + ports: + - "9088:9088" + environment: + LICENSE: "accept" + INIT_FILE: "informix-init.sql" + DBDATE: "Y4MD-" + restart: always + privileged: true + volumes: + - "./informix-init.sql:/opt/ibm/config/informix-init.sql" + + # Titan (https://titan-data.io) is managing these images for our CI/CD process. If you want to run them locally you'll have to # populate init script (hsqldb-init.sql) for this platform manually or install titan and pull image pre-populated with data diff --git a/src/test/resources/docker/informix-init.sql b/src/test/resources/docker/informix-init.sql new file mode 100644 index 000000000..8b7636617 --- /dev/null +++ b/src/test/resources/docker/informix-init.sql @@ -0,0 +1,93 @@ +CREATE DATABASE testdb WITH LOG MODE ANSI; + +DATABASE testdb; + +-- Use BEGIN WORK to start a transaction +BEGIN WORK; + +-- Drop and create authors table +DROP TABLE IF EXISTS authors; +CREATE TABLE authors ( + id SERIAL PRIMARY KEY, + first_name VARCHAR(50) NOT NULL, + last_name VARCHAR(50) NOT NULL, + email VARCHAR(100) NOT NULL, + birthdate DATE NOT NULL, + added DATETIME YEAR TO FRACTION(5) DEFAULT CURRENT YEAR TO FRACTION(5) +); + +-- Insert data into authors table +INSERT INTO authors (id, first_name, last_name, email, birthdate, added) +VALUES + (1, 'Eileen', 'Lubowitz', 'ppaucek@example.org', + TO_DATE('1991-03-04', '%Y-%m-%d'), + TO_DATE('2004-05-30 02:08:25', '%Y-%m-%d %H:%M:%S')); + +INSERT INTO authors (id, first_name, last_name, email, birthdate, added) +VALUES + (2, 'Tamia', 'Mayert', 'shansen@example.org', + TO_DATE('2016-03-27', '%Y-%m-%d'), + TO_DATE('2014-03-21 02:52:00', '%Y-%m-%d %H:%M:%S')); +INSERT INTO authors (id, first_name, last_name, email, birthdate, added) +VALUES + (3, 'Cyril', 'Funk', 'reynolds.godfrey@example.com', + TO_DATE('1988-04-21', '%Y-%m-%d'), + TO_DATE('2011-06-24 18:17:48', '%Y-%m-%d %H:%M:%S')); + +INSERT INTO authors (id, first_name, last_name, email, birthdate, added) +VALUES + (4, 'Nicolas', 'Buckridge', 'xhoeger@example.net', + TO_DATE('2017-02-03', '%Y-%m-%d'), + TO_DATE('2019-04-22 02:04:41', '%Y-%m-%d %H:%M:%S')); + +INSERT INTO authors (id, first_name, last_name, email, birthdate, added) +VALUES + (5, 'Jayden', 'Walter', 'lillian66@example.com', + TO_DATE('2010-02-27', '%Y-%m-%d'), + TO_DATE('1990-02-04 02:32:00', '%Y-%m-%d %H:%M:%S')); + +-- Commit the transaction for authors table +COMMIT WORK; + +-- Start a new transaction for the posts table +BEGIN WORK; + +-- Drop and create posts table +DROP TABLE IF EXISTS posts; +CREATE TABLE posts ( + id SERIAL, + author_id INT NOT NULL, + title VARCHAR(255) NOT NULL DEFAULT 'title_test', + description VARCHAR(255) NOT NULL, + content VARCHAR(255) NOT NULL, + inserted_date DATE NOT NULL +); + +-- Insert data into posts table +INSERT INTO posts (id, author_id, title, description, content, inserted_date) +VALUES + (1, 1, 'temporibus', 'voluptatum', 'Fugit non et doloribus repudiandae.', + TO_DATE('2015-11-18', '%Y-%m-%d')); + +INSERT INTO posts (id, author_id, title, description, content, inserted_date) +VALUES + (2, 2, 'ea', 'aut', 'Tempora molestias maiores provident molestiae sint possimus quasi.', + TO_DATE('1975-06-08', '%Y-%m-%d')); + +INSERT INTO posts (id, author_id, title, description, content, inserted_date) +VALUES + (3, 3, 'illum', 'rerum', 'Delectus recusandae sit officiis dolor.', + TO_DATE('1975-02-25', '%Y-%m-%d')); + +INSERT INTO posts (id, author_id, title, description, content, inserted_date) +VALUES + (4, 4, 'itaque', 'deleniti', 'Magni nam optio id recusandae.', + TO_DATE('2010-07-28', '%Y-%m-%d')); + +INSERT INTO posts (id, author_id, title, description, content, inserted_date) +VALUES + (5, 5, 'ad', 'similique', 'Rerum tempore quis ut nesciunt qui excepturi est.', + TO_DATE('2006-10-09', '%Y-%m-%d')); + +-- Commit the transaction for posts table +COMMIT WORK; \ No newline at end of file diff --git a/src/test/resources/harness-config.yml b/src/test/resources/harness-config.yml index d3556ae3d..142864263 100644 --- a/src/test/resources/harness-config.yml +++ b/src/test/resources/harness-config.yml @@ -308,3 +308,18 @@ databasesUnderTest: url: jdbc:firebirdsql://localhost:3050/lbcat username: lbuser password: LiquibasePass1 + + - name: informix + prefix: docker + version: 12 + url: jdbc:informix-sqli://localhost:9088/testdb:INFORMIXSERVER=informix; + username: informix + password: in4mix + + - name: informix + prefix: docker + version: 14 + url: jdbc:informix-sqli://localhost:9088/testdb:INFORMIXSERVER=informix; + username: informix + password: in4mix +