flyway简单入门【SpringBoo整合flyway】

本文介绍Flyway数据库版本管理工具的工作原理及如何在Spring Boot项目中整合使用。通过历史记录表跟踪版本变化,实现增量更新。

flyway简单入门

flyway是一款数据库版本管理工具

1. 工作原理

flyway通过历史记录表(flyway_schema_history)来记录版本历史。每次随项目启动时将会自动扫描在resources/db/migration下的文件,并查询flyway_schema_history判断是否为新增文件?

  • 如果是新增的文件,则执行该迁移文件
  • 如果不是,则忽略该文件

flyway_schema_history的表结构:

create table flyway_schema_history
(
    installed_rank int                                 not null
        primary key,
    version        varchar(50)                         null,
    description    varchar(200)                        not null,
    type           varchar(20)                         not null,
    script         varchar(1000)                       not null,
    checksum       int                                 null,
    installed_by   varchar(100)                        not null,
    installed_on   timestamp default CURRENT_TIMESTAMP not null,
    execution_time int                                 not null,
    success        tinyint(1)                          not null
);

create index fly
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值