&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