Skip to content

Commit

Permalink
Add assets as foreign keys on case (#1298)
Browse files Browse the repository at this point in the history
  • Loading branch information
taustad authored Oct 1, 2024
1 parent bf80063 commit 4febb23
Show file tree
Hide file tree
Showing 5 changed files with 4,065 additions and 1 deletion.
42 changes: 42 additions & 0 deletions backend/api/Context/DcdDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,48 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.Entity<Project>()
.Property(p => p.ExchangeRateUSDToNOK)
.HasDefaultValue(10);

modelBuilder.Entity<Case>()
.HasOne(c => c.DrainageStrategy)
.WithMany()
.HasForeignKey(c => c.DrainageStrategyLink)
.OnDelete(DeleteBehavior.NoAction);

modelBuilder.Entity<Case>()
.HasOne(c => c.WellProject)
.WithMany()
.HasForeignKey(c => c.WellProjectLink)
.OnDelete(DeleteBehavior.NoAction);

modelBuilder.Entity<Case>()
.HasOne(c => c.Exploration)
.WithMany()
.HasForeignKey(c => c.ExplorationLink)
.OnDelete(DeleteBehavior.NoAction);

modelBuilder.Entity<Case>()
.HasOne(c => c.Transport)
.WithMany()
.HasForeignKey(c => c.TransportLink)
.OnDelete(DeleteBehavior.NoAction);

modelBuilder.Entity<Case>()
.HasOne(c => c.Topside)
.WithMany()
.HasForeignKey(c => c.TopsideLink)
.OnDelete(DeleteBehavior.NoAction);

modelBuilder.Entity<Case>()
.HasOne(c => c.Substructure)
.WithMany()
.HasForeignKey(c => c.SubstructureLink)
.OnDelete(DeleteBehavior.NoAction);

modelBuilder.Entity<Case>()
.HasOne(c => c.Surf)
.WithMany()
.HasForeignKey(c => c.SurfLink)
.OnDelete(DeleteBehavior.NoAction);
}

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
Expand Down
Loading

0 comments on commit 4febb23

Please sign in to comment.