class CreateProducts < ActiveRecord::Migration[7.0] def change create_table :products do |t| t.string :name t.text :description t.timestamps end end end class CreateProducts < ActiveRecord::Migration[7.0] def up create_table :products do |t| t.string :name t.text :description t.timestamps end end def down drop_table :products end end カラムをバージョンアップ 説明 データベースのカラムをバージョンアップ upメソッドはロールバックできない処理をする際に主に使用
![マイグレーション(migration) | Railsドキュメント](https://cdn-ak-scissors.b.st-hatena.com/image/square/49cbb613139bc5ea983f0c98ef47a2ee295e8323/height=288;version=1;width=512/https%3A%2F%2Frailsdoc.com%2Fassets%2Fimages%2Fmigration.png)