Merge pull request #1983 from betagouv/improve-import-db

Do not download backup if exists
This commit is contained in:
gregoirenovel 2018-05-31 14:03:16 +02:00 committed by GitHub
commit a872acfb97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -71,7 +71,10 @@ namespace :dev do
task :import_db do
filename = "tps_prod_#{1.day.ago.strftime("%d-%m-%Y")}.sql"
local_file = "/tmp/#{filename}"
run_and_stop_if_error "scp -C deploy@sgmap_backup:/var/backup/production1/db/#{filename} #{local_file}"
if !File.exist?(local_file)
run_and_stop_if_error "scp -C deploy@sgmap_backup:/var/backup/production1/db/#{filename} #{local_file}"
end
dev_env_param = "RAILS_ENV=development"