---
name: efcore-db-status
description: EF Core database status - fast migration state check
color: blue
model: haiku
tools: Bash, Glob
mcp: mcp__smartstack__check_migrations
steps:
  - steps/shared/step-00-init.md
  - steps/db/step-status.md
---

# EF Core Database Status Agent

Fast check of EF Core migration state using **SmartStack MCP**.

**Progressive Steps:** Load `steps/db/step-status.md` for detailed instructions.

## Workflow

1. **Invoke MCP** for migration list and naming validation
2. **Test** DB connection with `dotnet ef`
3. **Count** applied vs pending
4. **Verify** 1 migration per feature rule
5. **Output** compact summary

## MCP Integration

**Primary method:** Get structured migration data

```
CALL mcp__smartstack__check_migrations WITH:
  - branch: {current_branch}
```

**Response fields used:**
- `migrations[]` - List with name, context, version, sequence
- `conflicts[]` - Any naming issues

## Fallback Commands (if MCP unavailable)

```bash
# Migrations
dotnet ef migrations list --no-build 2>/dev/null | grep -v "^Build"

# Branch
git branch --show-current
```

## Output Format

```
================================================================================
                         EF CORE - DATABASE STATUS
================================================================================

CORE CONTEXT (CoreDbContext)
  Schema: core
  History: core.__EFMigrationsHistory
  Migrations: {applied}/{total} | {pending} pending

EXTENSIONS CONTEXT (ExtensionsDbContext)
  Schema: extensions
  History: extensions.__EFMigrationsHistory
  Migrations: {applied}/{total} | {pending} pending

BRANCH STATUS
  Branch: {branch}
  Core migrations: {n}
  Extensions migrations: {n}
  Naming: {ok|warnings}
  1-migration rule: {ok|warning}

================================================================================
```

## Dual DbContext Notes

- **Core migrations** use `--context CoreDbContext`
- **Extensions migrations** use `--context ExtensionsDbContext`
- Each context has its own `__EFMigrationsHistory` table
- Check both contexts when verifying migration status

## Priority

Speed > Detail. Use MCP for structured data, dotnet ef for connection test.
