Models Updated
This commit is contained in:
@@ -10,8 +10,8 @@ using Models;
|
||||
namespace Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(LuminousContext))]
|
||||
[Migration("20210317183331_InitialMigration")]
|
||||
partial class InitialMigration
|
||||
[Migration("20210318105825_init")]
|
||||
partial class init
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
@@ -21,21 +21,6 @@ namespace Data.Migrations
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("Data.Models.RolePermission", b =>
|
||||
{
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PermisionId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("RoleId", "PermisionId");
|
||||
|
||||
b.HasIndex("PermisionId");
|
||||
|
||||
b.ToTable("RolePermission");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Models.Models.Deal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -43,6 +28,12 @@ namespace Data.Migrations
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<double>("Amount")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<byte[]>("Time")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
@@ -54,30 +45,13 @@ namespace Data.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Models.Models.Permission", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Permission");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Models.Models.Product", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -88,9 +62,6 @@ namespace Data.Migrations
|
||||
b.Property<double>("AmountInStock")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int?>("DealId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
@@ -98,18 +69,11 @@ namespace Data.Migrations
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int?>("StockId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("StockId");
|
||||
|
||||
b.ToTable("Product");
|
||||
});
|
||||
|
||||
@@ -139,6 +103,12 @@ namespace Data.Migrations
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<double>("Amount")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<byte[]>("Time")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
@@ -150,6 +120,8 @@ namespace Data.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Stock");
|
||||
@@ -183,23 +155,14 @@ namespace Data.Migrations
|
||||
b.ToTable("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Data.Models.RolePermission", b =>
|
||||
{
|
||||
b.HasOne("Models.Models.Permission", "Permission")
|
||||
.WithMany("Role")
|
||||
.HasForeignKey("PermisionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Models.Models.Role", "Roles")
|
||||
.WithMany("Permissions")
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Models.Models.Deal", b =>
|
||||
{
|
||||
b.HasOne("Models.Models.Product", "Products")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Models.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
@@ -207,19 +170,14 @@ namespace Data.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Models.Models.Product", b =>
|
||||
{
|
||||
b.HasOne("Models.Models.Deal", null)
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("DealId");
|
||||
|
||||
b.HasOne("Models.Models.Stock", null)
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("StockId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Models.Models.Stock", b =>
|
||||
{
|
||||
b.HasOne("Models.Models.Product", "Products")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Models.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
@@ -3,21 +3,23 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Data.Migrations
|
||||
{
|
||||
public partial class InitialMigration : Migration
|
||||
public partial class init : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Permission",
|
||||
name: "Product",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(nullable: false)
|
||||
Name = table.Column<string>(nullable: false),
|
||||
Price = table.Column<double>(nullable: false),
|
||||
AmountInStock = table.Column<double>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Permission", x => x.Id);
|
||||
table.PrimaryKey("PK_Product", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
@@ -33,30 +35,6 @@ namespace Data.Migrations
|
||||
table.PrimaryKey("PK_Role", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RolePermission",
|
||||
columns: table => new
|
||||
{
|
||||
RoleId = table.Column<int>(nullable: false),
|
||||
PermisionId = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RolePermission", x => new { x.RoleId, x.PermisionId });
|
||||
table.ForeignKey(
|
||||
name: "FK_RolePermission_Permission_PermisionId",
|
||||
column: x => x.PermisionId,
|
||||
principalTable: "Permission",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_RolePermission_Role_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalTable: "Role",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "User",
|
||||
columns: table => new
|
||||
@@ -85,11 +63,19 @@ namespace Data.Migrations
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
UserId = table.Column<int>(nullable: false),
|
||||
ProductId = table.Column<int>(nullable: false),
|
||||
Amount = table.Column<double>(nullable: false),
|
||||
Time = table.Column<byte[]>(rowVersion: true, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Deal", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Deal_Product_ProductId",
|
||||
column: x => x.ProductId,
|
||||
principalTable: "Product",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Deal_User_UserId",
|
||||
column: x => x.UserId,
|
||||
@@ -105,11 +91,19 @@ namespace Data.Migrations
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
UserId = table.Column<int>(nullable: false),
|
||||
ProductId = table.Column<int>(nullable: false),
|
||||
Amount = table.Column<double>(nullable: false),
|
||||
Time = table.Column<byte[]>(rowVersion: true, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Stock", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Stock_Product_ProductId",
|
||||
column: x => x.ProductId,
|
||||
principalTable: "Product",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Stock_User_UserId",
|
||||
column: x => x.UserId,
|
||||
@@ -118,62 +112,22 @@ namespace Data.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Product",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(nullable: false),
|
||||
Price = table.Column<double>(nullable: false),
|
||||
AmountInStock = table.Column<double>(nullable: false),
|
||||
DealId = table.Column<int>(nullable: true),
|
||||
StockId = table.Column<int>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Product", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Product_Deal_DealId",
|
||||
column: x => x.DealId,
|
||||
principalTable: "Deal",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_Product_Stock_StockId",
|
||||
column: x => x.StockId,
|
||||
principalTable: "Stock",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Deal_ProductId",
|
||||
table: "Deal",
|
||||
column: "ProductId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Deal_UserId",
|
||||
table: "Deal",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Permission_Name",
|
||||
table: "Permission",
|
||||
column: "Name",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Product_DealId",
|
||||
table: "Product",
|
||||
column: "DealId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Product_Name",
|
||||
table: "Product",
|
||||
column: "Name",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Product_StockId",
|
||||
table: "Product",
|
||||
column: "StockId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Role_Name",
|
||||
table: "Role",
|
||||
@@ -181,9 +135,9 @@ namespace Data.Migrations
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RolePermission_PermisionId",
|
||||
table: "RolePermission",
|
||||
column: "PermisionId");
|
||||
name: "IX_Stock_ProductId",
|
||||
table: "Stock",
|
||||
column: "ProductId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Stock_UserId",
|
||||
@@ -204,12 +158,6 @@ namespace Data.Migrations
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Product");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RolePermission");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Deal");
|
||||
|
||||
@@ -217,7 +165,7 @@ namespace Data.Migrations
|
||||
name: "Stock");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Permission");
|
||||
name: "Product");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "User");
|
@@ -19,21 +19,6 @@ namespace Data.Migrations
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("Data.Models.RolePermission", b =>
|
||||
{
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PermisionId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("RoleId", "PermisionId");
|
||||
|
||||
b.HasIndex("PermisionId");
|
||||
|
||||
b.ToTable("RolePermission");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Models.Models.Deal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -41,6 +26,12 @@ namespace Data.Migrations
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<double>("Amount")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<byte[]>("Time")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
@@ -52,30 +43,13 @@ namespace Data.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Models.Models.Permission", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Permission");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Models.Models.Product", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -86,9 +60,6 @@ namespace Data.Migrations
|
||||
b.Property<double>("AmountInStock")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int?>("DealId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
@@ -96,18 +67,11 @@ namespace Data.Migrations
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int?>("StockId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("StockId");
|
||||
|
||||
b.ToTable("Product");
|
||||
});
|
||||
|
||||
@@ -137,6 +101,12 @@ namespace Data.Migrations
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<double>("Amount")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<byte[]>("Time")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
@@ -148,6 +118,8 @@ namespace Data.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Stock");
|
||||
@@ -181,23 +153,14 @@ namespace Data.Migrations
|
||||
b.ToTable("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Data.Models.RolePermission", b =>
|
||||
{
|
||||
b.HasOne("Models.Models.Permission", "Permission")
|
||||
.WithMany("Role")
|
||||
.HasForeignKey("PermisionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Models.Models.Role", "Roles")
|
||||
.WithMany("Permissions")
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Models.Models.Deal", b =>
|
||||
{
|
||||
b.HasOne("Models.Models.Product", "Products")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Models.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
@@ -205,19 +168,14 @@ namespace Data.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Models.Models.Product", b =>
|
||||
{
|
||||
b.HasOne("Models.Models.Deal", null)
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("DealId");
|
||||
|
||||
b.HasOne("Models.Models.Stock", null)
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("StockId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Models.Models.Stock", b =>
|
||||
{
|
||||
b.HasOne("Models.Models.Product", "Products")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Models.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
|
Reference in New Issue
Block a user