WIP
This commit is contained in:
1 parent
38067df8c3
commit
492d86db9e
30 files changed
+2473
-40
No files matched your search
@@ -13,6 +13,7 @@ public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
|
||||
public DbSet<Account> Accounts => Set<Account>();
|
||||
public DbSet<Transaction> Transactions => Set<Transaction>();
|
||||
public DbSet<Category> Categories => Set<Category>();
|
||||
public DbSet<Salary> Salaries => Set<Salary>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
@@ -45,6 +46,11 @@ public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
|
||||
.HasForeignKey(t => t.ParentTransactionId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
e.HasOne(t => t.Salary)
|
||||
.WithMany()
|
||||
.HasForeignKey(t => t.SalaryId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
e.Property(t => t.Amount).HasColumnType("decimal(18,2)");
|
||||
});
|
||||
|
||||
@@ -55,5 +61,20 @@ public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
|
||||
.HasForeignKey(c => c.UserId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
builder.Entity<Salary>(e =>
|
||||
{
|
||||
e.HasOne(s => s.User)
|
||||
.WithMany()
|
||||
.HasForeignKey(s => s.UserId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
e.HasOne(s => s.Account)
|
||||
.WithMany()
|
||||
.HasForeignKey(s => s.AccountId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
e.Property(s => s.Amount).HasColumnType("decimal(18,2)");
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user