|
@@ -25,6 +25,8 @@ public partial class ChernoshchekovaContext : DbContext
|
|
|
|
|
|
public virtual DbSet<User> Users { get; set; }
|
|
|
|
|
|
+ public virtual DbSet<Userimage> Userimages { get; set; }
|
|
|
+
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
|
|
|
=> optionsBuilder.UseNpgsql("Host=edu.pg.ngknn.local;Port=5432;Database=chernoshchekova;Username=31P;Password=12345");
|
|
@@ -123,7 +125,6 @@ public partial class ChernoshchekovaContext : DbContext
|
|
|
"Usertrait",
|
|
|
r => r.HasOne<Trait>().WithMany()
|
|
|
.HasForeignKey("Idtrait")
|
|
|
- .OnDelete(DeleteBehavior.ClientSetNull)
|
|
|
.HasConstraintName("usertraits_trait_fk"),
|
|
|
l => l.HasOne<User>().WithMany()
|
|
|
.HasForeignKey("Iduser")
|
|
@@ -141,6 +142,24 @@ public partial class ChernoshchekovaContext : DbContext
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ modelBuilder.Entity<Userimage>(entity =>
|
|
|
+ {
|
|
|
+ entity.HasKey(e => e.Id).HasName("userimage_pk");
|
|
|
+
|
|
|
+ entity.ToTable("userimage");
|
|
|
+
|
|
|
+ entity.Property(e => e.Id).HasColumnName("id");
|
|
|
+ entity.Property(e => e.IdUser)
|
|
|
+ .ValueGeneratedOnAdd()
|
|
|
+ .HasColumnName("id_user");
|
|
|
+ entity.Property(e => e.Image).HasColumnName("image");
|
|
|
+
|
|
|
+ entity.HasOne(d => d.IdUserNavigation).WithMany(p => p.Userimages)
|
|
|
+ .HasForeignKey(d => d.IdUser)
|
|
|
+ .OnDelete(DeleteBehavior.ClientSetNull)
|
|
|
+ .HasConstraintName("userimage_users_fk");
|
|
|
+ });
|
|
|
+
|
|
|
OnModelCreatingPartial(modelBuilder);
|
|
|
}
|
|
|
|