【发布时间】:2018-06-25 09:34:35
【问题描述】:
我正在创建下表:
create_table(:categories) do |t|
t.belongs_to :user, null: false, foreign_key: true, index: true
t.uuid :uuid, unique: true, null: true, index: true
t.string :kind, :limit => 32, null: false, index: true
t.string :category, null: false, index: true
t.datetime :deleted_at, null: true, index: true
t.timestamps null: false, index: false
t.index [:kind, :category], :unique => true
end
第一列是外键,默认命名为“user_id”。我想用belongs_to 创建列,但将列名指定为“created_by_user_id”。我该怎么做?
【问题讨论】:
标签: ruby-on-rails migration rails-migrations