Commit 396f45ad authored by Douwe Maan's avatar Douwe Maan

Merge branch '39903-restore-backup-warning' into 'master'

Make restoring backup database table warning more explicit

Closes #39903

See merge request gitlab-org/gitlab-ce!15246
parents cc175278 734fab8a
...@@ -33,24 +33,29 @@ namespace :gitlab do ...@@ -33,24 +33,29 @@ namespace :gitlab do
backup.unpack backup.unpack
unless backup.skipped?('db') unless backup.skipped?('db')
unless ENV['force'] == 'yes' begin
warning = <<-MSG.strip_heredoc unless ENV['force'] == 'yes'
Before restoring the database we recommend removing all existing warning = <<-MSG.strip_heredoc
tables to avoid future upgrade problems. Be aware that if you have Before restoring the database, we will remove all existing
custom tables in the GitLab database these tables and all data will be tables to avoid future upgrade problems. Be aware that if you have
removed. custom tables in the GitLab database these tables and all data will be
MSG removed.
puts warning.color(:red) MSG
ask_to_continue puts warning.color(:red)
puts 'Removing all tables. Press `Ctrl-C` within 5 seconds to abort'.color(:yellow) ask_to_continue
sleep(5) puts 'Removing all tables. Press `Ctrl-C` within 5 seconds to abort'.color(:yellow)
sleep(5)
end
# Drop all tables Load the schema to ensure we don't have any newer tables
# hanging out from a failed upgrade
$progress.puts 'Cleaning the database ... '.color(:blue)
Rake::Task['gitlab:db:drop_tables'].invoke
$progress.puts 'done'.color(:green)
Rake::Task['gitlab:backup:db:restore'].invoke
rescue Gitlab::TaskAbortedByUserError
puts "Quitting...".color(:red)
exit 1
end end
# Drop all tables Load the schema to ensure we don't have any newer tables
# hanging out from a failed upgrade
$progress.puts 'Cleaning the database ... '.color(:blue)
Rake::Task['gitlab:db:drop_tables'].invoke
$progress.puts 'done'.color(:green)
Rake::Task['gitlab:backup:db:restore'].invoke
end end
Rake::Task['gitlab:backup:repo:restore'].invoke unless backup.skipped?('repositories') Rake::Task['gitlab:backup:repo:restore'].invoke unless backup.skipped?('repositories')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment