Skip to content
Snippets Groups Projects
Commit 58968522 authored by Jacob Vosmaer's avatar Jacob Vosmaer
Browse files

Apply Postgres force-restore patch

parent 41b985fe
No related branches found
No related tags found
No related merge requests found
diff --git a/lib/backup/database.rb b/lib/backup/database.rb
index ebb4f28..6552f45 100644
--- a/lib/backup/database.rb
+++ b/lib/backup/database.rb
@@ -29,6 +29,8 @@ module Backup
print "Restoring MySQL database #{config['database']} ... "
system('mysql', *mysql_args, config['database'], in: db_file_name)
when "postgresql" then
+ puts "Destructively rebuilding database schema for RAILS_ENV #{Rails.env}"
+ Rake::Task["db:schema:load"].invoke
print "Restoring PostgreSQL database #{config['database']} ... "
pg_env
system('psql', config['database'], '-f', db_file_name)
Loading
Loading
@@ -54,6 +54,10 @@ build do
# Patch the gitlab backup script to correctly restore gitlab-shell hooks
patch :source => "backup_restore_hooks.patch"
 
# The backup script in gitlab-rails 6-6-stable fails to overwrite existing
# Postgres data. This patch, taken from gitlab-rails master, fixes that.
patch :source => "pg_force_restore.patch"
bundle "install --without mysql development test --path=#{install_dir}/embedded/service/gem", :env => env
 
# In order to precompile the assets, we need to get to a state where rake can
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment