spring boot 配置liquibase
来源:互联网 发布:本泽马 fifa16数据 编辑:程序博客网 时间:2024/05/17 01:13
java
@Bean public SpringLiquibase liquibase(DataSource dataSource) { SpringLiquibase liquibase = new SpringLiquibase(); liquibase.setDataSource(dataSource); liquibase.setChangeLog("classpath:config/liquibase/master.xml"); liquibase.setContexts("development,test,production"); if (env.acceptsProfiles(Constants.SPRING_PROFILE_FAST)) { if ("org.h2.jdbcx.JdbcDataSource".equals(propertyResolver.getProperty("dataSourceClassName"))) { liquibase.setShouldRun(true); log.warn("Using '{}' profile with H2 database in memory is not optimal, you should consider switching to" + " MySQL or Postgresql to avoid rebuilding your database upon each start.", Constants.SPRING_PROFILE_FAST); } else { liquibase.setShouldRun(false); } } else { log.debug("Configuring Liquibase"); } return liquibase; }
pom
<dependency> <groupId>org.liquibase</groupId> <artifactId>liquibase-core</artifactId> <version>3.3.2</version> </dependency>
master.xml
<?xml version="1.0" encoding="utf-8"?><databaseChangeLog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> <include file="classpath:config/liquibase/changelog/20150906161010_add_entity_Base.xml" relativeToChangelogFile="false"/></databaseChangeLog>
<?xml version="1.0" encoding="utf-8"?><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"> <property name="now" value="now()" dbms="mysql,h2"/> <property name="now" value="current_timestamp" dbms="postgresql"/> <property name="now" value="sysdate" dbms="oracle"/> <!-- 课程章节表 --> <changeSet id="20150910102000" author="WATER"> <preConditions onFail="MARK_RAN"> <not> <tableExists tableName="DLEDU_CHAPTER"/> </not> </preConditions> <createTable tableName="DLEDU_CHAPTER"> <column name="id" type="bigint" autoIncrement="true"> <constraints primaryKey="true" nullable="false"/> </column> <column name="name" type="varchar(50)"> <constraints nullable="false" /> </column> <column name="introduce" type="varchar(255)"> <constraints nullable="false" /> </column> <column name="parent_id" type="bigint"/> <column name="content" type="varchar(40)"/> <column name="status" type="varchar(10)"/> <column name="course_id" type="bigint"> <constraints nullable="false"/> </column> <column name="created_by" type="varchar(50)"> <constraints nullable="false"/> </column> <column name="created_date" type="timestamp" defaultValueDate="${now}"> <constraints nullable="false"/> </column> <column name="last_modified_by" type="varchar(50)"/> <column name="last_modified_date" type="timestamp"/> </createTable> <addForeignKeyConstraint baseColumnNames="course_id" baseTableName="DLEDU_CHAPTER" constraintName="fk_chapter_course_id" referencedColumnNames="id" referencedTableName="DLEDU_COURSE"/> <addForeignKeyConstraint baseColumnNames="content" baseTableName="DLEDU_CHAPTER" constraintName="fk_chapter_content" referencedColumnNames="id" referencedTableName="DLEDU_FILE"/> </changeSet></databaseChangeLog>
0 0
- spring boot 配置liquibase
- LiquiBase概述及(spring boot 入门配置)
- spring boot+liquibase踩坑记录
- Liquibase+spring
- liquibase配置(MAVEN)
- liquibase
- 配置spring boot工程
- Spring Boot 配置log4j
- Spring boot配置cache
- Spring-boot 配置log4j
- SPRING BOOT 配置大全
- spring-boot 配置hibernate
- spring boot + log4j2 配置
- Spring boot配置Junit
- spring boot tomcat配置
- spring boot 配置分离
- Spring Boot 配置SSL
- spring-boot mongodb配置
- Nifi -- standalone安装
- python的pip源
- ZCMU-1110-三角形转置
- 指纹芯片GF5216(汇顶)TEE方案移植(高通8996平台)
- 返回当前样式-兼容写法
- spring boot 配置liquibase
- 软工大数据-software success prediction-文献资料汇总
- javaEE开发简介
- 微信小程序css篇----布局(Layout)
- php的命名空间
- 【jnuit】——java中的mockito
- es6中管理类的私有数据
- 插入一个博客
- N-04. 映射服务器到外网 ❀ 网康 (NETENTSEC) 防火墙