Giter VIP home page Giter VIP logo

Comments (9)

SteveDonie avatar SteveDonie commented on May 20, 2024

Would you mind adding one more thing to this? After running an update with Ant, show the results of running select * from DATABASECHANGELOG, and then do the same thing after running an update from the command line. I suspect that the issue is that the filename column in each will be slightly different, and that is what the underlying issue is.

from liquibase.

MaxAller avatar MaxAller commented on May 20, 2024

I was close to resolving this issue because I couldn't repro anymore, but actually I can now after rolling back some of my changes.

If you have a db.changelog-master.xml file that includes another file, that works in both cases. However, if all your changesets are instead direcly in db.changelog-master.xml, that doesn't work. (With the tools consuming db.changelog-master.xml in both cases, obviously).


Now for what you asked for, when only using a single changelog file:

State when running with Ant first:

   id    | author |                                                 filename                                                  |        dateexecuted        | orderexecuted | exectype |               md5sum               |                                                 description                                                 | comments | tag | liquibase | contexts | labels | deployment_id 
---------+--------+-----------------------------------------------------------------------------------------------------------+----------------------------+---------------+----------+------------------------------------+-------------------------------------------------------------------------------------------------------------+----------+-----+-----------+----------+--------+---------------
 initial | aller  | /workplace/<full path to my project>/schema/db.changelog-master.xml | 2020-03-23 16:32:06.647243 |             1 | EXECUTED | 8:4af49915b417de20e16855073c2569f0 | createTable tableName=<snip>; createIndex indexName=<snip>, tableName=<snip> |          |     | 3.8.8     |          |        | 4981126588
(1 row)

CLI:

   id    | author |            filename            |        dateexecuted        | orderexecuted | exectype |               md5sum               |                                                 description                                                 | comments | tag | liquibase | contexts | labels | deployment_id 
---------+--------+--------------------------------+----------------------------+---------------+----------+------------------------------------+-------------------------------------------------------------------------------------------------------------+----------+-----+-----------+----------+--------+---------------
 initial | aller  | schema/db.changelog-master.xml | 2020-03-23 16:33:50.881025 |             1 | EXECUTED | 8:4af49915b417de20e16855073c2569f0 | createTable tableName=<snip>; createIndex indexName=<snip>, tableName=<snip> |          |     | 3.8.8     |          |        | 4981230827

Indeed, your guess was correct. In my Ant invocation, the path is an absolute path. In every other case, it's a relative path.

I was thinking LiquiBase should always convert the path to absolute, but that wouldn't be portable across different systems, right? So...is this anything more than a convoluted user error?

from liquibase.

MaxAller avatar MaxAller commented on May 20, 2024

Er, actually I'd assumed that I was the one passing an absolute path into Ant, but in fact either Ant or the LiquiBase task is converting my relative path into an absolute path.

The workaround is not to put changesets directly in that file.

from liquibase.

SteveDonie avatar SteveDonie commented on May 20, 2024

Yeah, I think that is something we should look into with Ant. Seems to me like it should be using the relative path.
The other "workaround" is to actually specify the changelog path in the changelog itself.

There is an attribute you can put at the root of a changelog file named logicalFilePath that you can set. You might set yours to schema/db.changelog-master.xml and then it should work in both cases.

from liquibase.

MaxAller avatar MaxAller commented on May 20, 2024

Cool, I'll give that logicalFilePath thing a try.

As for next steps, it's up to you. As a user, this is surprising and frustrating behavior 😅

from liquibase.

molivasdat avatar molivasdat commented on May 20, 2024

Hi @MaxAller. Did Steve's suggestion of using logicalFilePath work for you?

from liquibase.

mattbertolini avatar mattbertolini commented on May 20, 2024

I recreated the issue described and solved it by changing the following line:

<property name="db.changelog" location="schema/db.changelog-master.xml" />

to:

<property name="db.changelog" value="schema/db.changelog-master.xml" />

This is because the location attribute of <property> will make an absolute path based on the ant project base directory (defined in the basedir attribute of the <project>. It sounds like the changeLogFile attribute is designed to be a relative path so to keep consistency with the CLI, making it a standard value will do that.

It might be a good idea to document that the ant task changeLogFile attribute should be a relative path so that others don't encounter this issue. If they need full paths they should leverage the changeLogDirectory attribute as well.

Hope this helps.

from liquibase.

molivasdat avatar molivasdat commented on May 20, 2024

Hi @MaxAller Did @mattbertolini 's suggestion work for you? If so, I'll make sure that the documentation gets updated appropriately. @mccormickc

from liquibase.

ro-rah avatar ro-rah commented on May 20, 2024

We should close this issue once we have a doc ticket.

from liquibase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.