【发布时间】:2021-07-29 14:59:35
【问题描述】:
我有一个 Spring Boot 应用程序,我正在尝试使用 Liquibase 测试一些迁移。我正在尝试查看回滚功能的工作原理,但我不断收到错误。
这是迁移文件:
<?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
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
<changeSet id="1" author="Me">
<createTable tableName="Person">
<column name="id" type="int" />
<column name="name" type="string" />
</createTable>
<rollback>
<dropTable tableName="Person" />
</rollback>
</changeSet>
</databaseChangeLog>
当我运行应用程序时,表已正确创建......但我不知道如何或在哪里运行命令以执行回滚。我尝试在 IntelliJ 的 Maven 目标中运行以下命令:
mvn liquibase:rollback
当我运行它时说:
Failed to execute goal org.liquibase:liquibase-maven-plugin:3.10.3:rollback (default-cli) on project party:
The database URL has not been specified either as a parameter or in a properties file.
如果数据库 URL 丢失或错误,那么我认为它也不应该能够创建表?
【问题讨论】:
标签: postgresql liquibase rollback changeset liquibase-hibernate