【发布时间】:2019-02-21 22:13:36
【问题描述】:
我正在尝试将 liquibase 集成到具有现有数据库 (PostgreSQL) 的现有项目中。
当我尝试启动系统时,我没有看到 liquibase 尝试执行任何操作。
这是数据源 bean:
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url.intguard}" />
<property name="username" value="${jdbc.username.intguard}" />
<property name="password" value="${jdbc.password.intguard}" />
</bean>
LiquibaseCofing:
@ContextConfiguration
public class LiquibaseConfig {
@Autowired
private DataSource dataSource;
@Bean
public SpringLiquibase liquibase() {
SpringLiquibase liquibase = new SpringLiquibase();
liquibase.setChangeLog("classpath:/database/changelog.xml");
liquibase.setDataSource(dataSource);
return liquibase;
}
}
liquibase-changelog.xml:
<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.1.xsd">
<changeSet author="John" id="someUniqueId">
<addColumn tableName="users">
<column name="address" type="varchar(255)" />
</addColumn>
</changeSet>
</databaseChangeLog>
我知道系统启动时正在调用 LiquibaseConfig bean, 请帮我抓住我错过的东西, 谢谢。
【问题讨论】: