pools: drop post_count column (fix #3667)

This commit is contained in:
evazion
2018-11-08 15:08:56 -06:00
parent 115ed16a96
commit fb7d83c54f
3 changed files with 20 additions and 7 deletions

View File

@@ -0,0 +1,10 @@
class DropPostCountFromPools < ActiveRecord::Migration[5.2]
def up
remove_column :pools, :post_count
end
def down
add_column :pools, :post_count, :integer, default: 0, null: false
Pool.update_all("post_count = cardinality(post_ids)")
end
end