Skip to content

Commit

Permalink
Merge pull request mattconnolly#10 from halida/master
Browse files Browse the repository at this point in the history
Thanks!
  • Loading branch information
mattconnolly committed May 2, 2012
2 parents ba9f1b0 + 64a5d21 commit 6d5c291
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/rails-backup-migrate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ def save_db_to_yml
# into YAML on their own at all, let alone in a way that would be compatible with other databases
records.map! do |record|
record.inject({}) do |memo, (k,v)|
memo[k] = case v
when Mysql::Time
memo[k] = case v.class.name
when "Mysql::Time"
datetime_from_mysql_time v
else
v
Expand Down Expand Up @@ -144,7 +144,7 @@ def restore_db_from_yml

puts "Loading #{tbl}..." if VERBOSE
YAML.load_file("#{tbl}.yml").each do |fixture|
ActiveRecord::Base.connection.execute "INSERT INTO #{tbl} (#{fixture.keys.join(",")}) VALUES (#{fixture.values.collect { |value| ActiveRecord::Base.connection.quote(value) }.join(",")})", 'Fixture Insert'
ActiveRecord::Base.connection.execute "INSERT INTO #{tbl} (#{fixture.keys.map{|k| "`#{k}`"}.join(",")}) VALUES (#{fixture.values.collect { |value| ActiveRecord::Base.connection.quote(value) }.join(",")})", 'Fixture Insert'
end
end
end
Expand Down

0 comments on commit 6d5c291

Please sign in to comment.