RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

How to not forget about db migrations

before_filter which will remind to run migrations

Comments

ouch, this code should really be externalized and not used in a before_filter :=).

I might not want to run this before filter?!

that is a HORRIBLE idea. What about just making capistrano run db:migrate so that it automatically picks up changes.

slainer68, you are free to rename it to rack::maintenance, or whatever you like.

concerned programmer, running db:migrate != just ensuring that all migrations is done(like in rake_test/rake_db_abort_if_pending_migrations). also, not all people use capistrano

@blocknotgiven I think what people are getting at is this is an unnecessary performance hit on every single action in an application. An additional file system call as well as a db call for every single action is not worth it. as @concerned programmer mentioned, Capistrano can easily handle this. If you’re not using Capistrano to deploy I would investigate your deployment system to find a way to replicate this behavior.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in