Hi,
I am trying to run a changeset with sqlFile tag but it isn’t getting executed. The liquibase update command says successfully executed but the databasechangelog also doesn’t contain any reference of the changeset.
Below is my master changeset.xml
<?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-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<include file="changesets/release1/changelog.xml" labels="release1" relativeToChangelogFile="true"/>
<include file="changesets/release2/changelog.xml" labels="release2" relativeToChangelogFile="true"/>
</databaseChangeLog>
Below is my release1/changelog.xml
<?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"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.0.xsd
http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-4.0.xsd">
<!-- Please assign labels for all changesets as this will be used in DB Change Log table. -->
<property name="label" value="release1" />
<changeSet labels="${label}" author="anuj.batra" id="sample.1.changeset" runOnChange="true" context="${label}">
<comment>This section makes sure to enter values of the reason why change is made.</comment>
<sqlFile dbms="h2, oracle, mysql" encoding="UTF-8" path="rollforward/sample.changeset.sql" relativeToChangelogFile="true" />
<rollback>
<sqlFile dbms="h2, oracle, mysql" path="rollback/sample.changeset.rollback.sql" relativeToChangelogFile="true"/>
</rollback>
</changeSet>
</databaseChangeLog>
Below is my roolforward.sql file
CREATE TABLE People (
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(150),
City varchar(255)
);
INSERT INTO People (PersonID, LastName, FirstName, Address, City)
VALUES (1, 'Doe', 'John', '1 Woolworths Way', 'Bella Vista');
INSERT INTO People (PersonID, LastName, FirstName, Address, City)
VALUES (2, 'Doe 1', 'John', '1 Woolworths Way', 'Bella Vista');
INSERT INTO People (PersonID, LastName, FirstName, Address, City)
VALUES (3, 'Doe 2', 'John', '1 Woolworths Way', 'Bella Vista');
INSERT INTO People (PersonID, LastName, FirstName, Address, City)
VALUES (4, 'Doe 3', 'John', '1 Woolworths Way', 'Bella Vista');
I’ve tried deleting the database changelog and lock tables to import again but no luck. Both release1 and release2 changesets are not getting executed
I am using mysql database and below is my properties file
url=jdbc:mysql://localhost:3306/test?useLegacyDatetimeCode=false&serverTimezone=Australia/Sydney&autoCommit=true&character_set_server=utf8mb4
driver=com.mysql.cj.jdbc.Driver
username=test
password=test
Below is my databasechangelog
|ID|AUTHOR|FILENAME|DATEEXECUTED|ORDEREXECUTED|EXECTYPE|MD5SUM|DESCRIPTION|COMMENTS|TAG|LIQUIBASE|CONTEXTS|LABELS|DEPLOYMENT_ID|
|—|---|—|---|—|---|—|---|—|---|—|---|—|---|
|1612221150384|liquibase|liquibase-internal|2021-02-02 10:12:30|1|EXECUTED|8:d41d8cd98f00b204e9800998ecf8427e|empty||release2|4.2.1|NULL|NULL|2221150315|