Database technology selection, schema design, query optimization, and migration guidance for MongoDB, SQL Server, PostgreSQL, and Redis...
Guide database technology selection, schema design, query optimization, and migration patterns -- with EasyPlatform-specific context for service-to-database mapping.
easyplatform-backend skill (repositories follow platform patterns)arch-cross-service-integration skill (must use message bus, never direct DB access)easyplatform-backend skillfrontend-angular-api-service skilldocs/claude/architecture.md for service boundaries| Service | Database | Technology | Connection |
|---|---|---|---|
| TextSnippet | Example service data | MongoDB | localhost:27017 (root/rootPassXXX) |
| TextSnippet (EF) | Example service data | SQL Server | localhost,14330 (sa/123456Abc) |
| TextSnippet (PG) | Example service data | PostgreSQL | localhost:54320 (postgres/postgres) |
| Caching | Session, rate limiting | Redis | localhost:6379 |
| Messaging | Event bus | RabbitMQ | localhost:15672 (guest/guest) |
CRITICAL: Each service owns its database. Never access another service's database directly -- use the message bus.
IF using MongoDB persistence module THEN MongoDB patterns apply. IF using EF Core with SQL Server THEN SQL Server / EF Core patterns apply. IF using EF Core with PostgreSQL THEN PostgreSQL / EF Core patterns apply. IF caching or session data THEN Redis patterns apply.
| Task | Go To |
|---|---|
| New entity/schema design | Step 3A |
| Query optimization | Step 3B |
| Migration | Step 3C |
| Index design | Step 3D |
{service}:{entity}:{id})[PlatformNavigationProperty] where neededEXPLAIN ANALYZE / MongoDB .explain())loadRelatedEntities parameter in repository callsdotnet ef migrations add MigrationName --project [Service].Persistence
dotnet ef database update
PlatformMongoMigrationExecutor<ServiceDbContext> classYYYYMMDD_DescriptionPlatformDataMigrationExecutor<DbContext>db.collection.createIndex({ companyId: 1, status: 1, createdDate: -1 })
CREATE INDEX IX_Employee_CompanyId_Status ON Employees(CompanyId, Status) INCLUDE (Name);
## Database: [Task Summary]
### Context
- Service: [Service name]
- Database: [MongoDB | SQL Server | PostgreSQL | Redis]
- Task: [schema | query | migration | index]
### Recommendation
[Specific technical recommendation]
### Implementation
[Code or SQL/MongoDB commands]
### Verification
[How to confirm correctness]
Load for database-specific deep dives:
| Topic | File |
|---|---|
| MongoDB CRUD | references/mongodb-crud.md |
| MongoDB aggregation | references/mongodb-aggregation.md |
| MongoDB indexes | references/mongodb-indexing.md |
| MongoDB Atlas | references/mongodb-atlas.md |
| PostgreSQL queries | references/postgresql-queries.md |
| PostgreSQL CLI | references/postgresql-psql-cli.md |
| PostgreSQL performance | references/postgresql-performance.md |
| PostgreSQL admin | references/postgresql-administration.md |
easyplatform-backend -- for C# repository, entity, and migration execution patternsdatabase-optimization -- for advanced performance tuning and N+1 preventionarch-cross-service-integration -- for cross-service data access via message busIMPORTANT Task Planning Notes (MUST FOLLOW)