How to rename changelog files in Liquibase?

Hi!
I’m using Liquibase for my project and would like to rename my changelog files.

From old structure:

databaseChangeLog:
    - include:
        file: db/changelog/add_pokemons.sql
    - include:
        file: db/changelog/add_minions.sql

To new structure:

databaseChangeLog:
    - include:
        file: db/changelog/v001__add_table_pokemons.sql
    - include:
        file: db/changelog/v002__add_table_minions.sql

The Liquibase documentation unfortunately does not state best practices for such intention.

What would be the best approach in your opinion?

Thanks!

If you change the filename of a changelog, and assuming the changelog contains a changeset that has already been executed, you will need to update the databasechangelog.filename for the changeset in each database where the changeset has been executed.

1 Like