2011-09-19 41 views
3

我需要將當前模式中的一些表移動到不同的數據庫,因爲我需要關閉這些表的二進制日誌記錄,並且Mysql不允許關閉特定表的二進制日誌記錄。ActiveRecord遷移多個數據庫

所以我想知道如果我可以在同一個項目中的兩個不同的架構上運行遷移。

回答

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)