1
votes

I have liquibase formatted sql file containing following changesets in which sql queries are being commented out

--liquibase formatted sql

--changeset harv:1
--comment test
--update table set col=null;

--changeset harv:2
--comment test
--update table set col1=null;

when I run liquibase on oracle database theses queries are not being executed since I commented them but entries are being made into databasechangelog table that these changesets are executed.

Is this the proper way to comment sql queries? If it is why is liquibase making entries in databasechangelog table marking these changesets as executed?

1

1 Answers

3
votes

Liquibase reads the information for your changesets in sql files from the comments like in:

--changeset harv:1

So when parsing your file it finds this line and creates a changeset "harv:1". Then, since you have commented out the actual sql the changeset will be empty. But it is still a changeset. When it executes all changesets it will also execute "harv:1" but there is no sql in it so nothing happens. Still it will mark this changeset as executed.

I have not verified this, by actually executing examples to proof this. It's just my theory of what might happen.