Created
January 25, 2012 06:40
-
-
Save danielgrippi/1675105 to your computer and use it in GitHub Desktop.
Remove excess share_visibilities from 1/24 HEAD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index = 0 | |
while index < 1216623 do | |
puts index | |
sql = <<-SQL | |
DELETE sv | |
FROM share_visibilities AS sv | |
INNER JOIN posts | |
ON sv.shareable_id = posts.id | |
WHERE sv.shareable_type = "Post" | |
AND posts.public IS TRUE | |
AND posts.id < #{index}; | |
SQL | |
ActiveRecord::Base.connection.execute(sql) | |
index += 100 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We should make this a rake task.