I want to add a migration to my Spring-Boot project. In this migration I intend to add a column to all the tables which name contains some suffix. I will leave an example below:
In my database I have this two tables saft_2020_1_111_nc_generalledgerentriestotals
and saft_2017_2_112_nc_generalledgerentriestotals
and their names both end in generalledgerentriestotals
.
Is there any way I can make my migration add the column to both the tables?
I am using liquibase to manage the migrations and my database is MySQL.
I tried this way but an exception was thrown because there is no table with that name
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
<changeSet author="fabio" id="changelog-4.0">
<addColumn tableName="*_generalledgerentriestotals">
<column name="multiple_added" type="varchar(255)"/>
</addColumn>
<rollback>
<dropColumn tableName="*_generalledgerentriestotals">
<column name="multiple_added" type="varchar(255)"/>
</dropColumn>
</rollback>
</changeSet>
</databaseChangeLog>