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 にも当てはまると思います。