Connect UserProfile with ApplicationUser

Establishes a link between DbUserProfile and DbApplicationUser,
allowing for better management of user-related information
and integration with ASP.NET Identity.

Renames DbUser to DbUserProfile and updates related entities and configurations.
This commit is contained in:
martinshoob 2025-08-09 15:43:32 +02:00
parent e6ed0d1b37
commit 786f83bf2d
16 changed files with 416 additions and 250 deletions

View file

@ -15,9 +15,11 @@ public class ApplicationDbContext : DbContext
public DbSet<DbProductTable> ProductTable { get; set; }
public DbSet<DbProductTableView> ProductTableView { get; set; }
public DbSet<DbUser> Users { get; set; }
public DbSet<DbUserCompanyTableStat> UserCompanyTableStats { get; set; }
public DbSet<DbUserProductTableStat> UserProductTableStats { get; set; }
public DbSet<DbUserProfile> UserProfiles { get; set; }
public DbSet<DbUserProfileCompanyTableStat> UserProfileCompanyTableStats { get; set; }
public DbSet<DbUserProfileProductTableStat> UserProfileProductTableStats { get; set; }
public DbSet<DbApplicationUser> ApplicationUsers { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
@ -58,10 +60,10 @@ public class ApplicationDbContext : DbContext
// Company Rating
modelBuilder.Entity<DbCompanyRating>(entity =>
{
entity.HasKey(cr => new { cr.UserId, cr.CompanyId });
entity.HasKey(cr => new { cr.UserProfileId, cr.CompanyId });
entity.HasOne(cr => cr.User)
.WithMany(u => u.CompanyRatings);
entity.HasOne(cr => cr.UserProfile)
.WithMany(up => up.CompanyRatings);
entity.HasOne(cr => cr.Company)
.WithMany(c => c.CompanyRatings);
@ -88,8 +90,8 @@ public class ApplicationDbContext : DbContext
entity.HasMany(ctv => ctv.CompanyTables)
.WithMany();
entity.HasMany(ctv => ctv.Users)
.WithMany(u => u.CompanyTableViews);
entity.HasMany(ctv => ctv.UserProfiles)
.WithMany(up => up.CompanyTableViews);
});
// Product
@ -122,10 +124,10 @@ public class ApplicationDbContext : DbContext
// Product Rating
modelBuilder.Entity<DbProductRating>(entity =>
{
entity.HasKey(pr => new { pr.UserId, pr.ProductId });
entity.HasKey(pr => new { pr.UserProfileId, pr.ProductId });
entity.HasOne(pr => pr.User)
.WithMany(u => u.ProductRatings);
entity.HasOne(pr => pr.UserProfile)
.WithMany(up => up.ProductRatings);
entity.HasOne(pr => pr.Product)
.WithMany(p => p.ProductRatings);
@ -152,62 +154,66 @@ public class ApplicationDbContext : DbContext
entity.HasMany(ptv => ptv.ProductTables)
.WithMany();
entity.HasMany(ptv => ptv.Users)
entity.HasMany(ptv => ptv.UserProfiles)
.WithMany(u => u.ProductTableViews);
});
// User
modelBuilder.Entity<DbUser>(entity =>
modelBuilder.Entity<DbUserProfile>(entity =>
{
entity.HasKey(u => u.Id);
entity.HasKey(up => up.Id);
entity.HasMany(u => u.CompanyTableViews)
.WithMany(ctv => ctv.Users);
entity.HasMany(up => up.CompanyTableViews)
.WithMany(ctv => ctv.UserProfiles);
entity.HasMany(u => u.ProductTableViews)
.WithMany(ptv => ptv.Users);
entity.HasMany(up => up.ProductTableViews)
.WithMany(ptv => ptv.UserProfiles);
entity.HasMany(u => u.CompanyRatings)
.WithOne(cr => cr.User)
.HasForeignKey(cr => cr.UserId);
entity.HasMany(up => up.CompanyRatings)
.WithOne(cr => cr.UserProfile)
.HasForeignKey(cr => cr.UserProfileId);
entity.HasMany(u => u.ProductRatings)
.WithOne(pr => pr.User)
.HasForeignKey(pr => pr.UserId);
entity.HasMany(up => up.ProductRatings)
.WithOne(pr => pr.UserProfile)
.HasForeignKey(pr => pr.UserProfileId);
entity.HasMany(u => u.UserCompanyTableStats)
.WithOne(ucts => ucts.User)
.HasForeignKey(ucts => ucts.UserId);
entity.HasMany(up => up.UserProfileCompanyTableStats)
.WithOne(upcts => upcts.UserProfile)
.HasForeignKey(upcts => upcts.UserId);
entity.HasMany(u => u.UserProductTableStats)
.WithOne(upts => upts.User)
.HasForeignKey(upts => upts.UserId);
entity.HasMany(up => up.UserProfileProductTableStats)
.WithOne(uppts => uppts.UserProfile)
.HasForeignKey(uppts => uppts.UserId);
entity.HasIndex(u => u.UserName)
entity.HasIndex(up => up.UserName)
.IsUnique();
entity.HasOne(up => up.ApplicationUser)
.WithOne(au => au.UserProfile)
.HasForeignKey<DbUserProfile>(up => up.ApplicationUserId);
});
// User Company Table Stat
modelBuilder.Entity<DbUserCompanyTableStat>(entity =>
modelBuilder.Entity<DbUserProfileCompanyTableStat>(entity =>
{
entity.HasKey(ucts => new { ucts.UserId, ucts.CompanyTableId });
entity.HasKey(upcts => new { upcts.UserId, upcts.CompanyTableId });
entity.HasOne(ucts => ucts.User)
.WithMany(u => u.UserCompanyTableStats);
entity.HasOne(upcts => upcts.UserProfile)
.WithMany(up => up.UserProfileCompanyTableStats);
entity.HasOne(ucts => ucts.CompanyTable)
entity.HasOne(upcts => upcts.CompanyTable)
.WithMany();
});
// User Product Table Stat
modelBuilder.Entity<DbUserProductTableStat>(entity =>
modelBuilder.Entity<DbUserProfileProductTableStat>(entity =>
{
entity.HasKey(upts => new { upts.UserId, upts.ProductTableId });
entity.HasKey(uppts => new { uppts.UserId, uppts.ProductTableId });
entity.HasOne(upts => upts.User)
.WithMany(u => u.UserProductTableStats);
entity.HasOne(uppts => uppts.UserProfile)
.WithMany(up => up.UserProfileProductTableStats);
entity.HasOne(upts => upts.ProductTable)
entity.HasOne(uppts => uppts.ProductTable)
.WithMany();
});
}

View file

@ -1,10 +1,10 @@
using DrinkRateAPI.DbEntities;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
namespace DrinkRateAPI.Contexts;
public class IdentityDbContext : IdentityDbContext<IdentityUser>
public class IdentityDbContext : IdentityDbContext<DbApplicationUser>
{
public IdentityDbContext(DbContextOptions<IdentityDbContext> options) :
base(options)

View file

@ -0,0 +1,8 @@
using Microsoft.AspNetCore.Identity;
namespace DrinkRateAPI.DbEntities;
public class DbApplicationUser : IdentityUser
{
public virtual DbUserProfile UserProfile { get; set; }
}

View file

@ -2,8 +2,8 @@ namespace DrinkRateAPI.DbEntities;
public class DbCompanyRating
{
public Guid UserId { get; set; }
public DbUser User { get; set; }
public Guid UserProfileId { get; set; }
public DbUserProfile UserProfile { get; set; }
public Guid CompanyId { get; set; }
public DbCompany Company { get; set; }

View file

@ -6,7 +6,7 @@ public class DbCompanyTableView
public ICollection<DbCompanyTable> CompanyTables { get; set; }
public ICollection<DbUser> Users { get; set; }
public ICollection<DbUserProfile> UserProfiles { get; set; }
// to do: permission types
}

View file

@ -2,8 +2,8 @@ namespace DrinkRateAPI.DbEntities;
public class DbProductRating
{
public Guid UserId { get; set; }
public DbUser User { get; set; }
public Guid UserProfileId { get; set; }
public DbUserProfile UserProfile { get; set; }
public Guid ProductId { get; set; }
public DbProduct Product { get; set; }

View file

@ -6,7 +6,7 @@ public class DbProductTableView
public ICollection<DbProductTable> ProductTables { get; set; }
public ICollection<DbUser> Users { get; set; }
public ICollection<DbUserProfile> UserProfiles { get; set; }
// to do: permission types
}

View file

@ -1,6 +1,8 @@
using Microsoft.AspNetCore.Identity;
namespace DrinkRateAPI.DbEntities;
public class DbUser
public class DbUserProfile
{
public Guid Id { get; set; }
@ -10,12 +12,16 @@ public class DbUser
public ICollection<DbCompanyRating> CompanyRatings { get; set; }
public ICollection<DbProductRating> ProductRatings { get; set; }
public ICollection<DbUserCompanyTableStat> UserCompanyTableStats { get; set; }
public ICollection<DbUserProductTableStat> UserProductTableStats { get; set; }
public ICollection<DbUserProfileCompanyTableStat> UserProfileCompanyTableStats { get; set; }
public ICollection<DbUserProfileProductTableStat> UserProfileProductTableStats { get; set; }
public string UserName { get; set; }
public bool IsAdmin { get; set; }
public bool IsDeleted { get; set; }
public string ApplicationUserId { get; set; }
public virtual DbApplicationUser ApplicationUser { get; set; }
}

View file

@ -1,9 +1,9 @@
namespace DrinkRateAPI.DbEntities;
public class DbUserCompanyTableStat
public class DbUserProfileCompanyTableStat
{
public Guid UserId { get; set; }
public DbUser User { get; set; }
public DbUserProfile UserProfile { get; set; }
public Guid CompanyTableId { get; set; }
public DbCompanyTable CompanyTable { get; set; }

View file

@ -1,9 +1,9 @@
namespace DrinkRateAPI.DbEntities;
public class DbUserProductTableStat
public class DbUserProfileProductTableStat
{
public Guid UserId { get; set; }
public DbUser User { get; set; }
public DbUserProfile UserProfile { get; set; }
public Guid ProductTableId { get; set; }
public DbProductTable ProductTable { get; set; }

View file

@ -19,4 +19,8 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project>

View file

@ -1,29 +0,0 @@
// <auto-generated />
using DrinkRateAPI.Contexts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace DrinkRateAPI.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20250809085523_250809_ApplicationInit")]
partial class _250809_ApplicationInit
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
#pragma warning restore 612, 618
}
}
}

View file

@ -1,22 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DrinkRateAPI.Migrations
{
/// <inheritdoc />
public partial class _250809_ApplicationInit : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View file

@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace DrinkRateAPI.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20250809121142_BaseDbModel")]
partial class BaseDbModel
[Migration("20250809134029_Init")]
partial class Init
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -40,19 +40,19 @@ namespace DrinkRateAPI.Migrations
b.ToTable("DbCompanyTableDbCompanyTableView");
});
modelBuilder.Entity("DbCompanyTableViewDbUser", b =>
modelBuilder.Entity("DbCompanyTableViewDbUserProfile", b =>
{
b.Property<Guid>("CompanyTableViewsId")
.HasColumnType("uuid");
b.Property<Guid>("UsersId")
b.Property<Guid>("UserProfilesId")
.HasColumnType("uuid");
b.HasKey("CompanyTableViewsId", "UsersId");
b.HasKey("CompanyTableViewsId", "UserProfilesId");
b.HasIndex("UsersId");
b.HasIndex("UserProfilesId");
b.ToTable("DbCompanyTableViewDbUser");
b.ToTable("DbCompanyTableViewDbUserProfile");
});
modelBuilder.Entity("DbProductTableDbProductTableView", b =>
@ -70,19 +70,71 @@ namespace DrinkRateAPI.Migrations
b.ToTable("DbProductTableDbProductTableView");
});
modelBuilder.Entity("DbProductTableViewDbUser", b =>
modelBuilder.Entity("DbProductTableViewDbUserProfile", b =>
{
b.Property<Guid>("ProductTableViewsId")
.HasColumnType("uuid");
b.Property<Guid>("UsersId")
b.Property<Guid>("UserProfilesId")
.HasColumnType("uuid");
b.HasKey("ProductTableViewsId", "UsersId");
b.HasKey("ProductTableViewsId", "UserProfilesId");
b.HasIndex("UsersId");
b.HasIndex("UserProfilesId");
b.ToTable("DbProductTableViewDbUser");
b.ToTable("DbProductTableViewDbUserProfile");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.HasColumnType("text");
b.Property<string>("Email")
.HasColumnType("text");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasColumnType("text");
b.Property<string>("NormalizedUserName")
.HasColumnType("text");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ApplicationUsers");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbCompany", b =>
@ -117,7 +169,7 @@ namespace DrinkRateAPI.Migrations
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbCompanyRating", b =>
{
b.Property<Guid>("UserId")
b.Property<Guid>("UserProfileId")
.HasColumnType("uuid");
b.Property<Guid>("CompanyId")
@ -129,7 +181,7 @@ namespace DrinkRateAPI.Migrations
b.Property<byte>("Rating")
.HasColumnType("smallint");
b.HasKey("UserId", "CompanyId");
b.HasKey("UserProfileId", "CompanyId");
b.HasIndex("CompanyId");
@ -202,7 +254,7 @@ namespace DrinkRateAPI.Migrations
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbProductRating", b =>
{
b.Property<Guid>("UserId")
b.Property<Guid>("UserProfileId")
.HasColumnType("uuid");
b.Property<Guid>("ProductId")
@ -214,7 +266,7 @@ namespace DrinkRateAPI.Migrations
b.Property<byte>("Rating")
.HasColumnType("smallint");
b.HasKey("UserId", "ProductId");
b.HasKey("UserProfileId", "ProductId");
b.HasIndex("ProductId");
@ -250,12 +302,16 @@ namespace DrinkRateAPI.Migrations
b.ToTable("ProductTableView");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUser", b =>
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserProfile", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ApplicationUserId")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsAdmin")
.HasColumnType("boolean");
@ -268,13 +324,16 @@ namespace DrinkRateAPI.Migrations
b.HasKey("Id");
b.HasIndex("ApplicationUserId")
.IsUnique();
b.HasIndex("UserName")
.IsUnique();
b.ToTable("Users");
b.ToTable("UserProfiles");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserCompanyTableStat", b =>
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserProfileCompanyTableStat", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uuid");
@ -295,10 +354,10 @@ namespace DrinkRateAPI.Migrations
b.HasIndex("CompanyTableId");
b.ToTable("UserCompanyTableStats");
b.ToTable("UserProfileCompanyTableStats");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserProductTableStat", b =>
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserProfileProductTableStat", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uuid");
@ -319,7 +378,7 @@ namespace DrinkRateAPI.Migrations
b.HasIndex("ProductTableId");
b.ToTable("UserProductTableStats");
b.ToTable("UserProfileProductTableStats");
});
modelBuilder.Entity("DbCompanyTableDbCompanyTableView", b =>
@ -337,7 +396,7 @@ namespace DrinkRateAPI.Migrations
.IsRequired();
});
modelBuilder.Entity("DbCompanyTableViewDbUser", b =>
modelBuilder.Entity("DbCompanyTableViewDbUserProfile", b =>
{
b.HasOne("DrinkRateAPI.DbEntities.DbCompanyTableView", null)
.WithMany()
@ -345,9 +404,9 @@ namespace DrinkRateAPI.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DrinkRateAPI.DbEntities.DbUser", null)
b.HasOne("DrinkRateAPI.DbEntities.DbUserProfile", null)
.WithMany()
.HasForeignKey("UsersId")
.HasForeignKey("UserProfilesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
@ -367,7 +426,7 @@ namespace DrinkRateAPI.Migrations
.IsRequired();
});
modelBuilder.Entity("DbProductTableViewDbUser", b =>
modelBuilder.Entity("DbProductTableViewDbUserProfile", b =>
{
b.HasOne("DrinkRateAPI.DbEntities.DbProductTableView", null)
.WithMany()
@ -375,9 +434,9 @@ namespace DrinkRateAPI.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DrinkRateAPI.DbEntities.DbUser", null)
b.HasOne("DrinkRateAPI.DbEntities.DbUserProfile", null)
.WithMany()
.HasForeignKey("UsersId")
.HasForeignKey("UserProfilesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
@ -401,15 +460,15 @@ namespace DrinkRateAPI.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DrinkRateAPI.DbEntities.DbUser", "User")
b.HasOne("DrinkRateAPI.DbEntities.DbUserProfile", "UserProfile")
.WithMany("CompanyRatings")
.HasForeignKey("UserId")
.HasForeignKey("UserProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Company");
b.Navigation("User");
b.Navigation("UserProfile");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbProduct", b =>
@ -439,18 +498,29 @@ namespace DrinkRateAPI.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DrinkRateAPI.DbEntities.DbUser", "User")
b.HasOne("DrinkRateAPI.DbEntities.DbUserProfile", "UserProfile")
.WithMany("ProductRatings")
.HasForeignKey("UserId")
.HasForeignKey("UserProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
b.Navigation("User");
b.Navigation("UserProfile");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserCompanyTableStat", b =>
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserProfile", b =>
{
b.HasOne("DrinkRateAPI.DbEntities.DbApplicationUser", "ApplicationUser")
.WithOne("UserProfile")
.HasForeignKey("DrinkRateAPI.DbEntities.DbUserProfile", "ApplicationUserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicationUser");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserProfileCompanyTableStat", b =>
{
b.HasOne("DrinkRateAPI.DbEntities.DbCompanyTable", "CompanyTable")
.WithMany()
@ -458,18 +528,18 @@ namespace DrinkRateAPI.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DrinkRateAPI.DbEntities.DbUser", "User")
.WithMany("UserCompanyTableStats")
b.HasOne("DrinkRateAPI.DbEntities.DbUserProfile", "UserProfile")
.WithMany("UserProfileCompanyTableStats")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CompanyTable");
b.Navigation("User");
b.Navigation("UserProfile");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserProductTableStat", b =>
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserProfileProductTableStat", b =>
{
b.HasOne("DrinkRateAPI.DbEntities.DbProductTable", "ProductTable")
.WithMany()
@ -477,15 +547,21 @@ namespace DrinkRateAPI.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DrinkRateAPI.DbEntities.DbUser", "User")
.WithMany("UserProductTableStats")
b.HasOne("DrinkRateAPI.DbEntities.DbUserProfile", "UserProfile")
.WithMany("UserProfileProductTableStats")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ProductTable");
b.Navigation("User");
b.Navigation("UserProfile");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbApplicationUser", b =>
{
b.Navigation("UserProfile")
.IsRequired();
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbCompany", b =>
@ -510,15 +586,15 @@ namespace DrinkRateAPI.Migrations
b.Navigation("Products");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUser", b =>
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserProfile", b =>
{
b.Navigation("CompanyRatings");
b.Navigation("ProductRatings");
b.Navigation("UserCompanyTableStats");
b.Navigation("UserProfileCompanyTableStats");
b.Navigation("UserProductTableStats");
b.Navigation("UserProfileProductTableStats");
});
#pragma warning restore 612, 618
}

View file

@ -6,11 +6,36 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace DrinkRateAPI.Migrations
{
/// <inheritdoc />
public partial class BaseDbModel : Migration
public partial class Init : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ApplicationUsers",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
UserName = table.Column<string>(type: "text", nullable: true),
NormalizedUserName = table.Column<string>(type: "text", nullable: true),
Email = table.Column<string>(type: "text", nullable: true),
NormalizedEmail = table.Column<string>(type: "text", nullable: true),
EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false),
PasswordHash = table.Column<string>(type: "text", nullable: true),
SecurityStamp = table.Column<string>(type: "text", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
PhoneNumber = table.Column<string>(type: "text", nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "boolean", nullable: false),
TwoFactorEnabled = table.Column<bool>(type: "boolean", nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
LockoutEnabled = table.Column<bool>(type: "boolean", nullable: false),
AccessFailedCount = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApplicationUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CompanyTables",
columns: table => new
@ -58,17 +83,24 @@ namespace DrinkRateAPI.Migrations
});
migrationBuilder.CreateTable(
name: "Users",
name: "UserProfiles",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
UserName = table.Column<string>(type: "text", nullable: false),
IsAdmin = table.Column<bool>(type: "boolean", nullable: false),
IsDeleted = table.Column<bool>(type: "boolean", nullable: false)
IsDeleted = table.Column<bool>(type: "boolean", nullable: false),
ApplicationUserId = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
table.PrimaryKey("PK_UserProfiles", x => x.Id);
table.ForeignKey(
name: "FK_UserProfiles_ApplicationUsers_ApplicationUserId",
column: x => x.ApplicationUserId,
principalTable: "ApplicationUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
@ -141,55 +173,55 @@ namespace DrinkRateAPI.Migrations
});
migrationBuilder.CreateTable(
name: "DbCompanyTableViewDbUser",
name: "DbCompanyTableViewDbUserProfile",
columns: table => new
{
CompanyTableViewsId = table.Column<Guid>(type: "uuid", nullable: false),
UsersId = table.Column<Guid>(type: "uuid", nullable: false)
UserProfilesId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DbCompanyTableViewDbUser", x => new { x.CompanyTableViewsId, x.UsersId });
table.PrimaryKey("PK_DbCompanyTableViewDbUserProfile", x => new { x.CompanyTableViewsId, x.UserProfilesId });
table.ForeignKey(
name: "FK_DbCompanyTableViewDbUser_CompanyTableViews_CompanyTableView~",
name: "FK_DbCompanyTableViewDbUserProfile_CompanyTableViews_CompanyTa~",
column: x => x.CompanyTableViewsId,
principalTable: "CompanyTableViews",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DbCompanyTableViewDbUser_Users_UsersId",
column: x => x.UsersId,
principalTable: "Users",
name: "FK_DbCompanyTableViewDbUserProfile_UserProfiles_UserProfilesId",
column: x => x.UserProfilesId,
principalTable: "UserProfiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DbProductTableViewDbUser",
name: "DbProductTableViewDbUserProfile",
columns: table => new
{
ProductTableViewsId = table.Column<Guid>(type: "uuid", nullable: false),
UsersId = table.Column<Guid>(type: "uuid", nullable: false)
UserProfilesId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DbProductTableViewDbUser", x => new { x.ProductTableViewsId, x.UsersId });
table.PrimaryKey("PK_DbProductTableViewDbUserProfile", x => new { x.ProductTableViewsId, x.UserProfilesId });
table.ForeignKey(
name: "FK_DbProductTableViewDbUser_ProductTableView_ProductTableViews~",
name: "FK_DbProductTableViewDbUserProfile_ProductTableView_ProductTab~",
column: x => x.ProductTableViewsId,
principalTable: "ProductTableView",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DbProductTableViewDbUser_Users_UsersId",
column: x => x.UsersId,
principalTable: "Users",
name: "FK_DbProductTableViewDbUserProfile_UserProfiles_UserProfilesId",
column: x => x.UserProfilesId,
principalTable: "UserProfiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "UserCompanyTableStats",
name: "UserProfileCompanyTableStats",
columns: table => new
{
UserId = table.Column<Guid>(type: "uuid", nullable: false),
@ -200,23 +232,23 @@ namespace DrinkRateAPI.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_UserCompanyTableStats", x => new { x.UserId, x.CompanyTableId });
table.PrimaryKey("PK_UserProfileCompanyTableStats", x => new { x.UserId, x.CompanyTableId });
table.ForeignKey(
name: "FK_UserCompanyTableStats_CompanyTables_CompanyTableId",
name: "FK_UserProfileCompanyTableStats_CompanyTables_CompanyTableId",
column: x => x.CompanyTableId,
principalTable: "CompanyTables",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_UserCompanyTableStats_Users_UserId",
name: "FK_UserProfileCompanyTableStats_UserProfiles_UserId",
column: x => x.UserId,
principalTable: "Users",
principalTable: "UserProfiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "UserProductTableStats",
name: "UserProfileProductTableStats",
columns: table => new
{
UserId = table.Column<Guid>(type: "uuid", nullable: false),
@ -227,17 +259,17 @@ namespace DrinkRateAPI.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_UserProductTableStats", x => new { x.UserId, x.ProductTableId });
table.PrimaryKey("PK_UserProfileProductTableStats", x => new { x.UserId, x.ProductTableId });
table.ForeignKey(
name: "FK_UserProductTableStats_ProductTable_ProductTableId",
name: "FK_UserProfileProductTableStats_ProductTable_ProductTableId",
column: x => x.ProductTableId,
principalTable: "ProductTable",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_UserProductTableStats_Users_UserId",
name: "FK_UserProfileProductTableStats_UserProfiles_UserId",
column: x => x.UserId,
principalTable: "Users",
principalTable: "UserProfiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
@ -246,14 +278,14 @@ namespace DrinkRateAPI.Migrations
name: "CompanyRatings",
columns: table => new
{
UserId = table.Column<Guid>(type: "uuid", nullable: false),
UserProfileId = table.Column<Guid>(type: "uuid", nullable: false),
CompanyId = table.Column<Guid>(type: "uuid", nullable: false),
Rating = table.Column<byte>(type: "smallint", nullable: false),
Comment = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CompanyRatings", x => new { x.UserId, x.CompanyId });
table.PrimaryKey("PK_CompanyRatings", x => new { x.UserProfileId, x.CompanyId });
table.ForeignKey(
name: "FK_CompanyRatings_Companies_CompanyId",
column: x => x.CompanyId,
@ -261,9 +293,9 @@ namespace DrinkRateAPI.Migrations
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CompanyRatings_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
name: "FK_CompanyRatings_UserProfiles_UserProfileId",
column: x => x.UserProfileId,
principalTable: "UserProfiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
@ -300,14 +332,14 @@ namespace DrinkRateAPI.Migrations
name: "ProductRating",
columns: table => new
{
UserId = table.Column<Guid>(type: "uuid", nullable: false),
UserProfileId = table.Column<Guid>(type: "uuid", nullable: false),
ProductId = table.Column<Guid>(type: "uuid", nullable: false),
Rating = table.Column<byte>(type: "smallint", nullable: false),
Comment = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ProductRating", x => new { x.UserId, x.ProductId });
table.PrimaryKey("PK_ProductRating", x => new { x.UserProfileId, x.ProductId });
table.ForeignKey(
name: "FK_ProductRating_Product_ProductId",
column: x => x.ProductId,
@ -315,9 +347,9 @@ namespace DrinkRateAPI.Migrations
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ProductRating_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
name: "FK_ProductRating_UserProfiles_UserProfileId",
column: x => x.UserProfileId,
principalTable: "UserProfiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
@ -350,9 +382,9 @@ namespace DrinkRateAPI.Migrations
column: "DbCompanyTableViewId");
migrationBuilder.CreateIndex(
name: "IX_DbCompanyTableViewDbUser_UsersId",
table: "DbCompanyTableViewDbUser",
column: "UsersId");
name: "IX_DbCompanyTableViewDbUserProfile_UserProfilesId",
table: "DbCompanyTableViewDbUserProfile",
column: "UserProfilesId");
migrationBuilder.CreateIndex(
name: "IX_DbProductTableDbProductTableView_ProductTablesId",
@ -360,9 +392,9 @@ namespace DrinkRateAPI.Migrations
column: "ProductTablesId");
migrationBuilder.CreateIndex(
name: "IX_DbProductTableViewDbUser_UsersId",
table: "DbProductTableViewDbUser",
column: "UsersId");
name: "IX_DbProductTableViewDbUserProfile_UserProfilesId",
table: "DbProductTableViewDbUserProfile",
column: "UserProfilesId");
migrationBuilder.CreateIndex(
name: "IX_Product_CompanyId",
@ -392,18 +424,24 @@ namespace DrinkRateAPI.Migrations
unique: true);
migrationBuilder.CreateIndex(
name: "IX_UserCompanyTableStats_CompanyTableId",
table: "UserCompanyTableStats",
name: "IX_UserProfileCompanyTableStats_CompanyTableId",
table: "UserProfileCompanyTableStats",
column: "CompanyTableId");
migrationBuilder.CreateIndex(
name: "IX_UserProductTableStats_ProductTableId",
table: "UserProductTableStats",
name: "IX_UserProfileProductTableStats_ProductTableId",
table: "UserProfileProductTableStats",
column: "ProductTableId");
migrationBuilder.CreateIndex(
name: "IX_Users_UserName",
table: "Users",
name: "IX_UserProfiles_ApplicationUserId",
table: "UserProfiles",
column: "ApplicationUserId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_UserProfiles_UserName",
table: "UserProfiles",
column: "UserName",
unique: true);
}
@ -418,22 +456,22 @@ namespace DrinkRateAPI.Migrations
name: "DbCompanyTableDbCompanyTableView");
migrationBuilder.DropTable(
name: "DbCompanyTableViewDbUser");
name: "DbCompanyTableViewDbUserProfile");
migrationBuilder.DropTable(
name: "DbProductTableDbProductTableView");
migrationBuilder.DropTable(
name: "DbProductTableViewDbUser");
name: "DbProductTableViewDbUserProfile");
migrationBuilder.DropTable(
name: "ProductRating");
migrationBuilder.DropTable(
name: "UserCompanyTableStats");
name: "UserProfileCompanyTableStats");
migrationBuilder.DropTable(
name: "UserProductTableStats");
name: "UserProfileProductTableStats");
migrationBuilder.DropTable(
name: "CompanyTableViews");
@ -445,7 +483,7 @@ namespace DrinkRateAPI.Migrations
name: "Product");
migrationBuilder.DropTable(
name: "Users");
name: "UserProfiles");
migrationBuilder.DropTable(
name: "Companies");
@ -453,6 +491,9 @@ namespace DrinkRateAPI.Migrations
migrationBuilder.DropTable(
name: "ProductTable");
migrationBuilder.DropTable(
name: "ApplicationUsers");
migrationBuilder.DropTable(
name: "CompanyTables");
}

View file

@ -37,19 +37,19 @@ namespace DrinkRateAPI.Migrations
b.ToTable("DbCompanyTableDbCompanyTableView");
});
modelBuilder.Entity("DbCompanyTableViewDbUser", b =>
modelBuilder.Entity("DbCompanyTableViewDbUserProfile", b =>
{
b.Property<Guid>("CompanyTableViewsId")
.HasColumnType("uuid");
b.Property<Guid>("UsersId")
b.Property<Guid>("UserProfilesId")
.HasColumnType("uuid");
b.HasKey("CompanyTableViewsId", "UsersId");
b.HasKey("CompanyTableViewsId", "UserProfilesId");
b.HasIndex("UsersId");
b.HasIndex("UserProfilesId");
b.ToTable("DbCompanyTableViewDbUser");
b.ToTable("DbCompanyTableViewDbUserProfile");
});
modelBuilder.Entity("DbProductTableDbProductTableView", b =>
@ -67,19 +67,71 @@ namespace DrinkRateAPI.Migrations
b.ToTable("DbProductTableDbProductTableView");
});
modelBuilder.Entity("DbProductTableViewDbUser", b =>
modelBuilder.Entity("DbProductTableViewDbUserProfile", b =>
{
b.Property<Guid>("ProductTableViewsId")
.HasColumnType("uuid");
b.Property<Guid>("UsersId")
b.Property<Guid>("UserProfilesId")
.HasColumnType("uuid");
b.HasKey("ProductTableViewsId", "UsersId");
b.HasKey("ProductTableViewsId", "UserProfilesId");
b.HasIndex("UsersId");
b.HasIndex("UserProfilesId");
b.ToTable("DbProductTableViewDbUser");
b.ToTable("DbProductTableViewDbUserProfile");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.HasColumnType("text");
b.Property<string>("Email")
.HasColumnType("text");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasColumnType("text");
b.Property<string>("NormalizedUserName")
.HasColumnType("text");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ApplicationUsers");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbCompany", b =>
@ -114,7 +166,7 @@ namespace DrinkRateAPI.Migrations
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbCompanyRating", b =>
{
b.Property<Guid>("UserId")
b.Property<Guid>("UserProfileId")
.HasColumnType("uuid");
b.Property<Guid>("CompanyId")
@ -126,7 +178,7 @@ namespace DrinkRateAPI.Migrations
b.Property<byte>("Rating")
.HasColumnType("smallint");
b.HasKey("UserId", "CompanyId");
b.HasKey("UserProfileId", "CompanyId");
b.HasIndex("CompanyId");
@ -199,7 +251,7 @@ namespace DrinkRateAPI.Migrations
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbProductRating", b =>
{
b.Property<Guid>("UserId")
b.Property<Guid>("UserProfileId")
.HasColumnType("uuid");
b.Property<Guid>("ProductId")
@ -211,7 +263,7 @@ namespace DrinkRateAPI.Migrations
b.Property<byte>("Rating")
.HasColumnType("smallint");
b.HasKey("UserId", "ProductId");
b.HasKey("UserProfileId", "ProductId");
b.HasIndex("ProductId");
@ -247,12 +299,16 @@ namespace DrinkRateAPI.Migrations
b.ToTable("ProductTableView");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUser", b =>
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserProfile", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ApplicationUserId")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsAdmin")
.HasColumnType("boolean");
@ -265,13 +321,16 @@ namespace DrinkRateAPI.Migrations
b.HasKey("Id");
b.HasIndex("ApplicationUserId")
.IsUnique();
b.HasIndex("UserName")
.IsUnique();
b.ToTable("Users");
b.ToTable("UserProfiles");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserCompanyTableStat", b =>
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserProfileCompanyTableStat", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uuid");
@ -292,10 +351,10 @@ namespace DrinkRateAPI.Migrations
b.HasIndex("CompanyTableId");
b.ToTable("UserCompanyTableStats");
b.ToTable("UserProfileCompanyTableStats");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserProductTableStat", b =>
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserProfileProductTableStat", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uuid");
@ -316,7 +375,7 @@ namespace DrinkRateAPI.Migrations
b.HasIndex("ProductTableId");
b.ToTable("UserProductTableStats");
b.ToTable("UserProfileProductTableStats");
});
modelBuilder.Entity("DbCompanyTableDbCompanyTableView", b =>
@ -334,7 +393,7 @@ namespace DrinkRateAPI.Migrations
.IsRequired();
});
modelBuilder.Entity("DbCompanyTableViewDbUser", b =>
modelBuilder.Entity("DbCompanyTableViewDbUserProfile", b =>
{
b.HasOne("DrinkRateAPI.DbEntities.DbCompanyTableView", null)
.WithMany()
@ -342,9 +401,9 @@ namespace DrinkRateAPI.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DrinkRateAPI.DbEntities.DbUser", null)
b.HasOne("DrinkRateAPI.DbEntities.DbUserProfile", null)
.WithMany()
.HasForeignKey("UsersId")
.HasForeignKey("UserProfilesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
@ -364,7 +423,7 @@ namespace DrinkRateAPI.Migrations
.IsRequired();
});
modelBuilder.Entity("DbProductTableViewDbUser", b =>
modelBuilder.Entity("DbProductTableViewDbUserProfile", b =>
{
b.HasOne("DrinkRateAPI.DbEntities.DbProductTableView", null)
.WithMany()
@ -372,9 +431,9 @@ namespace DrinkRateAPI.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DrinkRateAPI.DbEntities.DbUser", null)
b.HasOne("DrinkRateAPI.DbEntities.DbUserProfile", null)
.WithMany()
.HasForeignKey("UsersId")
.HasForeignKey("UserProfilesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
@ -398,15 +457,15 @@ namespace DrinkRateAPI.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DrinkRateAPI.DbEntities.DbUser", "User")
b.HasOne("DrinkRateAPI.DbEntities.DbUserProfile", "UserProfile")
.WithMany("CompanyRatings")
.HasForeignKey("UserId")
.HasForeignKey("UserProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Company");
b.Navigation("User");
b.Navigation("UserProfile");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbProduct", b =>
@ -436,18 +495,29 @@ namespace DrinkRateAPI.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DrinkRateAPI.DbEntities.DbUser", "User")
b.HasOne("DrinkRateAPI.DbEntities.DbUserProfile", "UserProfile")
.WithMany("ProductRatings")
.HasForeignKey("UserId")
.HasForeignKey("UserProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
b.Navigation("User");
b.Navigation("UserProfile");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserCompanyTableStat", b =>
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserProfile", b =>
{
b.HasOne("DrinkRateAPI.DbEntities.DbApplicationUser", "ApplicationUser")
.WithOne("UserProfile")
.HasForeignKey("DrinkRateAPI.DbEntities.DbUserProfile", "ApplicationUserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicationUser");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserProfileCompanyTableStat", b =>
{
b.HasOne("DrinkRateAPI.DbEntities.DbCompanyTable", "CompanyTable")
.WithMany()
@ -455,18 +525,18 @@ namespace DrinkRateAPI.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DrinkRateAPI.DbEntities.DbUser", "User")
.WithMany("UserCompanyTableStats")
b.HasOne("DrinkRateAPI.DbEntities.DbUserProfile", "UserProfile")
.WithMany("UserProfileCompanyTableStats")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CompanyTable");
b.Navigation("User");
b.Navigation("UserProfile");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserProductTableStat", b =>
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserProfileProductTableStat", b =>
{
b.HasOne("DrinkRateAPI.DbEntities.DbProductTable", "ProductTable")
.WithMany()
@ -474,15 +544,21 @@ namespace DrinkRateAPI.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DrinkRateAPI.DbEntities.DbUser", "User")
.WithMany("UserProductTableStats")
b.HasOne("DrinkRateAPI.DbEntities.DbUserProfile", "UserProfile")
.WithMany("UserProfileProductTableStats")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ProductTable");
b.Navigation("User");
b.Navigation("UserProfile");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbApplicationUser", b =>
{
b.Navigation("UserProfile")
.IsRequired();
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbCompany", b =>
@ -507,15 +583,15 @@ namespace DrinkRateAPI.Migrations
b.Navigation("Products");
});
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUser", b =>
modelBuilder.Entity("DrinkRateAPI.DbEntities.DbUserProfile", b =>
{
b.Navigation("CompanyRatings");
b.Navigation("ProductRatings");
b.Navigation("UserCompanyTableStats");
b.Navigation("UserProfileCompanyTableStats");
b.Navigation("UserProductTableStats");
b.Navigation("UserProfileProductTableStats");
});
#pragma warning restore 612, 618
}