Tag: マイグレーション
rails generate migration create_books
rails generate migration create_books
class CreateHoges < ActiveRecord::Migration def change create_table :hoges do |t| t.string :name t.integer :age t.timestamps end end end
rails generate migration add_image_to_books
class AddImageToBooks < ActiveRecord::Migration def change add_column :books, :image, :string end end
class AddDescriptionToBooks < ActiveRecord::Migration def change add_column :books :description, :text, :limit => 4294967295 end end
rake db:migrate
rake db:migrate RAILS_ENV=production
rake db:migrate:recet
$ bundle exec rake db:migrate:status Status Migration ID Migration Name -------------------------------------------------- up 20140927082920 Create books up 20140927084708 Create hoges up 20141121060148 Create software infos down 20150409052819 Create settings
$ bundle exec rake db:version Current version: 20141121060148