# Agent Instructions for dcrouter ## Database & Migrations ### Collection Names smartdata uses the **exact class name** as the MongoDB collection name. No lowercasing. - `StoredRouteDoc` → collection `StoredRouteDoc` - `TargetProfileDoc` → collection `TargetProfileDoc` - `RouteDoc` → collection `RouteDoc` When writing migrations in `ts_migrations/index.ts`, use the exact class name casing in `ctx.mongo!.collection('ClassName')` and `db.listCollections({ name: 'ClassName' })`. ### Migration Rules - All DB schema migrations go EXCLUSIVELY in `ts_migrations/index.ts` as smartmigration steps. - NEVER put migration logic in application code (services, managers, startup hooks). - Migration step `.to()` version must match the release version so smartmigration can plan the step. - Steps must be idempotent — smartmigration may re-run them in skip-forward resume mode.