Rails 5.0.0.beta1,两个数据库设置创建额外的 active_record_internal_metadatas 表

Rails 5.0.0.beta1, two database setup creates additional active_record_internal_metadatas tables

我正在尝试在 rails 5.0.0.beta1 中实施两个数据库设置。一切似乎都运行良好,但我 运行 遇到了一些奇怪的事情。模型连接到指定的数据库、关联工作、迁移(经过一些调整后)也工作正常。在我 运行 迁移之后,一个名为 active_record_internal_metadatas 的额外 table 出现在两个数据库中。当我在 rails 4.2.5 上测试此设置时,没有这样的事情。有人可以阐明这个问题吗?

双数据库设置的设置:

这似乎是一个 Rails 5 功能。这是引自 this pull request commit 的介绍:

Prevent destructive action on production database

This PR introduces a key/value type store to Active Record that can be used for storing internal values. It is an alternative implementation to #21237 cc @sgrif @matthewd.

It is possible to run your tests against your production database by accident right now. While infrequently, but as an anecdotal data point, Heroku receives a non-trivial number of requests for a database restore due to this happening. In these cases the loss can be large.

To prevent against running tests against production we can store the "environment" version that was used when migrating the database in a new internal table. Before executing tests we can see if the database is a listed in protected_environments and abort. There is a manual escape valve to force this check from happening with environment variable DISABLE_DATABASE_ENVIRONMENT_CHECK=1.