【发布时间】:2014-05-20 17:45:49
【问题描述】:
假设我有一个用户模型,我想用 2 个模式设置 postgresql:
test1.users
test2.users
有没有办法指定我在运行迁移时要使用的架构?
rake db:migrate schema=test1
【问题讨论】:
标签: ruby-on-rails postgresql rails-migrations
假设我有一个用户模型,我想用 2 个模式设置 postgresql:
test1.users
test2.users
有没有办法指定我在运行迁移时要使用的架构?
rake db:migrate schema=test1
【问题讨论】:
标签: ruby-on-rails postgresql rails-migrations
Add an environment,将其命名为“test2”,并在 config/database.yml 中定义您的架构。然后使用RAILS_ENV=test2 rake db:migrate 运行您的迁移。
【讨论】:
ActiveRecord::StatementInvalid: PG::InvalidSchemaName: ERROR: no schema has been selected to create in