1 defmodule Pleroma.Repo.Migrations.FixMissingFollowingCount do
9 following_count = sub.count
14 ,COUNT (following_relationships.id)
16 following_relationships
19 users.id = following_relationships.follower_id
20 AND following_relationships.state = 'accept'
26 AND users.local = TRUE
37 following_count IS NULL
41 execute("ALTER TABLE users
42 ALTER COLUMN following_count SET DEFAULT 0,
43 ALTER COLUMN following_count SET NOT NULL
48 execute("ALTER TABLE users
49 ALTER COLUMN following_count DROP DEFAULT,
50 ALTER COLUMN following_count DROP NOT NULL