The Passionate Craftsman

Ruby, PHP, MySql, Software engineering and more.

Wednesday 11 August 2010

Execute Rails migrations on producion server with Capistrano

If you cannot access, from your development computer, the production database (because of corporate policies and/or security settings), you can add a command to Capistrano when you deploy your application.

After copying the files and coping database.yml, you can run easily a migration on the production server in this way:

run "cd /rails_dir/#{application}/current/ && rake db:migrate RAILS_ENV=production"

That command goes into the root of your Rails application and execute the migration specifying production as environment.

After that command you can change the symlink and switch to the newly deployed application.

Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home