Commit 30eee677 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #1106 from mrichardson-shelter/backup-create-fix-mysql-syntax-error

Fixing MySQL syntax error
parents 72a57172 0456cedd
...@@ -159,7 +159,7 @@ namespace :gitlab do ...@@ -159,7 +159,7 @@ namespace :gitlab do
print "- Dumping table #{tbl}... " print "- Dumping table #{tbl}... "
count = 1 count = 1
File.open(File.join(backup_path_db, tbl + ".yml"), "w+") do |file| File.open(File.join(backup_path_db, tbl + ".yml"), "w+") do |file|
ActiveRecord::Base.connection.select_all("SELECT * FROM #{tbl}").each do |line| ActiveRecord::Base.connection.select_all("SELECT * FROM `#{tbl}`").each do |line|
line.delete_if{|k,v| v.blank?} line.delete_if{|k,v| v.blank?}
output = {tbl + '_' + count.to_s => line} output = {tbl + '_' + count.to_s => line}
file << output.to_yaml.gsub(/^---\n/,'') + "\n" file << output.to_yaml.gsub(/^---\n/,'') + "\n"
......
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