LoginSignup
3
3

More than 5 years have passed since last update.

2つ以上前のmigrationを取り消す

Posted at

DB決めながら適当にごちゃごちゃやってみた後に必要のないmigrationが出てしまった。
最初からそんなものなかったことにしたい。
DB決めてからやれよとかは無しで。一人でやっていること前提で。

不要なカラム、テーブルの削除

rake db:migrate:down VERSION=...

削除します。もう使っていないのでこのままアプリを実行しても問題ないですが、rails sしてアクセスすると、

ActiveRecord::PendingMigrationError (

Migrations are pending. To resolve this issue, run:

    bin/rake db:migrate RAILS_ENV=development

):

migrationファイルの削除

rm <version>_hogehoge.rb

不要になったmigrationファイルを削除します。

バッドノウハウな気がしている。

3
3
1

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
3
3