Update Goal for non existent context

hi @aditi @MikeOlivas

quick question for you.
i have a changeset
<changeset author="name" context ="test" label="label1".....>

now when i execute
liquibase updateSQL --context="test" --label="label1"
it runs fine and generates the liquibase SQL files just fine. and. generates file label1-test.sql ( i have given liquibase file name to be like label-context.sql)

But when i execute
liquibase updateSQL --context="absurd" label="label1"
it generates file with name label1-absurd.sql

is there a way I can ask liquibase to not generate the file if the mentioned context does not exist in the changeset?

it generates a file with name

any update? @MikeOlivas

in the second command, you don’t have the – before the label. Does it persist if you add that? Also, can you make sure you’re copying/pasting directly from the command line and using the code block formatting? It makes it easier for folks to parse the information and review for typos and other small syntax errors.

sure
eg
i execute following maven command s

  1. mvn clean install -Dgoal=futureRollbackSQL -Dcontext=naprod -Dlabel=CES-1271 -P WEB_REPORTING

  2. mvn clean install -Dgoal=futureRollbackSQL -Dcontext=emeaprod -Dlabel=CES-1271 -P WEB_REPORTING

now in changesets. I don’t have any changeset for "naprod" context. but I do have for "emeaprod".

But my Jenkins job will always both commands, I want liquibase to NOT generate any file(even empty) in command #1. is it possible?

@tabbyfoo any update?

1 Like

Hi @Pooja

I’m working on getting an answer for you. I’ll update when I have something. Thanks for your patience!

Hi @tabbyfoo how to add tags to a forum topic ?
Please check my question Springboot liquibase 'relation "databasechangeloglock" already exists' issue

@Pooja updatesql does not create a filename, so not sure where you are getting this file from.
updatesql will always produce output. Whether it is just locking the table and then unlocking the table. updatesql will show you the sql that it will run on the database as if you were running liquibase update directly.

Hi @ramk - Thanks for reaching out. These forums are community supported, so it often takes a week or longer to get an answer to your question, as most of the folks sharing their knowledge are volunteers helping out on this Open Source project. I’ll take a look at that question, but please keep your replies relevant to the post you are responding to.