足りない列の追加
データベースに足りない列の追加をする場合、
マイグレーションのコマンドを打つ。
ruby/script migration add_to_product price:dicimal
add_to_product…マイグレーションの名前
price:dicimal…追加するカラム
マイグレーション用のrbファイルが出来上がるので、
後は、必要なだけ全部追加する。
add_column :documents, :created_at, :timestamp add_column :documents, :updated_at, :timestamp ……
参考
http://webos-goodies.jp/archives/50741819.html
参考2
http://www.ibm.com/developerworks/jp/opensource/data/library/techarticle/dm-0705chun/
MySQLの型の対応関係
:binary → blob :boolean → tinyint(1) :date → date :decimal → decimal :float → float :integer → int(11) :string → varchar(225) :text → text :time → time :timestamp → datetime