---
description: Display migrations and database status
agent: efcore-db-status
model: haiku
---

# EF Core Database Status

> **Ref:** [_shared.md](_shared.md)
> **MCP:** `mcp__smartstack__check_migrations`
> **Type:** Read-only, aucune modification

---

## STEP 1: Détecter Configuration

```bash
detect_efcore_project
detect_environment
```

---

## STEP 2: Invoquer MCP

```json
{
  "tool": "mcp__smartstack__check_migrations",
  "parameters": { "branch": "<current_branch>" }
}
```

Extraire: `migrations[]`, `conflicts[]`

---

## STEP 3: Tester Connexion

```bash
CONNECTION_OK=$(dotnet ef database list 2>&1)
```

---

## STEP 4: Compter Migrations

```bash
APPLIED=$(dotnet ef migrations list | grep -v "(Pending)" | wc -l)
PENDING=$(dotnet ef migrations list | grep "(Pending)" | wc -l)
```

---

## Résumé

```
STATUS EF CORE
├── Projet: {PROJECT_NAME}
├── Config: {CONFIG_USED}
├── Connexion: {✓ OK / ✗ Erreur}
├── Base: {DATABASE_NAME}
├── Migrations: {TOTAL} (appliquées: {APPLIED}, en attente: {PENDING})
├── Conformité nommage: {✓ Conforme / ⚠ Avertissements}
└── Règle 1 migration/feature: {✓ OK / ⚠ {N} migrations sur cette branche}
```

**Si erreur connexion:**
```
TROUBLESHOOTING
├── SQL Server démarré?
├── appsettings.Local.json configuré?
├── Base de données existe?
└── Commandes: /efcore:db-reset, /gitflow:10-start
```

---

## Options

| Option | Description |
|--------|-------------|
| `--verbose` | Afficher toutes migrations |
| `--json` | Output JSON |
| `--context {name}` | Spécifier DbContext |
