pools: store post_ids as array instead of string (fix #3979)
This commit is contained in:
@@ -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
|
||||
@@ -2563,7 +2563,7 @@ CREATE TABLE public.pools (
|
||||
creator_id integer NOT NULL,
|
||||
description text,
|
||||
is_active boolean DEFAULT true NOT NULL,
|
||||
post_ids text DEFAULT ''::text NOT NULL,
|
||||
post_ids integer[] DEFAULT '{}'::integer[] NOT NULL,
|
||||
post_count integer DEFAULT 0 NOT NULL,
|
||||
is_deleted boolean DEFAULT false NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
@@ -7578,6 +7578,7 @@ INSERT INTO "schema_migrations" (version) VALUES
|
||||
('20180816230604'),
|
||||
('20180912185624'),
|
||||
('20180913184128'),
|
||||
('20180916002448');
|
||||
('20180916002448'),
|
||||
('20181108162204');
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user