Last active
January 2, 2019 17:49
-
-
Save wacaw/657744af41dcf4963646 to your computer and use it in GitHub Desktop.
Capistrano 3 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
namespace :deploy do | |
desc "Load the initial schema - it will WIPE your database, use with care" | |
task :db_schema_load do | |
on roles(:db) do | |
puts <<-EOF | |
************************** WARNING *************************** | |
If you type [yes], rake db:schema:load will WIPE your database | |
any other input will cancel the operation. | |
************************************************************** | |
EOF | |
ask :answer, "Are you sure you want to WIPE your database?: " | |
if fetch(:answer) == 'yes' | |
within release_path do | |
with rails_env: :production do | |
rake 'db:schema:load' | |
end | |
end | |
else | |
puts "Cancelled." | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks - this was helpful today!