Simplify: O2M batch, domain dedup, db.go split, constants
Performance:
- O2M formatO2MFields: N+1 → single batched query per O2M field
(collect parent IDs, WHERE inverse IN (...), group by parent)
Code dedup:
- domain.go compileSimpleCondition: 80 lines → 12 lines by delegating
to compileQualifiedCondition (eliminates duplicate operator handling)
- db.go SeedWithSetup: 170-line monolith → 5 focused sub-functions
(seedCurrencyAndCountry, seedCompanyAndAdmin, seedJournalsAndSequences,
seedChartOfAccounts, resetSequences)
Quality:
- Magic numbers (80, 200, 8) replaced with named constants
- Net -34 lines
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>