-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
⚡ Priority: HighImportant tasks requiring quick attentionImportant tasks requiring quick attention✨ Type: FeatureNew functionality or enhancementNew functionality or enhancement🟢 Test: LowMinimal testing effort neededMinimal testing effort needed
Milestone
Description
Problem
Users can accidentally create two migrations with the same timestamp, which causes:
- Undefined execution order
- Potential overwrites in version tracking
- Confusing errors during migration runs
This is especially problematic when:
- Multiple developers work on migrations simultaneously
- Migrations are created in rapid succession
- Generated timestamps collide (same second)
Proposed Solution
Add validation that detects and prevents duplicate timestamps:
// During migration scanning
const timestamps = new Set<string>();
for (const migration of migrations) {
if (timestamps.has(migration.version)) {
throw new Error(
`Duplicate migration timestamp detected: ${migration.version}\n` +
`This can cause undefined behavior. Please rename one of:\n` +
` - ${migration1.filename}\n` +
` - ${migration2.filename}`
);
}
timestamps.add(migration.version);
}Validation Scenarios
- At Scan Time: Check for duplicates when discovering migrations
- At Generation Time: When creating new migration, check existing ones
- Clear Error Messages: Tell user exactly which files conflict
Benefits
- Prevent Data Corruption: Stop migrations before they run with undefined order
- Early Detection: Fail fast with clear error message
- Developer Safety: Catch mistakes before production
- Better UX: Clear guidance on how to fix the issue
Implementation Notes
- Add to
MigrationScannerservice - Include in migration template generator (#TBD)
- Show both conflicting filenames in error
- Suggest resolution: rename one migration with new timestamp
- Add test cases for duplicate detection
Related
- Part of v0.4.0 reliability improvements
- Complements Add execution summary logging for migration runs #72 (execution summary logging)
- Addresses issue found in competitive analysis (Research top 10 migration tools: features, gaps, and opportunities #74)
Metadata
Metadata
Assignees
Labels
⚡ Priority: HighImportant tasks requiring quick attentionImportant tasks requiring quick attention✨ Type: FeatureNew functionality or enhancementNew functionality or enhancement🟢 Test: LowMinimal testing effort neededMinimal testing effort needed