mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-10-09 00:00:12 +09:00
Repair message counters within database task pools
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
# Keeps rooms.messages_count correct for every SQLite writer — Rails, bulk SQL,
|
||||
# Keeps rooms.messages_count correct for ordinary SQLite writes — Rails, bulk SQL,
|
||||
# and foreign connections — without ActiveRecord counter_cache callbacks that
|
||||
# those paths skip (and that would double-count if combined with triggers).
|
||||
# Foreign REPLACE writes require PRAGMA recursive_triggers=ON so SQLite also
|
||||
# fires the delete trigger. Migrations rebuilding messages must call ensure!
|
||||
# before reading counters inside that migration; database tasks repair afterwards.
|
||||
class Room::MessagesCount
|
||||
INSERT_TRIGGER = "messages_ai_rooms_messages_count"
|
||||
DELETE_TRIGGER = "messages_ad_rooms_messages_count"
|
||||
|
||||
Reference in New Issue
Block a user