liquibase脚本自动生成数据库表

日常开发中,需要进行数据库设计建模,创建对应的表,可通过liquibase脚本自动生成数据库表,减少开发时间。

1.项目中pom文件引入liquibase的maven依赖

<!-- liquibase start -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
    <groupId>org.liquibase</groupId>
    <artifactId>liquibase-core</artifactId>
</dependency>
<!-- liquibase end -->

2.resource目录下创建liquibase的changelog目录以及主配置文件

liquibase文件配置

  1. resource目录下创建liquibase目录、二级目录changelog
  2. 添加主配置文件master.xml,指定path为changelog下sql配置文件,如下所示
<?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.8.xsd">

    <includeAll path="liquibase/changelog/" relativeToChangelogFile="</
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值