我想在 Rails 3 下创建一个bigint
(或string
其他不是)类型的主键字段。int
我有一个给定的数据结构,例如:
things
------
id bigint primary_key
name char(32)
我目前正在尝试推动的方法:
create_table :things, :id => false do |t| # That prevents the creation of (id int) PK
t.integer :id, :limit => 8 # That makes the column type bigint
t.string :name, :limit => 32
t.primary_key :id # This is perfectly ignored :-(
end
列类型将是正确的,但 sqlite3 不会出现主键选项,我怀疑 MySQL 也是这种情况。