149 lines
4.7 KiB
C#
149 lines
4.7 KiB
C#
// <auto-generated />
|
|
using DEMO.Data;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
|
|
#nullable disable
|
|
|
|
namespace DEMO.Migrations
|
|
{
|
|
[DbContext(typeof(AppDbContext))]
|
|
[Migration("20260908220130_AddStock")]
|
|
partial class AddStock
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
{
|
|
#pragma warning disable 612, 618
|
|
modelBuilder
|
|
.HasAnnotation("ProductVersion", "10.0.12")
|
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
|
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
|
|
modelBuilder.Entity("DEMO.Models.Category", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("Categories");
|
|
});
|
|
|
|
modelBuilder.Entity("DEMO.Models.Product", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("CategoryId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<decimal>("Price")
|
|
.HasColumnType("decimal(18,2)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("CategoryId");
|
|
|
|
b.ToTable("Products");
|
|
});
|
|
|
|
modelBuilder.Entity("DEMO.Models.Stock", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("ProductId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("Quantity")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("WarehouseId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("ProductId");
|
|
|
|
b.HasIndex("WarehouseId");
|
|
|
|
b.ToTable("Stocks");
|
|
});
|
|
|
|
modelBuilder.Entity("DEMO.Models.Warehouse", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("Address")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("Warehouses");
|
|
});
|
|
|
|
modelBuilder.Entity("DEMO.Models.Product", b =>
|
|
{
|
|
b.HasOne("DEMO.Models.Category", "Category")
|
|
.WithMany()
|
|
.HasForeignKey("CategoryId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Category");
|
|
});
|
|
|
|
modelBuilder.Entity("DEMO.Models.Stock", b =>
|
|
{
|
|
b.HasOne("DEMO.Models.Product", "Product")
|
|
.WithMany()
|
|
.HasForeignKey("ProductId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("DEMO.Models.Warehouse", "Warehouse")
|
|
.WithMany()
|
|
.HasForeignKey("WarehouseId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Product");
|
|
|
|
b.Navigation("Warehouse");
|
|
});
|
|
#pragma warning restore 612, 618
|
|
}
|
|
}
|
|
}
|