RollbackToDate Command

Noob question regarding command line syntax for the RollbackToDate(SQL) command. I keep getting the error that the date needs to be in the format of ‘yyyy-MM-dd HH:mm:ss’ which I have been supplying ‘2009-07-21 14:25:00’ and it does not seem to like this format.

It is trying to apply the change against a MSSQL server (if it matters). Anyone had any experience with this and found this works with a different date format or am I truly a noob an missing something simple.

I’ve been able to do updates and rollbackCount without issue and would like to use the Date option for certain rollbacks.

Thanks.
K

That seems right off hand.  Are you getting any errors?  What do you get if you include a --logLevel=finest flag?

Nathan

The only error is the “Migration Failed: Unexpected date/time format. Use ‘yyyy-MM-dd HH:mm:ss’” that is returned when I execute the command. This is printed even if I use your suggestion adding the --logLevel=finest.

The command:

liquibase.bat --changeLogFile=“c:\some\directory\structure\changelog.xml” --url=“jdbc:sqlserver://localhost\sqlInstance;databaseName=DBName;integratedSecurity=true;” --classpath=“c:\path\to\sqllib\sqljdbc4.jar” --contexts=default RollbackToDateSQL ‘2009-07-21 14:00:00’ --logLevel=finest

I haven’t had any issues with this command line doing an UpdateSQL or even a RollbackCountSQL so it wouldn’t seem to me to be an issue with syntax.

The version I’m running is 1.9.3.

I appreciate the original response as I hadn’t thought of (or realized I could…) increasing the logging level. Other thoughts that may help would be greatly appreciated.

Thanks.

It may be an issue with using ’ marks around the date.  Try using " marks instead.  That seemed to fix it for me.

Nathan

Thanks for pointing out the alternative… I’d tried other date formats but didn’t think of the alternative for quotes.

That works now.

Thanks for your time!

Originally posted by: Nathan
It may be an issue with using ' marks around the date.  Try using " marks instead.  That seemed to fix it for me.

Nathan

I’ve been trying that out and nothing seems to work for me…
I’ve tried with single, double and even no quotes…

If it helps i’m running v1.9.5 under Ubuntu 9.10.

My commands:

    ./liquibase --changeLogFile=/path/to/changelog/changelog.xml rollbackToDate 2010-03-08 00:00:00 ./liquibase --changeLogFile=/path/to/changelog/changelog.xml rollbackToDate "2010-03-08 00:00:00" ./liquibase --changeLogFile=/path/to/changelog/changelog.xml rollbackToDate '2010-03-08 00:00:00'

The output i’m getting is always the same:

      Migration Failed: Unexpected date/time format.  Use 'yyyy-MM-dd HH:mm:ss' 

Any help would be really appreciate it!
Thanks,


Ing. Yenny Villalba

Hello,

I would like to be helped regarding this command.

Sorry for my bad English, I am from Argentina.

I am running the following in the command line of a Linux System against an Oracle 10g Databse:

java -jar liquibase.jar --changeLogFile insert5.xml rollbackToDate “2013-05-13T14:31:34”

The output messages on screen are:

INFO 5/15/13 5:00 PM:liquibase: Successfully acquired change log lock
INFO 5/15/13 5:00 PM:liquibase: Reading from DATABASECHANGELOG
INFO 5/15/13 5:00 PM:liquibase: Successfully released change log lock
Liquibase Rollback Successful

But when I inspect the database, I don’t find any rollback on my “department” table, which is the table I am using to learn liquibase.

I made many inserts with liquibase, and I could rollback with "rollback ", by previously adding tags to the several states the database acquired, as the time and the operations went by.

 

For me, it is very important to be able to rollback the database to a specific time.

Thanks in advance,

Enrique