max / makenotwork
| 1 | -- Drop the denormalized reply_count (added in 022). It was incremented on reply |
| 2 | -- but never decremented on mod-remove/soft-delete, so it drifted upward |
| 3 | -- permanently and the >= 0 CHECK blocked the naive decrement fix. Reply counts |
| 4 | -- are now computed live at read time from non-removed posts |
| 5 | -- (GREATEST(COUNT(*) FILTER (WHERE removed_at IS NULL) - 1, 0)), which cannot |
| 6 | -- drift. Dropping the column also drops the reply_count_non_negative CHECK. |
| 7 | threads DROP COLUMN reply_count; |
| 8 |