Liquibase 变更集仅作为单个事务执行
Liquibase changesets only executing as a single transaction
在 discussion at the Liquibase forums, developer Nathan Voxland 中说 Liquibase 应该在每个变更集之后提交。我知道这是一个七年前的话题,所以从那以后可能发生了很多变化,但也许没有?
It should commit after ever changeSet. On most databases, addColumn autocommits as well.
changeSet tag 的文档可以解释为 "committed after all preconditions in the changelog succeed",这与 7 岁的 post 相矛盾。
Liquibase attempts to execute each changeSet in a transaction that is committed at the end, or rolled back if there is an error. Some databases will auto-commit statements which interferes with this transaction setup and could lead to an unexpected database state. Therefore, it is usually best to have just one change per changeSet unless there is a group of non-auto-committing changes that you want applied as a transaction such as inserting data.
Liquibase 是否仍然意味着在每个变更集之后提交?
我将 Liquibase 3.5.3 与 Netbeans/Maven 一起使用,并使用 Java 代码开始更新。
我有一个 main_changelog 文件,它的唯一目的是将所有更新日志包含在一个目录中。该目录中的两个(目前)变更日志各有两个变更集。这两个变更日志在它们的变更集之外都有一个 onFail="HALT" 前提条件。
我的测试环境的前提条件是 changelog_1 成功(因此其中的所有变更集都将被执行),而 changelog_2 前提条件失败。
我看到的是,在这个全新的数据库上,创建了 DATABASECHANGELOG table 但它是空的。 None 的变更集已提交,大概是因为稍后的前提条件会在失败时停止。我期待提交 HALT 之前的所有变更集。
按预期工作?还是错误?
来自 liquibase 文档:
Preconditions at the changelog level apply to all changesets, not just
those listed in the current changelog or its child changelogs.
因为您的先决条件是在变更日志级别并且您指定了 HALT,所以 liquibase 不应用任何变更集。交易性从来没有真正发挥作用。
如文档中所述,每个 changeSet 都有一个单独的事务
Liquibase attempts to execute each changeset in a transaction ...
在 discussion at the Liquibase forums, developer Nathan Voxland 中说 Liquibase 应该在每个变更集之后提交。我知道这是一个七年前的话题,所以从那以后可能发生了很多变化,但也许没有?
It should commit after ever changeSet. On most databases, addColumn autocommits as well.
changeSet tag 的文档可以解释为 "committed after all preconditions in the changelog succeed",这与 7 岁的 post 相矛盾。
Liquibase attempts to execute each changeSet in a transaction that is committed at the end, or rolled back if there is an error. Some databases will auto-commit statements which interferes with this transaction setup and could lead to an unexpected database state. Therefore, it is usually best to have just one change per changeSet unless there is a group of non-auto-committing changes that you want applied as a transaction such as inserting data.
Liquibase 是否仍然意味着在每个变更集之后提交?
我将 Liquibase 3.5.3 与 Netbeans/Maven 一起使用,并使用 Java 代码开始更新。
我有一个 main_changelog 文件,它的唯一目的是将所有更新日志包含在一个目录中。该目录中的两个(目前)变更日志各有两个变更集。这两个变更日志在它们的变更集之外都有一个 onFail="HALT" 前提条件。
我的测试环境的前提条件是 changelog_1 成功(因此其中的所有变更集都将被执行),而 changelog_2 前提条件失败。
我看到的是,在这个全新的数据库上,创建了 DATABASECHANGELOG table 但它是空的。 None 的变更集已提交,大概是因为稍后的前提条件会在失败时停止。我期待提交 HALT 之前的所有变更集。
按预期工作?还是错误?
来自 liquibase 文档:
Preconditions at the changelog level apply to all changesets, not just those listed in the current changelog or its child changelogs.
因为您的先决条件是在变更日志级别并且您指定了 HALT,所以 liquibase 不应用任何变更集。交易性从来没有真正发挥作用。
如文档中所述,每个 changeSet 都有一个单独的事务
Liquibase attempts to execute each changeset in a transaction ...