Created
December 14, 2011 15:57
-
-
Save thbar/1477151 to your computer and use it in GitHub Desktop.
Custom capistrano task to do db:schema:load
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cap deploy deploy:db_schema_load | |
namespace :deploy do | |
desc "Load the initial schema - it will WIPE your database, use with care" | |
task :db_schema_load, :roles => :db, :only => { :primary => true } do | |
puts <<-EOF | |
************************** WARNING *************************** | |
If you type [yes], rake db:schema:load will WIPE your database | |
any other input will cancel the operation. | |
************************************************************** | |
EOF | |
answer = Capistrano::CLI.ui.ask "Are you sure you want to WIPE your database?: " | |
if answer == 'yes' | |
run "cd #{current_path} && RAILS_ENV=production bundle exec rake db:schema:load" | |
else | |
puts "Cancelled." | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment