OSDN Git Service

Fixing MySQL syntax error
authorMichael Richardson <michael_richardson@shelter.org.uk>
Wed, 18 Jul 2012 10:59:32 +0000 (11:59 +0100)
committerMichael Richardson <michael_richardson@shelter.org.uk>
Wed, 18 Jul 2012 10:59:32 +0000 (11:59 +0100)
lib/tasks/gitlab/backup.rake

index 4fbde37..014483d 100644 (file)
@@ -159,7 +159,7 @@ namespace :gitlab do
         print "- Dumping table #{tbl}... "
         count = 1
         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?}
             output = {tbl + '_' + count.to_s => line}
             file << output.to_yaml.gsub(/^---\n/,'') + "\n"