我正在尝试使用 liquibase 来更改我的数据库的布局,但是我有一个问题是:
例如,我的旧数据库有一个表,它有 2 列(名字、姓氏),但我的新数据库只有一列用于这两个(用户名)。
我如何使用 liquibase 和 Spring 进行此迁移。因为按照以下逻辑,我会丢失原始值。
理想情况下,我希望能够调用我的 java 代码来进行更改,尽管在这种情况下它在其他情况下可能需要过度工程;)
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.1
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.1.xsd">
<changeSet author="gcardoso" id="2012082703">
<dropColumn columnName="firstName" tableName="t_user"/>
<dropColumn columnName="lastName" tableName="t_user"/>
?????? How to migrate the names ??????
<addColumn tableName="t_user">
<column name="userName" type="VARCHAR2(255,0)">
<constraints nullable="false"/>
</column>
</addColumn>
</changeSet>
</databaseChangeLog>