我在迁移中有以下内容:
create_table :model_with_a_long_name do |t|
t.references :other_model_with_an_equally_long_name, index: true
end
Run Code Online (Sandbox Code Playgroud)
这会为Postgres产生一个名字太长的索引.
有没有办法手动指定索引名称(不分别添加整数列和索引)?
类似于以下内容:
create_table :model_with_a_long_name do |t|
t.references :other_model_with_an_equally_long_name, index: true, index_name: 'model_and_other'
end
Run Code Online (Sandbox Code Playgroud)
?