1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

rake db:migrate

Last updated at Posted at 2016-07-28
command explanation
rake db:abort_if_pending_migrations 実行されていないmigrationを表示
rake db:migrate [VERSION=バージョン番号] [オプション] db/migrate内のスクリプトファイルからdatabaseにテーブル作成
rake db:migrate:down 指定したmigrationファイルのself.downメソッドを実行
rake db:migrate:redo [STEP=ステップ数] 指定したmigrationファイルのself.downメソッドを実行
rake db:migrate:reset databaseを一度削除してもう一度作成し、db:migrate実行
rake db:mgrate:up 指定したmigrationファイルのself.upメソッドを実行

テーブルの初期化

rake db:migrate:reset

指定したマイグレーションのみ実行

rake db:migrate:up VERSION=201010190000

一つ前のバージョンに戻す

rake db:migrate:redo STEP=1

スキーマのバージョンを調べる

rake db:version
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?