【发布时间】:2021-03-11 13:31:20
【问题描述】:
我正在尝试学习如何使用 liquibase 来更新我的数据库架构(如果是 MySQL)。我在 Workbench 和我的 spring 项目中创建了一个空模式:
application.properties(资源包):
spring.liquibase.enabled=true
spring.liquibase.change-log=classpath:db/changelog/changelog-master.yaml
spring.datasource.url=jdbc:mysql://localhost:3306/practice
spring.datasource.username=maxim
spring.datasource.password=123456
spring.jpa.hibernate.ddl-auto=update
在这个文件中,我确定 url、用户名、密码和 changelog-master 的路径是正确的。
我的 changelog-master.yaml 位于(resources/db/changelog 包)
databaseChangeLog:
- include:
file: changelog_1.yaml
relativeToChangelogFile: true
最后,我的 changelog_1.yaml(resources/db/changelog 包):
databaseChangeLog:
- changeSet:
id: 1
author: maxim
changes:
- createTable:
tableName: Device
columns:
- column:
name: id
type: BIGINT
autoIncrement: true
constraints:
primaryKey: true
nullable: false
- column:
name: name
type: VARCHAR
constraints:
nullable: false
当我尝试执行程序时,我得到:
liquibase.exception.ValidationFailedException: Validation Failed:1 change sets check sum
classpath:db/changelog/changelog_1.yaml::1::maxim was: 8:8896ac0d055b8ae982733866bc5682b1 but is now: 8:1e0167b7454bbfa9b38e2c11740cadee
有办法解决吗?
【问题讨论】:
标签: mysql spring yaml liquibase