Skip to content

Instantly share code, notes, and snippets.

@wacaw
Last active January 2, 2019 17:49
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wacaw/657744af41dcf4963646 to your computer and use it in GitHub Desktop.
Save wacaw/657744af41dcf4963646 to your computer and use it in GitHub Desktop.
Capistrano 3 Schema Load
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
@miketheman
Copy link

Thanks - this was helpful today!

@thbar
Copy link

thbar commented Jan 2, 2019

Thanks - helpful today too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment