@atlashub/smartstack-cli 1.11.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.documentation/agents.html +7 -2
- package/.documentation/apex.html +7 -2
- package/.documentation/business-analyse.html +7 -2
- package/.documentation/cli-commands.html +871 -0
- package/.documentation/commands.html +7 -2
- package/.documentation/efcore.html +7 -2
- package/.documentation/gitflow.html +7 -2
- package/.documentation/hooks.html +7 -2
- package/.documentation/index.html +7 -2
- package/.documentation/init.html +7 -2
- package/.documentation/installation.html +7 -2
- package/.documentation/ralph-loop.html +7 -2
- package/.documentation/test-web.html +7 -2
- package/dist/index.js +1932 -336
- package/dist/index.js.map +1 -1
- package/package.json +8 -2
- package/templates/agents/efcore/squash.md +67 -31
- package/templates/agents/gitflow/finish.md +68 -56
- package/templates/commands/business-analyse/0-orchestrate.md +72 -556
- package/templates/commands/business-analyse/1-init.md +23 -193
- package/templates/commands/business-analyse/2-discover.md +85 -462
- package/templates/commands/business-analyse/3-analyse.md +40 -342
- package/templates/commands/business-analyse/4-specify.md +72 -537
- package/templates/commands/business-analyse/5-validate.md +43 -237
- package/templates/commands/business-analyse/6-handoff.md +93 -682
- package/templates/commands/business-analyse/7-doc-html.md +45 -544
- package/templates/commands/business-analyse/_shared.md +176 -0
- package/templates/commands/business-analyse/bug.md +50 -257
- package/templates/commands/business-analyse/change-request.md +59 -283
- package/templates/commands/business-analyse/hotfix.md +36 -120
- package/templates/commands/business-analyse.md +55 -574
- package/templates/commands/efcore/_shared.md +206 -0
- package/templates/commands/efcore/conflicts.md +39 -201
- package/templates/commands/efcore/db-deploy.md +28 -237
- package/templates/commands/efcore/db-reset.md +41 -390
- package/templates/commands/efcore/db-seed.md +44 -323
- package/templates/commands/efcore/db-status.md +31 -210
- package/templates/commands/efcore/migration.md +45 -368
- package/templates/commands/efcore/rebase-snapshot.md +38 -241
- package/templates/commands/efcore/scan.md +35 -204
- package/templates/commands/efcore/squash.md +158 -251
- package/templates/commands/efcore.md +49 -177
- package/templates/commands/gitflow/1-init.md +94 -1318
- package/templates/commands/gitflow/10-start.md +86 -990
- package/templates/commands/gitflow/11-finish.md +264 -454
- package/templates/commands/gitflow/12-cleanup.md +40 -213
- package/templates/commands/gitflow/2-status.md +51 -386
- package/templates/commands/gitflow/3-commit.md +108 -801
- package/templates/commands/gitflow/4-plan.md +42 -13
- package/templates/commands/gitflow/5-exec.md +60 -5
- package/templates/commands/gitflow/6-abort.md +54 -277
- package/templates/commands/gitflow/7-pull-request.md +74 -717
- package/templates/commands/gitflow/8-review.md +51 -178
- package/templates/commands/gitflow/9-merge.md +74 -404
- package/templates/commands/gitflow/_shared.md +196 -0
- package/templates/commands/quickstart.md +154 -0
- package/templates/commands/ralph-loop/ralph-loop.md +104 -2
- package/templates/hooks/hooks.json +13 -0
- package/templates/hooks/ralph-mcp-logger.sh +46 -0
- package/templates/hooks/ralph-session-end.sh +69 -0
- package/templates/ralph/README.md +91 -0
- package/templates/ralph/ralph.config.yaml +113 -0
- package/templates/scripts/setup-ralph-loop.sh +173 -0
- package/templates/skills/_shared.md +117 -0
- package/templates/skills/ai-prompt/SKILL.md +87 -654
- package/templates/skills/application/SKILL.md +76 -499
- package/templates/skills/controller/SKILL.md +38 -165
- package/templates/skills/documentation/SKILL.md +2 -1
- package/templates/skills/feature-full/SKILL.md +107 -732
- package/templates/skills/notification/SKILL.md +85 -474
- package/templates/skills/ui-components/SKILL.md +62 -762
- package/templates/skills/workflow/SKILL.md +85 -489
- package/templates/commands/gitflow/rescue.md +0 -867
- package/templates/skills/business-analyse/SKILL.md +0 -191
|
@@ -4,329 +4,111 @@ agent: efcore-migration
|
|
|
4
4
|
model: sonnet
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# EF Core Migration
|
|
7
|
+
# EF Core Migration
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
**GOLDEN RULE: 1 single migration per feature/hotfix. If it already exists, delete and recreate it.**
|
|
12
|
-
|
|
13
|
-
> **CLAUDE INSTRUCTION:** The `AskUserQuestion({...})` blocks are instructions to use the `AskUserQuestion` tool **interactively**. You MUST execute the tool with these parameters to get the user's response BEFORE continuing.
|
|
9
|
+
> **Ref:** [_shared.md](_shared.md)
|
|
10
|
+
> **Règle:** 1 migration par feature. Si existe déjà, supprimer et recréer.
|
|
14
11
|
|
|
15
12
|
---
|
|
16
13
|
|
|
17
|
-
## STEP 0: Cross-Branch
|
|
18
|
-
|
|
19
|
-
**NEW:** Before creating a migration, check for conflicts with other branches.
|
|
14
|
+
## STEP 0: Validation Cross-Branch
|
|
20
15
|
|
|
21
16
|
```bash
|
|
22
|
-
# Check if cross-branch validation is enabled
|
|
23
|
-
CROSS_BRANCH_ENABLED=$(git config --get efcore.crossBranch.enabled 2>/dev/null || echo "true")
|
|
24
|
-
BLOCK_ON_CONFLICT=$(git config --get efcore.crossBranch.blockOnConflict 2>/dev/null || echo "true")
|
|
25
|
-
|
|
26
17
|
if [ "$CROSS_BRANCH_ENABLED" = "true" ]; then
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# Compare ModelSnapshot with develop
|
|
34
|
-
LOCAL_SNAPSHOT=$(find . -name "*ModelSnapshot.cs" -not -path "*/node_modules/*" | head -1)
|
|
35
|
-
DEVELOP_SNAPSHOT=$(find "$WORKTREE_BASE/develop" -name "*ModelSnapshot.cs" | head -1)
|
|
36
|
-
|
|
37
|
-
if [ -n "$LOCAL_SNAPSHOT" ] && [ -n "$DEVELOP_SNAPSHOT" ]; then
|
|
38
|
-
if ! diff -q "$LOCAL_SNAPSHOT" "$DEVELOP_SNAPSHOT" > /dev/null 2>&1; then
|
|
39
|
-
# Differences detected - analyze risk level
|
|
40
|
-
DIFF_LINES=$(diff "$DEVELOP_SNAPSHOT" "$LOCAL_SNAPSHOT" 2>/dev/null | wc -l)
|
|
41
|
-
|
|
42
|
-
if [ "$DIFF_LINES" -gt 100 ]; then
|
|
43
|
-
echo ""
|
|
44
|
-
echo "WARNING: CROSS-BRANCH CONFLICT DETECTED"
|
|
45
|
-
echo ""
|
|
46
|
-
echo "Your ModelSnapshot differs significantly from develop."
|
|
47
|
-
echo "Differences: $DIFF_LINES lines"
|
|
48
|
-
echo ""
|
|
49
|
-
echo "RESOLUTIONS:"
|
|
50
|
-
echo " 1. /efcore:rebase-snapshot (recommended)"
|
|
51
|
-
echo " 2. /efcore:conflicts (see details)"
|
|
52
|
-
echo " 3. /efcore:migration --force (not recommended)"
|
|
53
|
-
echo ""
|
|
54
|
-
|
|
55
|
-
if [ "$BLOCK_ON_CONFLICT" = "true" ]; then
|
|
56
|
-
echo "BLOCKED: Use --force to ignore"
|
|
57
|
-
exit 1
|
|
58
|
-
fi
|
|
59
|
-
fi
|
|
60
|
-
fi
|
|
61
|
-
fi
|
|
18
|
+
# Comparer ModelSnapshot avec develop
|
|
19
|
+
DIFF_LINES=$(diff "$LOCAL_SNAPSHOT" "$DEVELOP_SNAPSHOT" 2>/dev/null | wc -l)
|
|
20
|
+
if [ "$DIFF_LINES" -gt 100 ]; then
|
|
21
|
+
echo "⚠️ CONFLIT CROSS-BRANCH DÉTECTÉ ($DIFF_LINES lignes)"
|
|
22
|
+
echo "→ /efcore:rebase-snapshot (recommandé)"
|
|
23
|
+
[ "$BLOCK_ON_CONFLICT" = "true" ] && exit 1
|
|
62
24
|
fi
|
|
63
|
-
|
|
64
|
-
echo "Cross-branch validation: OK"
|
|
65
25
|
fi
|
|
66
26
|
```
|
|
67
27
|
|
|
68
|
-
|
|
69
|
-
- `--force` : Ignore cross-branch validation
|
|
70
|
-
- `--no-cross-check` : Disable validation for this execution
|
|
71
|
-
- `--rebase-first` : Run rebase-snapshot automatically if conflict
|
|
28
|
+
Options: `--force`, `--no-cross-check`, `--rebase-first`
|
|
72
29
|
|
|
73
30
|
---
|
|
74
31
|
|
|
75
|
-
## STEP 1:
|
|
32
|
+
## STEP 1: Contexte Git
|
|
76
33
|
|
|
77
34
|
```bash
|
|
78
|
-
# Current branch
|
|
79
35
|
CURRENT_BRANCH=$(git branch --show-current)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if [[ "$CURRENT_BRANCH" == feature/* ]]; then
|
|
83
|
-
BRANCH_TYPE="Feature"
|
|
84
|
-
BRANCH_NAME=$(echo "$CURRENT_BRANCH" | sed 's/feature\///' | sed 's/-/_/g' | sed 's/\b\w/\u&/g')
|
|
85
|
-
elif [[ "$CURRENT_BRANCH" == hotfix/* ]]; then
|
|
86
|
-
BRANCH_TYPE="Hotfix"
|
|
87
|
-
BRANCH_NAME=$(echo "$CURRENT_BRANCH" | sed 's/hotfix\///' | sed 's/-/_/g' | sed 's/\b\w/\u&/g')
|
|
88
|
-
elif [[ "$CURRENT_BRANCH" == release/* ]]; then
|
|
89
|
-
BRANCH_TYPE="Release"
|
|
90
|
-
BRANCH_NAME=$(echo "$CURRENT_BRANCH" | sed 's/release\///' | sed 's/v//')
|
|
91
|
-
else
|
|
92
|
-
BRANCH_TYPE="Dev"
|
|
93
|
-
BRANCH_NAME="Manual"
|
|
94
|
-
fi
|
|
95
|
-
|
|
96
|
-
# Current version
|
|
97
|
-
VERSION=$(grep -oP '"version":\s*"\K[^"]+' package.json 2>/dev/null || grep -oP '(?<=<Version>).*(?=</Version>)' *.csproj 2>/dev/null | head -1)
|
|
98
|
-
VERSION_CLEAN=$(echo "$VERSION" | sed 's/\./_/g')
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## STEP 2: Detect EF Core Project et Environnement
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
# Find the project with EF Core
|
|
107
|
-
CSPROJ=$(find . -name "*.csproj" -exec grep -l "Microsoft.EntityFrameworkCore" {} \; | head -1)
|
|
108
|
-
PROJECT_DIR=$(dirname "$CSPROJ")
|
|
109
|
-
PROJECT_NAME=$(basename "$CSPROJ" .csproj)
|
|
110
|
-
|
|
111
|
-
# Migrations folder
|
|
112
|
-
MIGRATIONS_DIR="$PROJECT_DIR/Migrations"
|
|
113
|
-
|
|
114
|
-
# Detect API project for environment display
|
|
115
|
-
API_DIR=$(find . -type d -name "*.Api" | head -1)
|
|
116
|
-
[ -z "$API_DIR" ] && API_DIR="src/SmartStack.Api"
|
|
117
|
-
|
|
118
|
-
# Detect appsettings to show which DB will be affected on deploy
|
|
119
|
-
SELECTED_ENV="appsettings.Local.json"
|
|
120
|
-
if [ -f "$API_DIR/$SELECTED_ENV" ]; then
|
|
121
|
-
CONNECTION_STRING=$(powershell -Command "
|
|
122
|
-
\$json = Get-Content '$API_DIR/$SELECTED_ENV' -ErrorAction SilentlyContinue | ConvertFrom-Json
|
|
123
|
-
\$json.ConnectionStrings.DefaultConnection
|
|
124
|
-
" 2>/dev/null)
|
|
125
|
-
DATABASE_NAME=$(echo "$CONNECTION_STRING" | grep -oP 'Database=\K[^;]+' 2>/dev/null)
|
|
126
|
-
fi
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
**Afficher info environnement (informatif):**
|
|
130
|
-
|
|
131
|
-
```
|
|
132
|
-
NOTE: La migration sera appliquee sur: {DATABASE_NAME:-"(detecte au deploy)"}
|
|
133
|
-
Config: {SELECTED_ENV}
|
|
36
|
+
# Extraire type (feature/hotfix/release) et nom
|
|
37
|
+
detect_efcore_project
|
|
134
38
|
```
|
|
135
39
|
|
|
136
40
|
---
|
|
137
41
|
|
|
138
|
-
## STEP
|
|
42
|
+
## STEP 2: Recherche Migration Existante
|
|
139
43
|
|
|
140
44
|
```bash
|
|
141
|
-
# Search pattern based on branch name
|
|
142
45
|
SEARCH_PATTERN="${BRANCH_TYPE}_.*_${BRANCH_NAME}"
|
|
143
|
-
|
|
144
|
-
# Find matching migration files
|
|
145
|
-
EXISTING_MIGRATIONS=$(find "$MIGRATIONS_DIR" -name "*.cs" | grep -E "$SEARCH_PATTERN" | grep -v "Designer" | grep -v "Snapshot")
|
|
146
|
-
MIGRATION_COUNT=$(echo "$EXISTING_MIGRATIONS" | grep -c "." || echo "0")
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
**Display context:**
|
|
150
|
-
|
|
151
|
-
```
|
|
152
|
-
================================================================================
|
|
153
|
-
EF CORE MIGRATION - CONTEXT
|
|
154
|
-
================================================================================
|
|
155
|
-
|
|
156
|
-
BRANCH
|
|
157
|
-
Current: {CURRENT_BRANCH}
|
|
158
|
-
Type: {BRANCH_TYPE}
|
|
159
|
-
Name: {BRANCH_NAME}
|
|
160
|
-
|
|
161
|
-
VERSION: {VERSION}
|
|
162
|
-
|
|
163
|
-
EXISTING MIGRATIONS FOR THIS BRANCH:
|
|
164
|
-
{MIGRATION_COUNT} migration(s) found
|
|
165
|
-
{File list if > 0}
|
|
166
|
-
|
|
167
|
-
================================================================================
|
|
46
|
+
EXISTING_MIGRATIONS=$(find "$MIGRATIONS_DIR" -name "*.cs" | grep -E "$SEARCH_PATTERN")
|
|
168
47
|
```
|
|
169
48
|
|
|
170
49
|
---
|
|
171
50
|
|
|
172
|
-
## STEP
|
|
173
|
-
|
|
174
|
-
### If existing migration (MIGRATION_COUNT > 0):
|
|
51
|
+
## STEP 3: Décision
|
|
175
52
|
|
|
176
53
|
```javascript
|
|
54
|
+
// Si migration existe
|
|
177
55
|
AskUserQuestion({
|
|
178
56
|
questions: [{
|
|
179
|
-
question: "
|
|
57
|
+
question: "Migration existante. Que faire?",
|
|
180
58
|
header: "Migration",
|
|
181
59
|
options: [
|
|
182
|
-
{ label: "
|
|
183
|
-
{ label: "
|
|
184
|
-
{ label: "
|
|
60
|
+
{ label: "Recréer", description: "Supprimer et recréer (Recommandé)" },
|
|
61
|
+
{ label: "Garder", description: "Conserver, ajouter nouvelle (Non recommandé)" },
|
|
62
|
+
{ label: "Annuler", description: "Ne rien faire" }
|
|
185
63
|
],
|
|
186
64
|
multiSelect: false
|
|
187
65
|
}]
|
|
188
66
|
})
|
|
189
67
|
```
|
|
190
68
|
|
|
191
|
-
**If Recreate:**
|
|
192
|
-
|
|
193
|
-
```bash
|
|
194
|
-
# 1. List migrations to delete
|
|
195
|
-
echo "Migrations to delete:"
|
|
196
|
-
for file in $EXISTING_MIGRATIONS; do
|
|
197
|
-
echo " - $file"
|
|
198
|
-
# Find associated files (Designer, etc.)
|
|
199
|
-
BASE_NAME=$(basename "$file" .cs)
|
|
200
|
-
rm -f "$MIGRATIONS_DIR/${BASE_NAME}.cs"
|
|
201
|
-
rm -f "$MIGRATIONS_DIR/${BASE_NAME}.Designer.cs"
|
|
202
|
-
done
|
|
203
|
-
|
|
204
|
-
# 2. Rollback in DB if applied
|
|
205
|
-
LAST_GOOD_MIGRATION=$(dotnet ef migrations list 2>/dev/null | grep -v "(Pending)" | tail -2 | head -1)
|
|
206
|
-
if [ -n "$LAST_GOOD_MIGRATION" ]; then
|
|
207
|
-
dotnet ef database update "$LAST_GOOD_MIGRATION" --force
|
|
208
|
-
fi
|
|
209
|
-
```
|
|
210
|
-
|
|
211
69
|
---
|
|
212
70
|
|
|
213
|
-
## STEP
|
|
71
|
+
## STEP 4: Nom Migration
|
|
72
|
+
|
|
73
|
+
Pattern: `{context}_v{version}_{sequence}_{Description}`
|
|
214
74
|
|
|
215
75
|
```javascript
|
|
216
76
|
AskUserQuestion({
|
|
217
77
|
questions: [{
|
|
218
|
-
question: "
|
|
78
|
+
question: "Description courte (ex: AddUserRoles)",
|
|
219
79
|
header: "Description",
|
|
220
80
|
options: [
|
|
221
|
-
{ label: "Add", description: "
|
|
222
|
-
{ label: "Update", description: "
|
|
223
|
-
{ label: "Fix", description: "
|
|
224
|
-
{ label: "Remove", description: "
|
|
81
|
+
{ label: "Add", description: "Ajout tables/colonnes" },
|
|
82
|
+
{ label: "Update", description: "Modification structure" },
|
|
83
|
+
{ label: "Fix", description: "Correction schéma" },
|
|
84
|
+
{ label: "Remove", description: "Suppression éléments" }
|
|
225
85
|
],
|
|
226
86
|
multiSelect: false
|
|
227
87
|
}]
|
|
228
88
|
})
|
|
229
|
-
|
|
230
|
-
// Then ask for specific name in free text
|
|
231
|
-
// E.g., "AddUserRoles", "FixEmailNullable", "RemoveObsoleteTable"
|
|
232
89
|
```
|
|
233
90
|
|
|
234
91
|
---
|
|
235
92
|
|
|
236
|
-
## STEP
|
|
93
|
+
## STEP 5: Création
|
|
237
94
|
|
|
238
95
|
```bash
|
|
239
|
-
# Pattern: {context}_v{version}_{sequence}_{Description}
|
|
240
|
-
# Example: core_v1.0.0_001_AddUserRoles
|
|
241
|
-
# This format is aligned with SmartStack MCP conventions
|
|
242
|
-
|
|
243
|
-
# Determine context based on branch type
|
|
244
|
-
if [[ "$BRANCH_TYPE" == "Feature" ]] || [[ "$BRANCH_TYPE" == "Hotfix" ]]; then
|
|
245
|
-
CONTEXT="core" # Default context for feature/hotfix
|
|
246
|
-
else
|
|
247
|
-
CONTEXT="core"
|
|
248
|
-
fi
|
|
249
|
-
|
|
250
|
-
# Get next sequence number
|
|
251
|
-
EXISTING_COUNT=$(find "$MIGRATIONS_DIR" -name "${CONTEXT}_v${VERSION}*.cs" | grep -v "Designer" | grep -v "Snapshot" | wc -l)
|
|
252
|
-
SEQUENCE=$(printf "%03d" $((EXISTING_COUNT + 1)))
|
|
253
|
-
|
|
254
|
-
MIGRATION_NAME="${CONTEXT}_v${VERSION}_${SEQUENCE}_${DESCRIPTION}"
|
|
255
|
-
|
|
256
|
-
# Clean the name (no spaces, no special characters except underscore and dot)
|
|
257
|
-
MIGRATION_NAME=$(echo "$MIGRATION_NAME" | sed 's/[^a-zA-Z0-9_.]//g')
|
|
258
|
-
|
|
259
|
-
echo "Migration name: $MIGRATION_NAME"
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
**Generated name examples (aligned with MCP):**
|
|
263
|
-
|
|
264
|
-
| Context | Version | Sequence | Description | Final Name |
|
|
265
|
-
|---------|---------|----------|-------------|------------|
|
|
266
|
-
| core | 1.2.0 | 001 | AddUserRoles | core_v1.2.0_001_AddUserRoles |
|
|
267
|
-
| core | 1.2.0 | 002 | AddPermissions | core_v1.2.0_002_AddPermissions |
|
|
268
|
-
| extensions | 1.3.0 | 001 | AddCustomFields | extensions_v1.3.0_001_AddCustomFields |
|
|
269
|
-
|
|
270
|
-
---
|
|
271
|
-
|
|
272
|
-
## STEP 7: Create Migration
|
|
273
|
-
|
|
274
|
-
```bash
|
|
275
|
-
cd "$PROJECT_DIR"
|
|
276
|
-
|
|
277
|
-
# Create migration with generated name
|
|
278
96
|
dotnet ef migrations add "$MIGRATION_NAME" --verbose
|
|
279
|
-
|
|
280
|
-
# Verify creation
|
|
281
|
-
if [ $? -eq 0 ]; then
|
|
282
|
-
echo "OK Migration created successfully"
|
|
283
|
-
|
|
284
|
-
# List created files
|
|
285
|
-
NEW_FILES=$(find "$MIGRATIONS_DIR" -name "*${MIGRATION_NAME}*" -type f)
|
|
286
|
-
echo ""
|
|
287
|
-
echo "Created files:"
|
|
288
|
-
for f in $NEW_FILES; do
|
|
289
|
-
echo " - $f"
|
|
290
|
-
done
|
|
291
|
-
else
|
|
292
|
-
echo "ERROR Failed to create migration"
|
|
293
|
-
exit 1
|
|
294
|
-
fi
|
|
295
97
|
```
|
|
296
98
|
|
|
297
99
|
---
|
|
298
100
|
|
|
299
|
-
## STEP
|
|
300
|
-
|
|
301
|
-
```bash
|
|
302
|
-
# Display migration preview
|
|
303
|
-
MIGRATION_FILE=$(find "$MIGRATIONS_DIR" -name "*${MIGRATION_NAME}.cs" | grep -v "Designer" | head -1)
|
|
304
|
-
|
|
305
|
-
echo ""
|
|
306
|
-
echo "================================================================================
|
|
307
|
-
MIGRATION PREVIEW
|
|
308
|
-
================================================================================"
|
|
309
|
-
echo ""
|
|
310
|
-
|
|
311
|
-
# Display Up() and Down() methods
|
|
312
|
-
grep -A 20 "protected override void Up" "$MIGRATION_FILE"
|
|
313
|
-
echo ""
|
|
314
|
-
echo "..."
|
|
315
|
-
echo ""
|
|
316
|
-
grep -A 10 "protected override void Down" "$MIGRATION_FILE"
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
**Verify operations:**
|
|
101
|
+
## STEP 6: Validation
|
|
320
102
|
|
|
321
103
|
```javascript
|
|
322
104
|
AskUserQuestion({
|
|
323
105
|
questions: [{
|
|
324
|
-
question: "
|
|
106
|
+
question: "Migration correcte?",
|
|
325
107
|
header: "Validation",
|
|
326
108
|
options: [
|
|
327
|
-
{ label: "
|
|
328
|
-
{ label: "
|
|
329
|
-
{ label: "
|
|
109
|
+
{ label: "Oui, appliquer", description: "Deploy sur DB locale" },
|
|
110
|
+
{ label: "Oui, pas maintenant", description: "Garder sans appliquer" },
|
|
111
|
+
{ label: "Non, supprimer", description: "Annuler et recommencer" }
|
|
330
112
|
],
|
|
331
113
|
multiSelect: false
|
|
332
114
|
}]
|
|
@@ -335,118 +117,15 @@ AskUserQuestion({
|
|
|
335
117
|
|
|
336
118
|
---
|
|
337
119
|
|
|
338
|
-
##
|
|
339
|
-
|
|
340
|
-
**Afficher un resume apres la creation de la migration:**
|
|
120
|
+
## Résumé
|
|
341
121
|
|
|
342
122
|
```
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
-------------------------------------------------------------------------------
|
|
349
|
-
• Nom: {MIGRATION_NAME}
|
|
350
|
-
• Branche: {CURRENT_BRANCH}
|
|
351
|
-
• Version: {VERSION}
|
|
352
|
-
• Context: {CONTEXT}
|
|
353
|
-
|
|
354
|
-
FICHIERS GÉNÉRÉS
|
|
355
|
-
-------------------------------------------------------------------------------
|
|
356
|
-
✓ {timestamp}_{MIGRATION_NAME}.cs
|
|
357
|
-
✓ {timestamp}_{MIGRATION_NAME}.Designer.cs
|
|
358
|
-
✓ ApplicationDbContextModelSnapshot.cs (mis à jour)
|
|
359
|
-
|
|
360
|
-
VALIDATIONS
|
|
361
|
-
-------------------------------------------------------------------------------
|
|
362
|
-
✓ Règle "1 migration par feature" respectée
|
|
363
|
-
✓ Convention de nommage respectée
|
|
364
|
-
✓ Traçabilité branche/version assurée
|
|
365
|
-
|
|
366
|
-
===============================================================================
|
|
367
|
-
PROCHAINES ÉTAPES
|
|
368
|
-
===============================================================================
|
|
369
|
-
|
|
370
|
-
1. Vérifier le code généré:
|
|
371
|
-
Ouvrir Migrations/{timestamp}_{MIGRATION_NAME}.cs
|
|
372
|
-
|
|
373
|
-
2. Appliquer la migration en local:
|
|
374
|
-
/efcore:db-deploy
|
|
375
|
-
|
|
376
|
-
3. Committer les changements:
|
|
377
|
-
/gitflow:3-commit
|
|
378
|
-
|
|
379
|
-
4. Avant le merge: Rebaser sur develop si nécessaire:
|
|
380
|
-
/efcore:rebase-snapshot
|
|
381
|
-
|
|
382
|
-
===============================================================================
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
**Si des opérations destructives sont détectées:**
|
|
386
|
-
|
|
123
|
+
MIGRATION - {MIGRATION_NAME}
|
|
124
|
+
├── Branche: {CURRENT_BRANCH}
|
|
125
|
+
├── Fichiers: {timestamp}_{NAME}.cs, Designer.cs, Snapshot.cs
|
|
126
|
+
├── Validations: ✓ 1 migration/feature, ✓ Convention nommage
|
|
127
|
+
└── Prochains: /efcore:db-deploy, /gitflow:3-commit
|
|
387
128
|
```
|
|
388
|
-
===============================================================================
|
|
389
|
-
MIGRATION CRÉÉE (AVEC AVERTISSEMENTS)
|
|
390
|
-
===============================================================================
|
|
391
|
-
|
|
392
|
-
DÉTAILS MIGRATION
|
|
393
|
-
-------------------------------------------------------------------------------
|
|
394
|
-
• Nom: {MIGRATION_NAME}
|
|
395
|
-
• Branche: {CURRENT_BRANCH}
|
|
396
|
-
• Version: {VERSION}
|
|
397
|
-
|
|
398
|
-
FICHIERS GÉNÉRÉS
|
|
399
|
-
-------------------------------------------------------------------------------
|
|
400
|
-
✓ {timestamp}_{MIGRATION_NAME}.cs
|
|
401
|
-
✓ {timestamp}_{MIGRATION_NAME}.Designer.cs
|
|
402
|
-
✓ ApplicationDbContextModelSnapshot.cs (mis à jour)
|
|
403
|
-
|
|
404
|
-
AVERTISSEMENTS
|
|
405
|
-
-------------------------------------------------------------------------------
|
|
406
|
-
⚠ Opérations destructives détectées:
|
|
407
|
-
- DropColumn("OldField", "Users") [Ligne 42]
|
|
408
|
-
- DropIndex("IX_Users_Email") [Ligne 48]
|
|
409
|
-
|
|
410
|
-
Ces opérations causeront une PERTE DE DONNÉES.
|
|
411
|
-
Assurez-vous d'avoir un backup avant le déploiement.
|
|
412
|
-
|
|
413
|
-
===============================================================================
|
|
414
|
-
PROCHAINES ÉTAPES
|
|
415
|
-
===============================================================================
|
|
416
|
-
|
|
417
|
-
1. VÉRIFIER les opérations destructives:
|
|
418
|
-
Ouvrir Migrations/{timestamp}_{MIGRATION_NAME}.cs
|
|
419
|
-
|
|
420
|
-
2. Créer un backup de la base si nécessaire:
|
|
421
|
-
Via SSMS ou Azure Portal
|
|
422
|
-
|
|
423
|
-
3. Appliquer la migration en local:
|
|
424
|
-
/efcore:db-deploy
|
|
425
|
-
|
|
426
|
-
4. Committer les changements:
|
|
427
|
-
/gitflow:3-commit
|
|
428
|
-
|
|
429
|
-
===============================================================================
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
---
|
|
433
|
-
|
|
434
|
-
## Migration Conflict Handling
|
|
435
|
-
|
|
436
|
-
When you rebase on develop and there are conflicts on ModelSnapshot:
|
|
437
|
-
|
|
438
|
-
```bash
|
|
439
|
-
# 1. Accept develop version for ModelSnapshot
|
|
440
|
-
git checkout --theirs Migrations/ApplicationDbContextModelSnapshot.cs
|
|
441
|
-
|
|
442
|
-
# 2. Delete your migration
|
|
443
|
-
rm Migrations/*_{MIGRATION_NAME}.*
|
|
444
|
-
|
|
445
|
-
# 3. Recreate the migration
|
|
446
|
-
/efcore:migration
|
|
447
|
-
```
|
|
448
|
-
|
|
449
|
-
This command will do it automatically if it detects a conflict.
|
|
450
129
|
|
|
451
130
|
---
|
|
452
131
|
|
|
@@ -454,8 +133,6 @@ This command will do it automatically if it detects a conflict.
|
|
|
454
133
|
|
|
455
134
|
| Option | Description |
|
|
456
135
|
|--------|-------------|
|
|
457
|
-
| `--name {name}` |
|
|
458
|
-
| `--
|
|
459
|
-
| `--
|
|
460
|
-
| `--no-cross-check` | Disable cross-branch validation |
|
|
461
|
-
| `--rebase-first` | Run rebase-snapshot automatically if conflict |
|
|
136
|
+
| `--name {name}` | Forcer un nom spécifique |
|
|
137
|
+
| `--force` | Supprimer sans confirmation |
|
|
138
|
+
| `--no-cross-check` | Désactiver validation cross-branch |
|