458 lines
16 KiB
C#
458 lines
16 KiB
C#
// <auto-generated />
|
|
using System;
|
|
using DongfangHydro.Dashboard.Api.Data;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
|
|
#nullable disable
|
|
|
|
namespace DongfangHydro.Dashboard.Api.Data.Migrations
|
|
{
|
|
[DbContext(typeof(DashboardDbContext))]
|
|
[Migration("20260710025438_InitialCreate")]
|
|
partial class InitialCreate
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
{
|
|
#pragma warning disable 612, 618
|
|
modelBuilder
|
|
.HasAnnotation("ProductVersion", "8.0.20")
|
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
|
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
|
|
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.Partner", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("uniqueidentifier");
|
|
|
|
b.Property<string>("Code")
|
|
.IsRequired()
|
|
.HasMaxLength(40)
|
|
.HasColumnType("nvarchar(40)");
|
|
|
|
b.Property<string>("ContactName")
|
|
.IsRequired()
|
|
.HasMaxLength(80)
|
|
.HasColumnType("nvarchar(80)");
|
|
|
|
b.Property<string>("ContactPhone")
|
|
.IsRequired()
|
|
.HasMaxLength(32)
|
|
.HasColumnType("nvarchar(32)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(120)
|
|
.HasColumnType("nvarchar(120)");
|
|
|
|
b.Property<string>("PartnerType")
|
|
.IsRequired()
|
|
.HasMaxLength(32)
|
|
.HasColumnType("nvarchar(32)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Code")
|
|
.IsUnique();
|
|
|
|
b.ToTable("Partners", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionLine", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("uniqueidentifier");
|
|
|
|
b.Property<string>("Code")
|
|
.IsRequired()
|
|
.HasMaxLength(40)
|
|
.HasColumnType("nvarchar(40)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(80)
|
|
.HasColumnType("nvarchar(80)");
|
|
|
|
b.Property<string>("Owner")
|
|
.IsRequired()
|
|
.HasMaxLength(80)
|
|
.HasColumnType("nvarchar(80)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Code")
|
|
.IsUnique();
|
|
|
|
b.ToTable("ProductionLines", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionNode", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("uniqueidentifier");
|
|
|
|
b.Property<DateTime?>("ActualEnd")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<DateTime?>("ActualStart")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<string>("Code")
|
|
.IsRequired()
|
|
.HasMaxLength(60)
|
|
.HasColumnType("nvarchar(60)");
|
|
|
|
b.Property<int>("CompletedQty")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("DefectQty")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("DelayDays")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("DelayReason")
|
|
.IsRequired()
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<int>("Level")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("MaterialCode")
|
|
.IsRequired()
|
|
.HasMaxLength(80)
|
|
.HasColumnType("nvarchar(80)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(240)
|
|
.HasColumnType("nvarchar(240)");
|
|
|
|
b.Property<string>("NodeType")
|
|
.IsRequired()
|
|
.HasMaxLength(32)
|
|
.HasColumnType("nvarchar(32)");
|
|
|
|
b.Property<string>("OperationCode")
|
|
.IsRequired()
|
|
.HasMaxLength(60)
|
|
.HasColumnType("nvarchar(60)");
|
|
|
|
b.Property<Guid>("OrderId")
|
|
.HasColumnType("uniqueidentifier");
|
|
|
|
b.Property<string>("Owner")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<Guid?>("ParentNodeId")
|
|
.HasColumnType("uniqueidentifier");
|
|
|
|
b.Property<DateTime>("PlannedEnd")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<DateTime>("PlannedStart")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<int>("Progress")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("RequiredQty")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("RiskLevel")
|
|
.IsRequired()
|
|
.HasMaxLength(32)
|
|
.HasColumnType("nvarchar(32)");
|
|
|
|
b.Property<byte[]>("RowVersion")
|
|
.IsConcurrencyToken()
|
|
.IsRequired()
|
|
.ValueGeneratedOnAddOrUpdate()
|
|
.HasColumnType("rowversion");
|
|
|
|
b.Property<int>("SortOrder")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("StationName")
|
|
.IsRequired()
|
|
.HasMaxLength(120)
|
|
.HasColumnType("nvarchar(120)");
|
|
|
|
b.Property<string>("Status")
|
|
.IsRequired()
|
|
.HasMaxLength(32)
|
|
.HasColumnType("nvarchar(32)");
|
|
|
|
b.Property<string>("SupplyType")
|
|
.IsRequired()
|
|
.HasMaxLength(32)
|
|
.HasColumnType("nvarchar(32)");
|
|
|
|
b.Property<DateTimeOffset>("UpdatedAt")
|
|
.HasColumnType("datetimeoffset");
|
|
|
|
b.Property<string>("Vendor")
|
|
.IsRequired()
|
|
.HasMaxLength(120)
|
|
.HasColumnType("nvarchar(120)");
|
|
|
|
b.Property<string>("VisualKey")
|
|
.IsRequired()
|
|
.HasMaxLength(40)
|
|
.HasColumnType("nvarchar(40)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("OrderId", "ParentNodeId", "SortOrder");
|
|
|
|
b.HasIndex("OrderId", "NodeType", "RiskLevel", "Status");
|
|
|
|
b.ToTable("ProductionNodes", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("uniqueidentifier");
|
|
|
|
b.Property<int>("BatchQty")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Code")
|
|
.IsRequired()
|
|
.HasMaxLength(40)
|
|
.HasColumnType("nvarchar(40)");
|
|
|
|
b.Property<int>("CompletedQty")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTimeOffset>("CreatedAt")
|
|
.HasColumnType("datetimeoffset");
|
|
|
|
b.Property<double>("DailyDelta")
|
|
.HasColumnType("float");
|
|
|
|
b.Property<int>("DelayDays")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<Guid?>("LineId")
|
|
.HasColumnType("uniqueidentifier");
|
|
|
|
b.Property<string>("LineName")
|
|
.IsRequired()
|
|
.HasMaxLength(80)
|
|
.HasColumnType("nvarchar(80)");
|
|
|
|
b.Property<string>("Owner")
|
|
.IsRequired()
|
|
.HasMaxLength(80)
|
|
.HasColumnType("nvarchar(80)");
|
|
|
|
b.Property<double>("PlanAchievement")
|
|
.HasColumnType("float");
|
|
|
|
b.Property<DateTime>("PlannedEnd")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<DateTime>("PlannedStart")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<string>("ProductName")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<int>("Progress")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("RequiredQty")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("RiskLevel")
|
|
.IsRequired()
|
|
.HasMaxLength(32)
|
|
.HasColumnType("nvarchar(32)");
|
|
|
|
b.Property<byte[]>("RowVersion")
|
|
.IsConcurrencyToken()
|
|
.IsRequired()
|
|
.ValueGeneratedOnAddOrUpdate()
|
|
.HasColumnType("rowversion");
|
|
|
|
b.Property<string>("Status")
|
|
.IsRequired()
|
|
.HasMaxLength(32)
|
|
.HasColumnType("nvarchar(32)");
|
|
|
|
b.Property<string>("ThumbnailKey")
|
|
.IsRequired()
|
|
.HasMaxLength(40)
|
|
.HasColumnType("nvarchar(40)");
|
|
|
|
b.Property<DateTimeOffset>("UpdatedAt")
|
|
.HasColumnType("datetimeoffset");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Code")
|
|
.IsUnique();
|
|
|
|
b.HasIndex("LineId");
|
|
|
|
b.HasIndex("Status", "RiskLevel", "PlannedEnd");
|
|
|
|
b.ToTable("ProductionOrders", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionTrendPoint", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("uniqueidentifier");
|
|
|
|
b.Property<double>("Achievement")
|
|
.HasColumnType("float");
|
|
|
|
b.Property<int>("ActualQty")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("Completion")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<Guid>("OrderId")
|
|
.HasColumnType("uniqueidentifier");
|
|
|
|
b.Property<int>("PlannedQty")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("Risk")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTimeOffset>("SampleTime")
|
|
.HasColumnType("datetimeoffset");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("OrderId", "SampleTime")
|
|
.IsDescending(false, true);
|
|
|
|
b.ToTable("ProductionTrendPoints", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.RiskEvent", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("uniqueidentifier");
|
|
|
|
b.Property<string>("HandlingStatus")
|
|
.IsRequired()
|
|
.HasMaxLength(32)
|
|
.HasColumnType("nvarchar(32)");
|
|
|
|
b.Property<string>("Message")
|
|
.IsRequired()
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<Guid>("NodeId")
|
|
.HasColumnType("uniqueidentifier");
|
|
|
|
b.Property<string>("NodeName")
|
|
.IsRequired()
|
|
.HasMaxLength(240)
|
|
.HasColumnType("nvarchar(240)");
|
|
|
|
b.Property<DateTimeOffset>("OccurredAt")
|
|
.HasColumnType("datetimeoffset");
|
|
|
|
b.Property<string>("OrderCode")
|
|
.IsRequired()
|
|
.HasMaxLength(40)
|
|
.HasColumnType("nvarchar(40)");
|
|
|
|
b.Property<Guid>("OrderId")
|
|
.HasColumnType("uniqueidentifier");
|
|
|
|
b.Property<string>("RiskLevel")
|
|
.IsRequired()
|
|
.HasMaxLength(32)
|
|
.HasColumnType("nvarchar(32)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("OrderId", "NodeId");
|
|
|
|
b.HasIndex("OrderId", "OccurredAt")
|
|
.IsDescending(false, true);
|
|
|
|
b.ToTable("RiskEvents", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionNode", b =>
|
|
{
|
|
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", null)
|
|
.WithMany()
|
|
.HasForeignKey("OrderId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionNode", null)
|
|
.WithMany()
|
|
.HasForeignKey("OrderId", "ParentNodeId")
|
|
.HasPrincipalKey("OrderId", "Id")
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
});
|
|
|
|
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", b =>
|
|
{
|
|
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionLine", null)
|
|
.WithMany()
|
|
.HasForeignKey("LineId")
|
|
.OnDelete(DeleteBehavior.SetNull);
|
|
});
|
|
|
|
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionTrendPoint", b =>
|
|
{
|
|
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", null)
|
|
.WithMany()
|
|
.HasForeignKey("OrderId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.RiskEvent", b =>
|
|
{
|
|
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", null)
|
|
.WithMany()
|
|
.HasForeignKey("OrderId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionNode", null)
|
|
.WithMany()
|
|
.HasForeignKey("OrderId", "NodeId")
|
|
.HasPrincipalKey("OrderId", "Id")
|
|
.OnDelete(DeleteBehavior.NoAction)
|
|
.IsRequired();
|
|
});
|
|
#pragma warning restore 612, 618
|
|
}
|
|
}
|
|
}
|