yiekheng ea7d07b2c8 perf(db): composite index (account_id, name) + hide archived groups
Two related follow-ups for the 3 000+ groups-per-account scale path:

1. New B-tree index on whatsapp_groups (account_id, name) (migration
   0014). Covers the groups list page's
   `WHERE account_id=? ORDER BY name ASC LIMIT 200` query so PG
   streams pre-sorted from the index instead of pulling all rows
   then sorting. The unique (account_id, wa_group_jid) was the only
   prior B-tree on this table; it backed the WHERE prefix but not
   the ORDER BY.

2. listGroupsForAccount now filters `is_archived = false` in both
   the search and the no-search branch. Soft-archived groups
   (set when group-sync sees them disappear from the live
   participant list, or when an operator unpairs the account) used
   to leak into the wizard picker, letting operators pick a group
   the bot can no longer reach. Archived rows still exist in DB so
   reminders that target them keep working; a re-pair flips them
   back via the on-conflict upsert.

README "Deferred" entry for the composite index removed (it's
shipped). Search-as-you-type in the wizard picker stays deferred.

482 web + 88 bot tests still green; typecheck clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 21:57:17 +08:00

111 lines
1.9 KiB
JSON

{
"version": "7",
"dialect": "postgresql",
"entries": [
{
"idx": 0,
"version": "7",
"when": 1778311164225,
"tag": "0000_conscious_tarantula",
"breakpoints": true
},
{
"idx": 1,
"version": "7",
"when": 1778320434707,
"tag": "0001_smart_vertigo",
"breakpoints": true
},
{
"idx": 2,
"version": "7",
"when": 1778338808600,
"tag": "0002_left_jimmy_woo",
"breakpoints": true
},
{
"idx": 3,
"version": "7",
"when": 1778343712901,
"tag": "0003_messy_bruce_banner",
"breakpoints": true
},
{
"idx": 4,
"version": "7",
"when": 1778345543406,
"tag": "0004_next_prowler",
"breakpoints": true
},
{
"idx": 5,
"version": "7",
"when": 1778347437350,
"tag": "0005_flippant_joystick",
"breakpoints": true
},
{
"idx": 6,
"version": "7",
"when": 1778385559051,
"tag": "0006_adorable_nehzno",
"breakpoints": true
},
{
"idx": 7,
"version": "7",
"when": 1778386591494,
"tag": "0007_overconfident_menace",
"breakpoints": true
},
{
"idx": 8,
"version": "7",
"when": 1778395584234,
"tag": "0008_greedy_matthew_murdock",
"breakpoints": true
},
{
"idx": 9,
"version": "7",
"when": 1778464000000,
"tag": "0009_rename_ended_to_inactive",
"breakpoints": true
},
{
"idx": 10,
"version": "7",
"when": 1778464001000,
"tag": "0010_fancy_wolf_cub",
"breakpoints": true
},
{
"idx": 11,
"version": "7",
"when": 1778464002000,
"tag": "0011_premium_grandmaster",
"breakpoints": true
},
{
"idx": 12,
"version": "7",
"when": 1778464003000,
"tag": "0012_lucky_masked_marvel",
"breakpoints": true
},
{
"idx": 13,
"version": "7",
"when": 1778464004000,
"tag": "0013_tricky_yellowjacket",
"breakpoints": true
},
{
"idx": 14,
"version": "7",
"when": 1778464005000,
"tag": "0014_lame_puck",
"breakpoints": true
}
]
}