LogLevel did not give me much information as to why the generate SQL for the rollback worked and the actual run of the SQL through liquibase jar file failed.
I can connect to all the databases in dev, qa, stg, etc. and generate the SQL, just not run it through the command line.
This is what I ran on behalf of our developer who created the XML file (with the identifying information changed for file and output)
Any ideas or pointers to figure out root cause for failure on execution, or a work around is greatly appreciated.
I can take the SQL and run it interactively. I’d like to understand why it failed and see if we can fix/avoid this behavior in the future.
Thanks in advance for any help you can lend.
Best regards,
Heidi Schmidt
[user@server V1.0.0.2]$ java -jar ${CLASSPATH}/liquibase.jar --classpath=${CLASSPATH}/mysql-connector-java-5.1.18-bin.jar --url=jdbc:mysql://hostname/DataBase --driver=com.mysql.jdbc.Driver --username=admin_user --password=REDACTED --changeLogFile=alter_type_column.xml rollbackSQL V1.0.0.1 --logLevel=severe
INFO 2/20/13 9:38 AM:liquibase: Successfully acquired change log lock
INFO 2/20/13 9:38 AM:liquibase: Reading from DATABASECHANGELOG
WARNING 2/20/13 9:38 AM:liquibase: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
WARNING 2/20/13 9:38 AM:liquibase: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
INFO 2/20/13 9:38 AM:liquibase: Rolling Back Changeset:alter_type_column.xml::11-4::developer::(Checksum: 3:b38d3d54164c233d2566ee3e067cf533)
INFO 2/20/13 9:38 AM:liquibase: Rolling Back Changeset:alter_type_column.xml::11-3::developer::(Checksum: 3:7096b272f33229b2b11666328d4bdcea)
INFO 2/20/13 9:38 AM:liquibase: Rolling Back Changeset:alter_type_column.xml::11-2::developer::(Checksum: 3:a8d7fed1a718164766b4bb7361a36ea1)
INFO 2/20/13 9:38 AM:liquibase: Rolling Back Changeset:alter_type_column.xml::11-1::developer::(Checksum: 3:0259ec2c121a012be455715b99d222da)
INFO 2/20/13 9:38 AM:liquibase: Successfully released change log lock
– *********************************************************************
– Rollback to ‘V1.0.0.1’ Script
– *********************************************************************
– Change Log: alter_type_column.xml
– Ran at: 2/20/13 9:38 AM
– Against: admin_user@10.20.97.96@jdbc:mysql://hostname/DataBase
– Liquibase version: 2.0.2
– *********************************************************************
– Lock Database
– Rolling Back ChangeSet: alter_type_column.xml::11-4::developer::(Checksum: 3:b38d3d54164c233d2566ee3e067cf533)
DELETE FROM DATABASECHANGELOG
WHERE ID=‘11-4’ AND AUTHOR=‘developer’ AND FILENAME=‘alter_type_column.xml’;
– Rolling Back ChangeSet: alter_type_column.xml::11-3::developer::(Checksum: 3:7096b272f33229b2b11666328d4bdcea)
ALTER TABLE test_table
MODIFY col1
set(‘logo’,‘logo@2x’,‘icon’,‘icon@2x’,‘thumbnail’,‘thumbnail@2x’,‘strip’,‘strip@2x’,‘background’);
DELETE FROM DATABASECHANGELOG
WHERE ID=‘11-3’ AND AUTHOR=‘developer’ AND FILENAME=‘alter_type_column.xml’;
– Rolling Back ChangeSet: alter_type_column.xml::11-2::developer::(Checksum: 3:a8d7fed1a718164766b4bb7361a36ea1)
UPDATE test_table
SET col1
= ‘background’ WHERE col1=‘strip’;
DELETE FROM DATABASECHANGELOG
WHERE ID=‘11-2’ AND AUTHOR=‘developer’ AND FILENAME=‘alter_type_column.xml’;
– Rolling Back ChangeSet: alter_type_column.xml::11-1::developer::(Checksum: 3:0259ec2c121a012be455715b99d222da)
ALTER TABLE test_table
MODIFY col1
set(‘logo’,‘icon’,‘thumbnail’,‘background’);
DELETE FROM DATABASECHANGELOG
WHERE ID=‘11-1’ AND AUTHOR=‘developer’ AND FILENAME=‘alter_type_column.xml’;
– Release Database Lock
[user@server V1.0.0.2]$ java -jar ${CLASSPATH}/liquibase.jar --classpath=${CLASSPATH}/mysql-connector-java-5.1.18-bin.jar --url=jdbc:mysql://hostname/DataBase --driver=com.mysql.jdbc.Driver --username=admin_user --password=REDACTED --changeLogFile=alter_type_column.xml rollback V1.0.0.1
INFO 2/20/13 9:38 AM:liquibase: Successfully acquired change log lock
INFO 2/20/13 9:38 AM:liquibase: Reading from DATABASECHANGELOG
WARNING 2/20/13 9:38 AM:liquibase: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
WARNING 2/20/13 9:38 AM:liquibase: modifyDataType will lose primary key/autoincrement/not null settings for mysql. Use and re-specify all configuration if this is the case
INFO 2/20/13 9:38 AM:liquibase: Rolling Back Changeset:alter_type_column.xml::11-4::developer::(Checksum: 3:b38d3d54164c233d2566ee3e067cf533)
INFO 2/20/13 9:38 AM:liquibase: Rolling Back Changeset:alter_type_column.xml::11-3::developer::(Checksum: 3:7096b272f33229b2b11666328d4bdcea)
INFO 2/20/13 9:38 AM:liquibase: Rolling Back Changeset:alter_type_column.xml::11-2::developer::(Checksum: 3:a8d7fed1a718164766b4bb7361a36ea1)
INFO 2/20/13 9:38 AM:liquibase: Rolling Back Changeset:alter_type_column.xml::11-1::developer::(Checksum: 3:0259ec2c121a012be455715b99d222da)
INFO 2/20/13 9:38 AM:liquibase: Successfully released change log lock
Liquibase Update Failed: Error executing custom SQL [liquibase.statement.core.ModifyDataTypeStatement@2d1e233]
SEVERE 2/20/13 9:38 AM:liquibase: Error executing custom SQL [liquibase.statement.core.ModifyDataTypeStatement@2d1e233]
liquibase.exception.RollbackFailedException: liquibase.exception.RollbackFailedException: Error executing custom SQL [liquibase.statement.core.ModifyDataTypeStatement@2d1e233]
at liquibase.changelog.ChangeSet.rollback(ChangeSet.java:401)
at liquibase.changelog.visitor.RollbackVisitor.visit(RollbackVisitor.java:23)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58)
at liquibase.Liquibase.rollback(Liquibase.java:298)
at liquibase.integration.commandline.Main.doMigration(Main.java:798)
at liquibase.integration.commandline.Main.main(Main.java:133)
Caused by: liquibase.exception.RollbackFailedException: Error executing custom SQL [liquibase.statement.core.ModifyDataTypeStatement@2d1e233]
at liquibase.changelog.ChangeSet.rollback(ChangeSet.java:379)
… 5 more
Caused by: liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE test_table
MODIFY col1
set(‘logo’,‘icon’,‘thumbnail’,‘background’): Data truncated for column ‘type’ at row 11
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:104)
at liquibase.changelog.ChangeSet.rollback(ChangeSet.java:377)
… 5 more
Caused by: java.sql.SQLException: Data truncated for column ‘type’ at row 11
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2618)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:842)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:681)
at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:92)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
… 7 more
For more information, use the --logLevel flag)