Commit 48bd8a7e16f2c151472f76f82adc3fd28ce04ba2
Exists in
spb-stable
and in
3 other branches
Merge remote-tracking branch 'origin/rake_drop_tables'
Conflicts: CHANGELOG
Showing
3 changed files
with
14 additions
and
2 deletions
Show diff stats
CHANGELOG
@@ -3,6 +3,7 @@ v 6.8.0 | @@ -3,6 +3,7 @@ v 6.8.0 | ||
3 | - Enabled GZip Compression for assets in example Nginx, make sure that Nginx is compiled with --with-http_gzip_static_module flag (this is default in Ubuntu) | 3 | - Enabled GZip Compression for assets in example Nginx, make sure that Nginx is compiled with --with-http_gzip_static_module flag (this is default in Ubuntu) |
4 | - Make user search case-insensitive (Christopher Arnold) | 4 | - Make user search case-insensitive (Christopher Arnold) |
5 | - Remove omniauth-ldap nickname bug workaround | 5 | - Remove omniauth-ldap nickname bug workaround |
6 | + - Drop all tables before restoring a Postgres backup | ||
6 | 7 | ||
7 | v 6.7.2 | 8 | v 6.7.2 |
8 | - Fix upgrader script | 9 | - Fix upgrader script |
lib/backup/database.rb
@@ -29,9 +29,10 @@ module Backup | @@ -29,9 +29,10 @@ module Backup | ||
29 | print "Restoring MySQL database #{config['database']} ... " | 29 | print "Restoring MySQL database #{config['database']} ... " |
30 | system('mysql', *mysql_args, config['database'], in: db_file_name) | 30 | system('mysql', *mysql_args, config['database'], in: db_file_name) |
31 | when "postgresql" then | 31 | when "postgresql" then |
32 | - puts "Destructively rebuilding database schema for RAILS_ENV #{Rails.env}" | ||
33 | - Rake::Task["db:schema:load"].invoke | ||
34 | print "Restoring PostgreSQL database #{config['database']} ... " | 32 | print "Restoring PostgreSQL database #{config['database']} ... " |
33 | + # Drop all tables because PostgreSQL DB dumps do not contain DROP TABLE | ||
34 | + # statements like MySQL. | ||
35 | + Rake::Task["gitlab:db:drop_all_tables"].invoke | ||
35 | pg_env | 36 | pg_env |
36 | system('psql', config['database'], '-f', db_file_name) | 37 | system('psql', config['database'], '-f', db_file_name) |
37 | end | 38 | end |