Skip to content

Commit

Permalink
DAT-19145 Basic template to setup Informix (#933)
Browse files Browse the repository at this point in the history
* DAT-19145 Basic template to setup Informix
---------

Co-authored-by: Tamelianovych <amelianovychtaras@gmail.com>
Co-authored-by: PavloTytarchuk <55182440+PavloTytarchuk@users.noreply.github.com>
Co-authored-by: Taras Amelianovych <97164517+Tamelianovych@users.noreply.github.com>
  • Loading branch information
4 people authored Dec 17, 2024
1 parent e53604f commit f06355f
Show file tree
Hide file tree
Showing 56 changed files with 723 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ on:
"hsqldb-2.5",
"firebird-3",
"firebird-4",
"db2-luw"
"db2-luw",
"informix-12.10",
"informix-14.10"
]
jobs:
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@
<artifactId>mssql-jdbc</artifactId>
<version>12.8.1.jre11</version>
</dependency>
<dependency>
<groupId>com.ibm.informix</groupId>
<artifactId>jdbc</artifactId>
<version>4.50.11</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<!--https://docs.liquibase.com/change-types/add-default-value.html-->
<changeSet author="oleh" id="1">
<addDefaultValue tableName="posts"
columnName="inserted_date"
columnDataType="date"
defaultValueComputed="DATETIME YEAR TO FRACTION(5) DEFAULT CURRENT YEAR TO FRACTION(5)"/>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<changeSet id="1" author="as">
<addColumn tableName="authors">
<column name="dateTimeColumn" type="datetime"/>
</addColumn>
<addDefaultValue tableName="authors"
columnName="dateTimeColumn"
columnDataType="datetime"
defaultValueDate="2008-02-12T12:34:03"/>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<changeSet id="1" author="as">
<addColumn tableName="authors">
<column name="numericColumn" type="INTEGER"/>
</addColumn>
<addDefaultValue tableName="authors"
columnName="numericColumn"
columnDataType="INTEGER"
defaultValueNumeric="100000000"/>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<changeSet id="1" author="as">
<createSequence
incrementBy="1"
minValue="1"
sequenceName="test_sequence"
startValue="1"/>
<rollback>
<dropSequence sequenceName="test_sequence"/>
</rollback>
</changeSet>
<changeSet author="as" id="2" >
<alterSequence cacheSize="371717"
cycle="true"
incrementBy="10"
maxValue="371717"
minValue="1"
sequenceName="test_sequence"/>
<rollback/>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<changeSet author="as" id="1">
<pro:createFunction
encoding="UTF-8"
functionName="test_function">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;
</pro:createFunction>
<rollback>
<pro:dropFunction functionName="test_function"/>
</rollback>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

<changeSet author="as" id="1">
<pro:createPackage encoding="UTF-8"
packageName="Test package">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;</pro:createPackage>
<rollback>
<pro:dropFunction functionName="test_function"/>
</rollback>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

<changeSet author="as" id="1">
<pro:createPackageBody encoding="UTF-8"
packageBodyName="Test package">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;</pro:createPackageBody>
<rollback>
<pro:dropFunction functionName="test_function"/>
</rollback>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<!--https://docs.liquibase.com/change-types/create-procedure.html-->
<changeSet author="as" id="1">
<comment>test procedure</comment>
<createProcedure
encoding="UTF-8"
procedureName="test_procedure">CREATE PROCEDURE test_procedure ( per_cent INT)
UPDATE stock SET unit_price = unit_price + (unit_price * (per_cent/100) );
END PROCEDURE
</createProcedure>
<rollback>
<dropProcedure procedureName="test_procedure"/>
</rollback>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<!--https://docs.liquibase.com/change-types/create-procedure.html-->
<changeSet author="as" id="1">
<comment>test procedure</comment>
<createProcedure
encoding="UTF-8"
path="createProcedure.txt"
relativeToChangelogFile="true"
procedureName="test_procedure">
</createProcedure>
<rollback>
<dropProcedure procedureName="test_procedure"/>
</rollback>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

<changeSet author="oleh" id="1">
<createSequence
sequenceName="test_sequence"
incrementBy="1"
startValue="1"
minValue="1"
/>
<rollback>
<dropSequence sequenceName="test_sequence"/>
</rollback>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<changeSet author="as" id="1">
<comment>test procedure</comment>
<createProcedure
encoding="UTF-8"
procedureName="test_function">CREATE FUNCTION test_function()
RETURNS BOOLEAN
LANGUAGE SPL
BEGIN
LET trace_message = 'Test function executed';
TRACE trace_message;
RETURN TRUE;
END;
</createProcedure>
<rollback>
<sql>DROP FUNCTION test_function()</sql>
</rollback>
</changeSet>
<changeSet author="as" id="2">
<pro:createTrigger disabled="false"
encoding="UTF-8"
scope="test"
tableName="posts"
triggerName="test_trigger">CREATE TRIGGER test_trigger
BEFORE INSERT ON your_table_name
FOR EACH ROW
EXECUTE FUNCTION test_function();
</pro:createTrigger>
<rollback>
<pro:dropTrigger triggerName="test_trigger"
tableName="posts"/>
</rollback>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<!--https://docs.liquibase.com/change-types/add-default-value.html-->
<changeSet author="oleh" id="1">
<addDefaultValue tableName="posts"
columnName="title"
columnDataType="varchar(255)"
defaultValue="title_test"/>
<dropDefaultValue tableName="posts" columnName="title" columnDataType="varchar(255)"/>
<rollback/>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<!--https://docs.liquibase.com/change-types/drop-procedure.html-->
<changeSet author="as" id="1">
<comment>test procedure</comment>
<createProcedure
encoding="UTF-8"
path="createProcedure.txt"
relativeToChangelogFile="true"
procedureName="test_procedure">
</createProcedure>
<dropProcedure procedureName="test_procedure"/>
<rollback/>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

<changeSet author="oleh" id="1">
<createSequence
sequenceName="test_sequence"
incrementBy="1"
startValue="1"
minValue="1"
/>
<dropSequence sequenceName="test_sequence"/>
<rollback/>
</changeSet>
</databaseChangeLog>
Loading

0 comments on commit f06355f

Please sign in to comment.