Liquibase Generated files

Hi @MikeOlivas @aditi

I am working on a requirement, where i need to generate files with specific names.
SO i have written a SQL parser to parse the changeset and append jira id with the filename.

But problem is, whenever i run liquibase , it overrides the very first file ( if there is no change) and makes it blank.
can i avoid it? it should not override already generated file if there is no change detected.

Hi @Pooja Can you give a little more context when you same that Liquibase overrides the very first file?
I don’t know the scenario where liquibase updates the changeset directly.


here is the scenario

  1. i added a new changeset GNA-1234.xml
    Ran liquibase --updateSQL goal,
    it created liquibase file for this changeset in target dir, perfectly fine. my program then pushes it to GIT

  2. in iteration 2, i added a new chanegset
    ran --updateSQL goal,
    liquibase file for GNA-4567.xml and pushes it to git.
    but it also updates liquibase file for GNA-1234.xml and makes it blank this time ( coz nothing was changes in this xml).
    how can ask liquuibase to not update GNA-1234 generated file if its not changed?

@MikeOlivas any update

Hi @Pooja . From what I can tell, you are trying to rewrite the changelog for its original intent and creating your own changlog using just the sql output of an updateSQL command.
The updateSQL command is meant to show what liquibase would do against a database if run at that point in time.
So it makes sense that a previously executed change has already been run against the database when you run updateSQL because it no longer needs to the run the previous one from iteration 1.
If it has not run against the database in question then it should have both GNA-1234 and GNA-4567 to execute.
I would suggest using quality checks instead of rewriting the files to make sure that a JIRA ticket is added to the label of the changeset(s) that are fixing or addressing that JIRA ticket as an alternative option. This way it gets caught much earlier in the cycle and you are not having to rewrite changesets.