【问题标题】:Rails 4 and postgresql schemas, how to run migrations for 2 schemasRails 4 和 postgresql 模式,如何为 2 个模式运行迁移
【发布时间】:2014-05-20 17:45:49
【问题描述】:

假设我有一个用户模型,我想用 2 个模式设置 postgresql:

test1.users
test2.users

有没有办法指定我在运行迁移时要使用的架构?

rake db:migrate schema=test1

【问题讨论】:

    标签: ruby-on-rails postgresql rails-migrations


    【解决方案1】:

    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
    猜你喜欢
    • 2010-12-30
    • 2018-07-19
    • 2019-07-12
    • 2011-07-27
    • 2015-12-29
    • 2015-06-18
    • 2018-11-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多