由网友(孤傲的背影)分享简介:是否有可能创建没有 AUTO_INCREMENT 标志中的主键的ActiveRecord Is it possible to create primary key without auto_increment flag in ActiveRecord?我不能这样做。create table :blah, :id...
是否有可能创建没有 AUTO_INCREMENT
标志中的主键的ActiveRecord
Is it possible to create primary key without auto_increment
flag in ActiveRecord?
我不能这样做。
create table :blah, :id => false
因为我想对列主键索引。我抬头一看文档但没有发现任何有用的。
because I want to have primary key index on the column. I looked up documentation but didn't find anything useful.
是否有可能建立主键不AUTO_INCREMENT?
推荐答案
试试这个?
create_table(:table_name, :id => false) do |t|
t.integer :id, :options => 'PRIMARY KEY'
end
相关推荐
最新文章