From 3f026d18ebfb83346d3156e84049c48da8d439ed Mon Sep 17 00:00:00 2001 From: Raphael Sofaer Date: Thu, 17 Mar 2011 17:42:56 -0700 Subject: [PATCH] Fix up migration --- db/migrate/20110317222802_guid_is_unique.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/db/migrate/20110317222802_guid_is_unique.rb b/db/migrate/20110317222802_guid_is_unique.rb index a829b5fd5..ccda882ff 100644 --- a/db/migrate/20110317222802_guid_is_unique.rb +++ b/db/migrate/20110317222802_guid_is_unique.rb @@ -1,6 +1,6 @@ class GuidIsUnique < ActiveRecord::Migration def self.consolidate_post(guid) - post_ids = execute("select posts.id from posts where posts.guid = #{guid}").to_a.flatten! + post_ids = execute("select posts.id from posts where posts.guid = '#{guid}'").to_a.flatten! keep_id = post_ids.pop execute("UPDATE comments SET comments.post_id = #{keep_id} @@ -10,9 +10,9 @@ class GuidIsUnique < ActiveRecord::Migration SET posts.status_message_id = #{keep_id} WHERE posts.status_message_id IN (#{post_ids.join(',')})") - execute("DELETE post_visibilities WHERE post_visibilities.post_id IN (#{post_ids.join(',')})") - execute("DELETE mentions WHERE mentions.post_id IN (#{post_ids.join(',')})") - execute("DELETE posts WHERE posts.id IN (#{post_ids.join(',')})") + execute("DELETE FROM post_visibilities WHERE post_visibilities.post_id IN (#{post_ids.join(',')})") + execute("DELETE FROM mentions WHERE mentions.post_id IN (#{post_ids.join(',')})") + execute("DELETE FROM posts WHERE posts.id IN (#{post_ids.join(',')})") end def self.up sql = <<-SQL