I cannot understand rollback process when I am using yaml format of settings.
Xml example:
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=“http://www.liquibase.org/xml/ns/dbchangelog/1.8
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.8.xsd”>
First change
CREATE TABLE dbo.Table2 (XX INT);
DROP TABLE dbo.Table2;
xsi:schemaLocation=“http://www.liquibase.org/xml/ns/dbchangelog/1.8
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.8.xsd”>
First change
CREATE TABLE dbo.Table2 (XX INT);
DROP TABLE dbo.Table2;
I call liquibase as follows
liquibase --driver=com.microsoft.sqlserver.jdbc.SQLServerDriver --url=“jdbc:sqlserver:…” --changeLogFile="…\changesets.xml" update
I have 2 records in dbo.DATABASECHANGELOG - one for “v.0.0.0” version and one for “v.0.1.0” version and new table (Table2) is created in the database.
OK.
Then I decided to do rollback to “v.0.0.0” version and I call liquibase as follows:
liquibase --driver=com.microsoft.sqlserver.jdbc.SQLServerDriver --url=“jdbc:sqlserver:…” --changeLogFile="…\changesets.xml" rollback v.0.0.0
I see in the console:
Starting Liquibase at Thu, 18 Oct 2018 12:00:28 MSK (version 3.6.2 built at 2018-07-03 11:28:09)
Rolling Back Changeset:d:/…/changesets.xml::1::idm
Liquibase: Rollback has been successful.
I have the only record in dbo.DATABASECHANGELOG - only for “v.0.0.0” and dbo.Table2 is deleted from the database.
Wonderful.
Everything that I wanted.
Then I want to try yaml format.
Here it is:
databaseChangeLog:
- changeSet:
id: tag-0
author: idm
changes:
- tagDatabase:
tag: v.0.0.0
- changeSet:
id: 1
author: idm
comment: First change
changes:
- tagDatabase:
tag: v.0.1.0
- sql:
sql: CREATE TABLE dbo.Table2 (XX INT);
rollback:
-sql:
sql: DROP TABLE dbo.Table2;
I call liquibase as follows
liquibase --driver=com.microsoft.sqlserver.jdbc.SQLServerDriver --url=“jdbc:sqlserver:…” --changeLogFile="…\changesets.yaml" update
I have 2 records in dbo.DATABASECHANGELOG - one for “v.0.0.0” version and one for “v.0.1.0” version and new table (Table2) is created in the database.
OK.
Then I want a rollback to “v.0.0.0” version and I call liquibase as follows:
liquibase --driver=com.microsoft.sqlserver.jdbc.SQLServerDriver --url=“jdbc:sqlserver:…” --changeLogFile="…\changesets.yaml" rollback v.0.0.0
But what I see in the console?
Starting Liquibase at Thu, 18 Oct 2018 11:49:11 MSK (version 3.6.2 built at 2018-07-03 11:28:09)
Rolling Back Changeset:d:/…/changesets.yaml::1::idm
Rolling Back Changeset:d:/…/changesets.yaml::tag-0::idm
Liquibase: Rollback has been successful.
Wow. “v.0.0.0” version is under rollback too. Why?
And there is no records in dbo.DATABASECHANGELOG.
BUT dbo.Table2 exists as nothing happened! OMFG!!! Why?
Please, say me - what is wrong with my settings in yaml format?
Thank you.