【问题标题】:How to dump schema of all users defined in database.yml file如何转储 database.yml 文件中定义的所有用户的架构
【发布时间】:2018-03-20 08:52:53
【问题描述】:

我的database.yml 看起来像

development: &development
  adapter: oracle_enhanced
  database: some_db
  username: admin
  password: password

temp_development:
  <<: *development
  username: another_user
  password: another_password

auth_development:
  <<: *development
  username: authority
  password: authority

当我运行rake db:schema:dump 时,它会将用户admin 创建的所有表转储到schema.rb,我如何转储在另一个模式中创建或由其他用户(如 another_user权限schema.rb

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 ruby-on-rails-4


    【解决方案1】:

    有点像

    RAILS_ENV=auth_development rake db:schema:dump 
    

    应该可以解决问题(在 linux 上)。在 Windows 恕我直言,您不能在一个语句中设置环境变量和命令。所以手动将环境变量RAILS_ENV设置成你想要的环境,然后执行rake db:schema:dump

    注意:这将覆盖您当前的 schema.rb,这可能是也可能不是您想要的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-17
      • 1970-01-01
      • 2011-02-27
      • 1970-01-01
      • 1970-01-01
      • 2015-02-25
      相关资源
      最近更新 更多