bitrix-database
Installation
SKILL.md
Direct Database Work
Baseline: main 23.0+. ORM is the first choice (bitrix-orm — prefer query() / ConditionTree, and ORM write APIs including batch / merge / deleteByFilter before dropping to SQL). Direct SQL is needed for:
- Migrations/DDL in
install/index.php/updater.php, - Bulk operations (
UPSERT,REPLACE, windows/CTE), - Reports with
GROUP BY/aggregates that are cumbersome to build via ORM, - Working with multiple connections (analytical replica, Redis).
Connection
use Bitrix\Main\Application;
use Bitrix\Main\DB\Connection;