**: Create separate schemas 2. Phase 2: Dual-write to both monolithic and new databases 3. Phase 3: Migrate read operations to new databases 4. Phase 4: Remove dual-write, use only new databases 5. Phase 5: Decommission monolithic database
While all services currently use PostgreSQL, the architecture supports:
- MongoDB for document-heavy services
- Redis for caching and session storage
- Elasticsearch for search-intensive services
- TimescaleDB for time-series analytics
- Never access another service's database directly
- Use service APIs or events for cross-service data access
- Implement proper connection pooling
- Monitor database performance independently
- Backup each database separately
- Version control all schema changes
- Test migrations in staging before production
# Test database connectivity
psql -h localhost -p 5432 -U user -d nepa_user_service# Reset a specific service database
npx prisma migrate reset --schema=databases/user-service/schema.prisma# Clean and regenerate
rm -rf node_modules/.prisma
npm run db:generate-all