tlberglund / groovy-liquibase

Yet Another Groovy DSL for Liquibase
Other
85 stars 66 forks source link

Windows: saves wrong file location in DB #12

Closed ErwinvanBrandwijk closed 13 years ago

ErwinvanBrandwijk commented 13 years ago

My colleague is using Windows. He did a build with gradle and had 1 test error about \ \ . That isn't a big problem. He ran the changeset located in changelogs\changelog.groovy But when you look in the database it deletes . So = changelogschangelog.groovy

INFO 15-3-11 16:46:liquibase: ChangeSet changelogs\changelog_1.groovy::1::erwin ran successfully in 194ms

| 1 | erwin | changelogschangelog_1.groovy | 2011-03-15 16:46:16 |

This is really annoying I'm stuck at this point. Rollback won't work because the path.

tlberglund commented 13 years ago

Could you post a snippet of the changelog, or if you're able, just share the whole changelog as a Gist? If intellectual property concerns prevent you from sharing the whole thing, maybe just the part with the path in question would be helpful.

ErwinvanBrandwijk commented 13 years ago

The changelog isn't important for this bug.

In DATABASECHANGELOG it saves FILENAME, that contains the path and name of the changelog.

Example: I run changelog.groovy databaseChangelog() { include(path: "changelogs") }

changelog_1.groovy in map changelogs\ (changelogs\changelog.groovy) databaseChangelog() { ..... }

Now when you use liquibase core on windows it replaces \ for / and saves it in the database: | 1 | erwin | changelogs\changelog_1.xml | 2011-03-15 16:46:16 |

With your plugin it won't replace \ for / but just deletes it. So result in database:

   | 1 | erwin | changelogschangelog_1.groovy | 2011-03-15 16:46:16 |

The big problem is that you can't make a rollback because path isn't correct.

(I think something in the parser of liquibase core replaces \ for /. I'm gonna take a look at it today)

tlberglund commented 13 years ago

I am still unable to duplicate this. Could you create example changelogs and post them to the issue? Be sure to note what directory each is in (as you did in your description here). I realize this is a pain, but I need to be sure I understand the problem first!

ErwinvanBrandwijk commented 13 years ago

SOLVED

Add this line of code to GroovyLiquibaseChangelogParser

physicalChangeLogLocation = physicalChangeLogLocation.replaceAll("\\\\", "/")

See my fork. Closing if it is adopted in master

tlberglund commented 13 years ago

Committed to master. Give it a spin, and close it if you agree that it works.

ErwinvanBrandwijk commented 13 years ago

It is working, closing