3

我需要将当前架构中的一些表移动到不同的数据库,因为我需要关闭这些表的二进制日志,而 Mysql 不允许关闭特定表的二进制日志。

所以我想知道我是否可以在同一个项目中的两个不同模式上运行迁移。

4

1 回答 1

0

您可以在 database.yml 中定义单独的数据库并为每个数据库管理不同的迁移目录:

rake db:migrate RAILS_ENV=customenvironment


db
  |- migrate (default migrate directory)
  |- schema.rb
  |- seed.rb

another_db (customenvironment)
  |- migrate (migrations for the second db)
  |- schema.rb (schema that will be auto generated for this db)
  |- seed.rb (seed file for the new db)
于 2015-05-30T01:15:34.663 回答