migration id指定して 特定のファイルをrollbackして編集したい
試した内容
rails db:rollbackで
ActiveRecord::UnknownMigrationVersionError:
No migration with version number 20191212090750.
エラーが出たため
rails db:migrate:status
でdropしたいMigration ID指定
rails db:migrate:redo VERSION=20191209112047
しかし
-- drop_table(:items)したのとすぐに
-- drop_create(:items)される
$ rails db:version Current version: 20191212090750 $ rails db:migrate:status database: freemarket_app_development Status Migration ID Migration Name -------------------------------------------------- up 20191209062929 Create addresses up 20191209063048 Create prefectures up 20191209111548 Add devise to users up 20191209112047 Create items up 20191212090750 ********** NO FILE ********** $ rails db:migrate:redo VERSION=20191209112047 == 20191209112047 CreateItems: reverting ====================================== -- drop_table(:items) -> 0.0245s == 20191209112047 CreateItems: reverted (0.0374s) ============================= == 20191209112047 CreateItems: migrating ====================================== -- create_table(:items) -> 0.0401s == 20191209112047 CreateItems: migrated (0.0402s) ============================= $ rails db:rollback rails aborted! ActiveRecord::UnknownMigrationVersionError: No migration with version number 20191212090750. /Users/MISIAN/Desktop/freemarket_app/bin/rails:9:in `<top (required)>' /Users/MISIAN/Desktop/freemarket_app/bin/spring:15:in `<top (required)>' bin/rails:3:in `load' bin/rails:3:in `<main>' Tasks: TOP => db:rollback (See full trace by running task with --trace) $ rails db:rollback rails aborted! ActiveRecord::UnknownMigrationVersionError: No migration with version number 20191212090750. /Users/MISIAN/Desktop/freemarket_app/bin/rails:9:in `<top (required)>' /Users/MISIAN/Desktop/freemarket_app/bin/spring:15:in `<top (required)>' bin/rails:3:in `load' bin/rails:3:in `<main>' Tasks: TOP => db:rollback (See full trace by running task with --trace) kobayashi-no-MacBook-Air:freemarket_app MISIAN$
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/12/13 03:40