migration
This commit is contained in:
parent
311b70d3be
commit
dadaf9c744
@ -7,19 +7,7 @@ namespace ComputerHardwareStoreDatabaseImplement
|
||||
{
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
/*
|
||||
* в program добавить:
|
||||
* // получаем строку подключения из файла конфигурации
|
||||
* string connection = builder.Configuration.GetConnectionString("DefaultConnection");
|
||||
*
|
||||
* // добавляем контекст ApplicationContext в качестве сервиса в приложение
|
||||
* builder.Services.AddDbContext<ApplicationContext>(options => options.UseSqlServer(connection));
|
||||
*
|
||||
* в appsettings:
|
||||
* "ConnectionStrings": {
|
||||
* "DefaultConnection": "Host=localhost;Database=ProductBar_db;Username=compstore;Password=compstore"
|
||||
* },
|
||||
*/
|
||||
optionsBuilder.UseNpgsql("Host=192.168.1.61:5432;Database=computerhardwarestore;Username=compstore;Password=compstore");
|
||||
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||
|
566
ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/Migrations/20240501142223_cs2.Designer.cs
generated
Normal file
566
ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/Migrations/20240501142223_cs2.Designer.cs
generated
Normal file
@ -0,0 +1,566 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using ComputerHardwareStoreDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ComputerHardwareStoreDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(ComputerHardwareStoreDBContext))]
|
||||
[Migration("20240501142223_cs2")]
|
||||
partial class cs2
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int>("VendorId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("VendorId");
|
||||
|
||||
b.ToTable("Builds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.BuildComponent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BuildId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ComponentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BuildId");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.ToTable("BuildComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Comment", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BuildId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Text")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BuildId");
|
||||
|
||||
b.ToTable("Comments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("StoreKeeperId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StoreKeeperId");
|
||||
|
||||
b.ToTable("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int?>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.OrderProduct", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("OrderId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.ToTable("OrderProducts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int?>("StoreKeeperId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StoreKeeperId");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.ProductComponent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ComponentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.ToTable("ProductComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int>("VendorId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("VendorId");
|
||||
|
||||
b.ToTable("Purchases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseBuild", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BuildId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("PurchaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BuildId");
|
||||
|
||||
b.HasIndex("PurchaseId");
|
||||
|
||||
b.ToTable("PurchaseBuilds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseProduct", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("PurchaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.HasIndex("PurchaseId");
|
||||
|
||||
b.ToTable("PurchaseProducts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("StoreKeepers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Vendor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Vendors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Vendor", "Vendor")
|
||||
.WithMany("Builds")
|
||||
.HasForeignKey("VendorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vendor");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.BuildComponent", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("BuildId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany("BuldComponents")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Build");
|
||||
|
||||
b.Navigation("Component");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Comment", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
|
||||
.WithMany()
|
||||
.HasForeignKey("BuildId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Build");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", "StoreKeeperЗЛ")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("StoreKeeperId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("StoreKeeperЗЛ");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", null)
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ProductId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.OrderProduct", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Order", "Order")
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Order");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", null)
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("StoreKeeperId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.ProductComponent", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany("ProductComponents")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Component");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Vendor", null)
|
||||
.WithMany("Purchases")
|
||||
.HasForeignKey("VendorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseBuild", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
|
||||
.WithMany()
|
||||
.HasForeignKey("BuildId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Purchase", "Purchase")
|
||||
.WithMany("Builds")
|
||||
.HasForeignKey("PurchaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Build");
|
||||
|
||||
b.Navigation("Purchase");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseProduct", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Purchase", "Purchase")
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("PurchaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Product");
|
||||
|
||||
b.Navigation("Purchase");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("BuldComponents");
|
||||
|
||||
b.Navigation("ProductComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Navigation("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||
{
|
||||
b.Navigation("Builds");
|
||||
|
||||
b.Navigation("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
|
||||
b.Navigation("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Vendor", b =>
|
||||
{
|
||||
b.Navigation("Builds");
|
||||
|
||||
b.Navigation("Purchases");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ComputerHardwareStoreDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class cs2 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Count",
|
||||
table: "Orders",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "ProductId",
|
||||
table: "Orders",
|
||||
type: "integer",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Orders_ProductId",
|
||||
table: "Orders",
|
||||
column: "ProductId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Orders_Products_ProductId",
|
||||
table: "Orders",
|
||||
column: "ProductId",
|
||||
principalTable: "Products",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Orders_Products_ProductId",
|
||||
table: "Orders");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Orders_ProductId",
|
||||
table: "Orders");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Count",
|
||||
table: "Orders");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ProductId",
|
||||
table: "Orders");
|
||||
}
|
||||
}
|
||||
}
|
@ -131,12 +131,18 @@ namespace ComputerHardwareStoreDatabaseImplement.Migrations
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int?>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
@ -145,6 +151,8 @@ namespace ComputerHardwareStoreDatabaseImplement.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
@ -374,7 +382,7 @@ namespace ComputerHardwareStoreDatabaseImplement.Migrations
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany()
|
||||
.WithMany("BuldComponents")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
@ -406,6 +414,13 @@ namespace ComputerHardwareStoreDatabaseImplement.Migrations
|
||||
b.Navigation("StoreKeeperЗЛ");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", null)
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ProductId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.OrderProduct", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Order", "Order")
|
||||
@ -505,6 +520,8 @@ namespace ComputerHardwareStoreDatabaseImplement.Migrations
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("BuldComponents");
|
||||
|
||||
b.Navigation("ProductComponents");
|
||||
});
|
||||
|
||||
@ -516,6 +533,8 @@ namespace ComputerHardwareStoreDatabaseImplement.Migrations
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||
|
Loading…
Reference in New Issue
Block a user