← Back to list

migration-helper
by ademceper
⭐ 1🍴 0📅 Jan 23, 2026
SKILL.md
name: migration-helper description: Helps create and manage EF Core migrations with proper naming and rollback strategies
Migration Helper Skill
Bu skill, Merge E-Commerce Backend projesi için EF Core migration yönetimi yapar.
Ne Zaman Kullan
- "Migration oluştur", "veritabanı güncelle" dendiğinde
- Entity configuration değişikliklerinde
- "Tablo ekle", "kolon ekle" gibi isteklerde
Migration Komutları
Migration Oluşturma
dotnet ef migrations add {MigrationName} \
--project Merge.Infrastructure \
--startup-project Merge.API \
--output-dir Data/Migrations
Migration Uygulama
dotnet ef database update \
--project Merge.Infrastructure \
--startup-project Merge.API
Migration Geri Alma
# Son migration'ı geri al
dotnet ef database update {PreviousMigrationName} \
--project Merge.Infrastructure \
--startup-project Merge.API
# Migration dosyasını sil
dotnet ef migrations remove \
--project Merge.Infrastructure \
--startup-project Merge.API
SQL Script Oluşturma
dotnet ef migrations script \
--project Merge.Infrastructure \
--startup-project Merge.API \
--output migration.sql \
--idempotent
Migration Naming Convention
| İşlem | Format | Örnek |
|---|---|---|
| Tablo ekleme | Add{TableName} | AddProducts |
| Kolon ekleme | Add{Column}To{Table} | AddSkuToProducts |
| Kolon silme | Remove{Column}From{Table} | RemoveDescriptionFromProducts |
| Index ekleme | AddIndexOn{Table}{Columns} | AddIndexOnProductsCategoryId |
| FK ekleme | Add{Child}To{Parent}Relation | AddOrderItemsToOrderRelation |
| Tablo değiştirme | Alter{Table}{Change} | AlterProductsAddAuditFields |
Entity Configuration Template
public class {Entity}Configuration : IEntityTypeConfiguration<{Entity}>
{
public void Configure(EntityTypeBuilder<{Entity}> builder)
{
// Table name (snake_case, plural)
builder.ToTable("{entities}");
// Primary key
builder.HasKey(x => x.Id);
// Properties
builder.Property(x => x.Name)
.HasColumnName("name")
.HasMaxLength(200)
.IsRequired();
builder.Property(x => x.Price)
.HasColumnName("price")
.HasPrecision(18, 2);
builder.Property(x => x.CreatedAt)
.HasColumnName("created_at")
.HasDefaultValueSql("NOW()");
// Value object conversion
builder.Property(x => x.Email)
.HasConversion(
v => v.Value,
v => Email.Create(v))
.HasMaxLength(320);
// Relationships
builder.HasOne(x => x.Category)
.WithMany(c => c.Products)
.HasForeignKey(x => x.CategoryId)
.OnDelete(DeleteBehavior.Restrict);
// Indexes
builder.HasIndex(x => x.Sku).IsUnique();
builder.HasIndex(x => new { x.CategoryId, x.IsActive });
// Soft delete filter
builder.HasQueryFilter(x => !x.IsDeleted);
// Ignore
builder.Ignore(x => x.DomainEvents);
}
}
Checklist
Migration öncesi kontrol:
- Entity configuration eklendi/güncellendi
- DbContext'e DbSet eklendi
- Naming convention doğru (snake_case)
- Index'ler tanımlı
- FK constraint'ler doğru
- Seed data gerekiyorsa eklendi
Migration sonrası kontrol:
- Migration dosyası review edildi
- Down metodu çalışıyor
- Test veritabanında uygulandı
- Rollback test edildi
Score
Total Score
40/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon