I try to update existing DB with luquibase Java API in this way:
Database database = DatabaseFactory.getInstance()
.findCorrectDatabaseImplementation(
new JdbcConnection( connection )
);
Liquibase liquibase = new Liquibase(
"db.changelog.xml",
new FileSystemResourceAccessor(),
database
);
liquibase.update( "" );
But it tries to apply all change sets including those which have been already applied earlier. What do I do wrong?
The code looks correct, my guess is that you have a different classpath than when you ran it before. Liquibase identifies each changeset with an id+author+filepath combination, so if you are currently referencing db.changelog.xml as "db.changelog.xml" but previously used "output/db.changelog.xml" or "com/example/db.changelog.xml" it will see it as different.
If you "select * from databasechangelog" you will see what is stored as the path for each changeSet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With