Cleanup migration that removes duplicating AspectVisibilities
This commit is contained in:
parent
717554edac
commit
fd975eeae5
2 changed files with 12 additions and 1 deletions
|
|
@ -0,0 +1,11 @@
|
||||||
|
class RemoveDuplicateAspectVisibilities < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
where = "WHERE a1.aspect_id = a2.aspect_id AND a1.shareable_id = a2.shareable_id AND "\
|
||||||
|
"a1.shareable_type = a2.shareable_type AND a1.id > a2.id"
|
||||||
|
if AppConfig.postgres?
|
||||||
|
execute("DELETE FROM aspect_visibilities AS a1 USING aspect_visibilities AS a2 #{where}")
|
||||||
|
else
|
||||||
|
execute("DELETE a1 FROM aspect_visibilities a1, aspect_visibilities a2 #{where}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20160327103605) do
|
ActiveRecord::Schema.define(version: 20160531170531) do
|
||||||
|
|
||||||
create_table "account_deletions", force: :cascade do |t|
|
create_table "account_deletions", force: :cascade do |t|
|
||||||
t.string "diaspora_handle", limit: 255
|
t.string "diaspora_handle", limit: 255
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue