在迁移中添加外键辅助工具,并正确将外键导入到 schema.rb 中
schema.rb 中。 支持以下适配器: * mysql2 * postgres * sqlite (外键方法是无操作) **Foreigner 在 Rails 4.2 中已被废弃。**迁移 DSL 支持外键,通过 add_foreign_key 和 remove_foreign_key 来实现。(选项已记录在 connection_adapters/abstract/schema_statements.rb 中):
创建带有外键的新表: ```ruby create_table :products do |t| t.string :name t.integer :factory_id t.foreign_key :factories end
[](https://codeclimate.com/github/matthuhiggins/foreigner)暂无开放 Issues,或尚未同步最近议题。