ActiveRecord Migration Peev- Freedom to run app while migrations are pending

16 views
Skip to first unread message

Amit Mhatre

unread,
Nov 12, 2015, 1:57:56 AM11/12/15
to Ruby on Rails: Talk
I was wondering if there should be a way to  run the app even if some migrations are pending. Lets say I have created a migration...but at this time I am not sure if I want to run it as is ....am anticipating modifications.  What if in the error  page "Migrations are pending. To resolve this issue, run: bin/rake db:migrate RAILS_ENV=development"   there is  a  mention of a way to override the error and run the app as is...or does it already exist. Then one doesn't need to run the migration and later new ones to modify it..

Frederick Cheung

unread,
Nov 12, 2015, 2:05:03 AM11/12/15
to Ruby on Rails: Talk
On Thursday, November 12, 2015 at 6:57:56 AM UTC, Amit Mhatre wrote:
> I was wondering if there should be a way to  run the app even if some migrations are pending. Lets say I have created a migration...but at this time I am not sure if I want to run it as is ....am anticipating modifications.  What if in the error  page "Migrations are pending. To resolve this issue, run: bin/rake db:migrate RAILS_ENV=development"   there is  a  mention of a way to override the error and run the app as is...or does it already exist. Then one doesn't need to run the migration and later new ones to modify it..

As a very short term thing you could of course just remove the corresponding migration file. If you want to disable the check altogether then you could remove the ActiveRecord::Migration::CheckPending middleware. See http://guides.rubyonrails.org/rails_on_rack.html for details on how to remove middlewares from your app.

Fred

Colin Law

unread,
Nov 12, 2015, 3:31:57 AM11/12/15
to Ruby on Rails: Talk
If you have already committed the migration to your source control
system then just rollback to the previous version. If you have not
committed it but are using git then git stash will save it temporarily
in the stash so you can recover it later. If you are not using a
source control system then start now. It is almost trivial to setup
git and after you start using it you will wonder how you survived
before.

Colin
Reply all
Reply to author
Forward
0 new messages