javaweb
javaweb copied to clipboard
数据库持续集成liquibase
官网 http://www.liquibase.org/index.html https://github.com/liquibase/liquibase
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.7"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.7
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.7.xsd">
<changeSet id="quartz_tables_mysql" author="absurd" dbms="mysql">
<sqlFile encoding="utf8"
path="db/sql/quartz_tables_mysql.sql"
splitStatements="true"
stripComments="true"/>
</changeSet>
<!-- <changeSet id="quartz_tables_h2" author="absurd" dbms="h2">
<sqlFile encoding="utf8"
path="db/sql/quartz_tables_h2.sql"
splitStatements="true"
stripComments="true"/>
</changeSet>-->
</databaseChangeLog>
@Configuration
public class LiquibaseConfig {
@Autowired
private DataSource dataSource;
@Bean
public liquibase.integration.spring.SpringLiquibase springLiquibase() throws LiquibaseException {
liquibase.integration.spring.SpringLiquibase liquibase = new liquibase.integration.spring.SpringLiquibase();
liquibase.setChangeLog("classpath:db/db.changelog-master.xml");
liquibase.setDataSource(dataSource);
liquibase.setShouldRun(true);
liquibase.setDropFirst(false);
return liquibase;
}
}
#liquibase.change-log=classpath:db/db.changelog-master.xml
#liquibase.enabled=true
#liquibase.check-change-log-location=true # Check the change log location exists.
#liquibase.contexts= # Comma-separated list of runtime contexts to use.
#liquibase.default-schema= # Default database schema.
#liquibase.drop-first=false # Drop the database schema first.
#liquibase.labels= # Comma-separated list of runtime labels to use.
#liquibase.parameters.*= # Change log parameters.
#liquibase.password= # Login password of the database to migrate.
#liquibase.rollback-file= # File to which rollback SQL will be written when an update is performed.
#liquibase.url=jdbc:h2:mem:test # JDBC url of the database to migrate. If not set, the primary configured data source is used.
#liquibase.user=sa # Login user of the database to migrate.
http://blog.csdn.net/jianyi7659/article/details/7804144
http://www.xuebuyuan.com/45332.html