Skip to content

Instantly share code, notes, and snippets.

@danielgrippi
Created January 25, 2012 06:40
Show Gist options
  • Save danielgrippi/1675105 to your computer and use it in GitHub Desktop.
Save danielgrippi/1675105 to your computer and use it in GitHub Desktop.
Remove excess share_visibilities from 1/24 HEAD
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
@maxwell
Copy link

maxwell commented Jan 25, 2012

We should make this a rake task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment