Commit 58968522a30d60f7944898750d287c2e74d2d5c5

Authored by Jacob Vosmaer
1 parent 41b985fe

Apply Postgres force-restore patch

config/patches/gitlab-rails/pg_force_restore.patch 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +diff --git a/lib/backup/database.rb b/lib/backup/database.rb
  2 +index ebb4f28..6552f45 100644
  3 +--- a/lib/backup/database.rb
  4 ++++ b/lib/backup/database.rb
  5 +@@ -29,6 +29,8 @@ module Backup
  6 + print "Restoring MySQL database #{config['database']} ... "
  7 + system('mysql', *mysql_args, config['database'], in: db_file_name)
  8 + when "postgresql" then
  9 ++ puts "Destructively rebuilding database schema for RAILS_ENV #{Rails.env}"
  10 ++ Rake::Task["db:schema:load"].invoke
  11 + print "Restoring PostgreSQL database #{config['database']} ... "
  12 + pg_env
  13 + system('psql', config['database'], '-f', db_file_name)
... ...
config/software/gitlab-rails.rb
... ... @@ -54,6 +54,10 @@ build do
54 54 # Patch the gitlab backup script to correctly restore gitlab-shell hooks
55 55 patch :source => "backup_restore_hooks.patch"
56 56  
  57 + # The backup script in gitlab-rails 6-6-stable fails to overwrite existing
  58 + # Postgres data. This patch, taken from gitlab-rails master, fixes that.
  59 + patch :source => "pg_force_restore.patch"
  60 +
57 61 bundle "install --without mysql development test --path=#{install_dir}/embedded/service/gem", :env => env
58 62  
59 63 # In order to precompile the assets, we need to get to a state where rake can
... ...