pools: store post_ids as array instead of string (fix #3979)

This commit is contained in:
evazion
2018-11-08 11:32:58 -06:00
parent 8515bf43b4
commit 115ed16a96
14 changed files with 92 additions and 113 deletions

View File

@@ -0,0 +1,17 @@
class ChangePostIdsToArrayOnPools < ActiveRecord::Migration[5.2]
def up
Pool.without_timeout do
change_column_default :pools, :post_ids, nil
change_column :pools, :post_ids, "integer[]", using: "string_to_array(post_ids, ' ')::integer[]"
change_column_default :pools, :post_ids, "{}"
end
end
def down
Pool.without_timeout do
change_column_default :pools, :post_ids, nil
change_column :pools, :post_ids, :text, using: "array_to_string(post_ids, ' ')"
change_column_default :pools, :post_ids, ""
end
end
end