pools: drop post_count column (fix #3667)
This commit is contained in:
10
db/migrate/20181108205842_drop_post_count_from_pools.rb
Normal file
10
db/migrate/20181108205842_drop_post_count_from_pools.rb
Normal 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
|
||||
@@ -2564,7 +2564,6 @@ CREATE TABLE public.pools (
|
||||
description text,
|
||||
is_active boolean DEFAULT true 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,
|
||||
updated_at timestamp without time zone,
|
||||
@@ -7579,6 +7578,7 @@ INSERT INTO "schema_migrations" (version) VALUES
|
||||
('20180912185624'),
|
||||
('20180913184128'),
|
||||
('20180916002448'),
|
||||
('20181108162204');
|
||||
('20181108162204'),
|
||||
('20181108205842');
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user