Data access patterns, Scaling, Migrations, and ORM selection.
| Feature Needed | Primary Choice | Alternative |
|---|---|---|
| General Purpose App | PostgreSQL | MySQL |
| Flexible JSON Docs | MongoDB | PostgreSQL (JSONB) |
| Search Engine | ElasticSearch | PostgreSQL (Full Text) |
| Financial Transactions | PostgreSQL | (None) |
@InjectRepository(Entity).PrismaService.TypeOrmModule.forRootAsync to load secrets from ConfigService.synchronize: false in production; use migrations instead.replication connections (Master for Write, Slaves for Read) in TypeORM/Prisma to distribute load.synchronize: true in production.@DeleteDateColumn (TypeORM) or middleware (Prisma) to preserve data integrity.tenant_id column.
Where scopes.user_id) across physical nodes to exceed single-node write limits.created_at) are included in WHERE clauses to enable "Partition Pruning".CREATE TABLE, ADD COLUMN). Fast. Run before app deploy.UPDATE users SET name = ...). Slow. Run as background jobs or separate scripts purely to avoid locking tables for too long.new_field (nullable). Deploy App v1 (Writes to both old and new).old to new in batches (background script).new). Drop old_field in next schema migration.@faker-js/faker) to generate mock data.where, order by).QueryRunner (TypeORM) or $transaction (Prisma) for all multi-step mutations to ensure atomicity.