updateTestingRollback not rolling back

I am following Activity 8: Testing a Rollback Liquibase University

I followed the steps for updateTestingRollback, but Liquibase is not rolling back as expected. Why would it not rollback? Any idea?

/usr/local/Cellar/liquibase/4.3.5/liquibase --changeLogFile=dbchangeloga8.sql --logLevel=info updateTestingRollback
[2021-07-09 14:59:57] INFO [liquibase.integration] No Liquibase Pro license key supplied. Please set liquibaseProLicenseKey on command line or in liquibase.properties to use Liquibase Pro features.
Liquibase Community 4.3.5 by Datical
####################################################
##   _     _             _ _                      ##
##  | |   (_)           (_) |                     ##
##  | |    _  __ _ _   _ _| |__   __ _ ___  ___   ##
##  | |   | |/ _` | | | | | '_ \ / _` / __|/ _ \  ##
##  | |___| | (_| | |_| | | |_) | (_| \__ \  __/  ##
##  \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___|  ##
##              | |                               ##
##              |_|                               ##
##                                                ##
##  Get documentation at docs.liquibase.com       ##
##  Get certified courses at learn.liquibase.com  ##
##  Free schema change activity reports at        ##
##      https://hub.liquibase.com                 ##
##                                                ##
####################################################
Starting Liquibase at 14:59:57 (version 4.3.5 #62 built at 2021-04-29 18:31+0000)
[2021-07-09 15:00:04] INFO [liquibase.lockservice] Successfully acquired change log lock
[2021-07-09 15:00:12] INFO [liquibase.changelog] Reading from predict.DATABASECHANGELOG
[2021-07-09 15:00:13] INFO [liquibase.changelog] Custom SQL executed
[2021-07-09 15:00:13] INFO [liquibase.changelog] ChangeSet dbchangeloga8.sql::a8b.1::activity.8 ran successfully in 541ms
[2021-07-09 15:00:14] INFO [liquibase.changelog] Custom SQL executed
[2021-07-09 15:00:14] INFO [liquibase.changelog] ChangeSet dbchangeloga8.sql::a8b.2::activity.8 ran successfully in 530ms
[2021-07-09 15:00:16] INFO [liquibase.lockservice] Successfully released change log lock
[2021-07-09 15:00:17] INFO [liquibase.lockservice] Successfully acquired change log lock
[2021-07-09 15:00:25] INFO [liquibase.changelog] Reading from predict.DATABASECHANGELOG
[2021-07-09 15:00:26] INFO [liquibase.lockservice] Successfully released change log lock
[2021-07-09 15:00:28] INFO [liquibase.lockservice] Successfully acquired change log lock
[2021-07-09 15:00:35] INFO [liquibase.changelog] Reading from predict.DATABASECHANGELOG
[2021-07-09 15:00:36] INFO [liquibase.lockservice] Successfully released change log lock
Liquibase command 'updateTestingRollback' was executed successfully.

Can you show us the content of dbchangeloga8.sql?

Yup. No problem. I copy and pasted straight from the tutorial.

cat dbchangeloga8.sql
-- liquibase formatted sql

-- changeset activity.8:a8b.1
create table person_a8b (
    id int primary key,
    name varchar(50) not null,
    address1 varchar(50),
    address2 varchar(50),
    city varchar(30)
)
-- rollback drop table person_a8b

-- changeset activity.8:a8b.2
create table company_a8b (
    id int primary key,
    name varchar(50) not null,
    address1 varchar(50),
    address2 varchar(50),
    city varchar(30)
)
-- rollback drop table company_a8b

I am using a different version of Liquibase (3.10.2), but I was able to use your exact files and run updateTestingRollback successfully.

Why do you think it’s not rolling-back?

The tables still exist and there is no mention of rollback in the output. If it were rolling back, it should contain output like this:

Rolling Back Changeset:dbchangeloga8.sql::a8b.2::activity.8
Rolling Back Changeset:dbchangeloga8.sql::a8b.1::activity.8

The tables will exist after updateTestingRollback has completed. It does three steps:

  1. run update for all pending changesets
  2. run rollback for the pending changesets
  3. run update again for the pending changesets

This ensures that the rollback works and the changesets can be applied again.

Can you confirm that the changesets were not already applied before you ran updateTestingRollback? I got the same results as you when they were already applied.

More details found here:
https://docs.liquibase.com/commands/community/updatetestingrollback.html