Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 2993

How to specify rollback in YAML changelog file?

$
0
0
I can't find in the documentation the right syntax to declare rollback statements using YAML, so I tried the following but it doesn't work.
  1. databaseChangeLog:
  2.   - changeSet:
  3.       id: 1
  4.       author: foobar
  5.       changes:
  6.         - createTable:
  7.             tableName: users
  8.             columns:
  9.               - column:
  10.                   name: id
  11.                   type: int
  12.                   autoIncrement: true
  13.                   constraints:
  14.                     primaryKey: true
  15.                     nullable: false
  16.               - column:
  17.                   name: name
  18.                   type: varchar(50)
  19.                   constraints:
  20.                     nullable: false
  21.               - column:
  22.                   name: email
  23.                   type: varchar(50)
  24.                   constraints:
  25.                     nullable: false
  26.   - changeSet:
  27.       id: 2
  28.       author: foobar
  29.       changes:
  30.         - insert:
  31.             tableName: users
  32.             columns:
  33.               - column:
  34.                   name: name
  35.                   value: John Brown
  36.               - column:
  37.                   name: email
  38.                   value: john@example.com
  39.       rollback:
  40.         - sql:
  41.             sql: TRUNCATE TABLE users;

When I execute the command
  1. liquibase --changeLogFile=input.yaml update
it's allright
  1. Liquibase Update Successful
but if I try to rollback
  1. liquibase --changeLogFile=input.yaml rollbackCountSql 1
I get an error
  1. Liquibase rollbackCountSql Failed: liquibase.exception.RollbackImpossibleException: No inverse to liquibase.change.core.InsertDataChange created

Anyone can help me?
Thank you.

Viewing all articles
Browse latest Browse all 2993

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>