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.
I was thinking about duplicating my files so I have the old ones plus new ones in one directory and then write a migration to change column filename
in the databasechangelog
table.
What would be the best approach in your opinion?
The problem here is that liquibase holds the name of file inside databasechangelog.filename
. So if you are not using logicalFilePath yet maybe you have a chance.
If those files you've posted are formatted sql files then you could do something like this (example for file db/changelog/add_pokemons.sql
):
--liquibase formatted sql logicalFilePath:db/changelog/add_pokemons.sql
and you can rename the actual file to whatever you want.
In that case nothing should be broken inside existing databasechangelog table.
Other than that there is probably no available change that will do that automatically from liquibase.