Skip to content

Commit

Permalink
Fixing mysql 8.4 advanced tests (#966)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamelianovych authored Jan 13, 2025
1 parent 03b8ead commit 5d09b1c
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?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">
<createTable tableName="test_table_base">
<column name="id" type="INT">
<constraints nullable="false" primaryKey="true"/>
</column>
</createTable>
<rollback>
<dropTable tableName="test_table_base"/>
</rollback>
</changeSet>
<changeSet id="2" author="as">
<createTable tableName="test_table_reference">
<column name="id" type="INT">
<constraints nullable="false" primaryKey="true"/>
</column>
<column name="test_column" type="INT">
<constraints nullable="false"/>
</column>
</createTable>
<rollback>
<dropTable tableName="test_table_reference"/>
</rollback>
</changeSet>
<changeSet id="3" author="as">
<addUniqueConstraint columnNames="test_column"
constraintName="test_table_reference_unique"
tableName="test_table_reference"/>
<rollback>
<dropUniqueConstraint constraintName="test_table_reference_unique"
tableName="test_table_reference"/>
</rollback>
</changeSet>
<changeSet id="4" author="as">
<addForeignKeyConstraint baseColumnNames="id"
baseTableName="test_table_base"
constraintName="test_fk"
onDelete="CASCADE"
onUpdate="RESTRICT"
referencedColumnNames="test_column"
referencedTableName="test_table_reference"
validate="true"/>
<rollback>
<dropForeignKeyConstraint baseTableName="test_table_base"
constraintName="test_fk"/>
</rollback>
</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: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">
<sql>SET GLOBAL log_bin_trust_function_creators = 1;</sql>
<rollback/>
</changeSet>
<changeSet author="as" id="2">
<pro:createFunction
encoding="UTF-8"
replaceIfExists="true"
functionName="test_function">CREATE FUNCTION test_function()
RETURNS VARCHAR(20)
BEGIN
RETURN 'Hello';
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,5 @@
CREATE TABLE test_table_base (id INT NOT NULL, CONSTRAINT PK_TEST_TABLE_BASE PRIMARY KEY (id));

CREATE TABLE test_table_reference (id INT NOT NULL, test_column INT NOT NULL, CONSTRAINT PK_TEST_TABLE_REFERENCE PRIMARY KEY (id), UNIQUE (test_column));

ALTER TABLE test_table_base ADD CONSTRAINT test_fk FOREIGN KEY (id) REFERENCES test_table_reference (test_column) ON UPDATE RESTRICT ON DELETE CASCADE;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE FUNCTION `test_function`() RETURNS varchar(20) CHARSET utf8mb4
BEGIN
RETURN 'Hello';
END;

0 comments on commit 5d09b1c

Please sign in to comment.