Fix migrazioni
This commit is contained in:
@@ -1,297 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MagMan.Data.Tenant;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MagMan.Data.Tenant.Migrations
|
||||
{
|
||||
[DbContext(typeof(MagManContext))]
|
||||
[Migration("20240122174314_InitDb")]
|
||||
partial class InitDb
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.25")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.AliasModel", b =>
|
||||
{
|
||||
b.Property<string>("Family")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ValueOriginal")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ValueAlias")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Family", "ValueOriginal");
|
||||
|
||||
b.ToTable("AliasList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.ConfigModel", b =>
|
||||
{
|
||||
b.Property<string>("KeyName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<string>("Note")
|
||||
.IsRequired()
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("varchar(250)")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.Property<string>("Val")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<string>("ValStd")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnOrder(2)
|
||||
.HasComment("Valore di default/riferimento per la variabile");
|
||||
|
||||
b.HasKey("KeyName");
|
||||
|
||||
b.ToTable("Config");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.MaterialModel", b =>
|
||||
{
|
||||
b.Property<int>("MatId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("HMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<decimal>("LMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<string>("MatCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MatDesc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<decimal>("WMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.HasKey("MatId");
|
||||
|
||||
b.ToTable("MaterialsList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.ProjModel", b =>
|
||||
{
|
||||
b.Property<int>("ProjExtDbId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BTLFileName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("DtCreated")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtLastAction")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtSchedule")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DtStartProd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool>("IsArchived")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("KeyNum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ListName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Machine")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("MachineID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("ProcTimeEst")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<double>("ProcTimeReal")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("ProjDescription")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ProjExtDbId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ProjExtId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ProjExtDbId");
|
||||
|
||||
b.HasIndex("IsActive");
|
||||
|
||||
b.HasIndex("IsArchived");
|
||||
|
||||
b.HasIndex("KeyNum");
|
||||
|
||||
b.HasIndex("MachineID");
|
||||
|
||||
b.HasIndex("ProjExtDbId");
|
||||
|
||||
b.ToTable("ProjList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.RawItemModel", b =>
|
||||
{
|
||||
b.Property<int>("RawItemId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("HMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool>("IsRemn")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<decimal>("LMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.Property<string>("Location")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("MatId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("QtyAvail")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("WMm")
|
||||
.HasColumnType("decimal(65,30)");
|
||||
|
||||
b.HasKey("RawItemId");
|
||||
|
||||
b.HasIndex("MatId");
|
||||
|
||||
b.ToTable("RawItemList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.RequestPlanModel", b =>
|
||||
{
|
||||
b.Property<int>("RequestId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DtRequest")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("ProjExtDbId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ReqState")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("RequestId");
|
||||
|
||||
b.ToTable("RequestPlan");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.ResourceModel", b =>
|
||||
{
|
||||
b.Property<int>("ResourceId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Qty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RawItemId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RequestId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ResourceId");
|
||||
|
||||
b.HasIndex("RequestId");
|
||||
|
||||
b.ToTable("ResourceList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.RawItemModel", b =>
|
||||
{
|
||||
b.HasOne("MagMan.Data.Tenant.DbModels.MaterialModel", "MaterialNav")
|
||||
.WithMany("RawItemList")
|
||||
.HasForeignKey("MatId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MaterialNav");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.ResourceModel", b =>
|
||||
{
|
||||
b.HasOne("MagMan.Data.Tenant.DbModels.RequestPlanModel", "RequestNav")
|
||||
.WithMany("ResourcesList")
|
||||
.HasForeignKey("RequestId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("RequestNav");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.MaterialModel", b =>
|
||||
{
|
||||
b.Navigation("RawItemList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MagMan.Data.Tenant.DbModels.RequestPlanModel", b =>
|
||||
{
|
||||
b.Navigation("ResourcesList");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MagMan.Data.Tenant.Migrations
|
||||
{
|
||||
public partial class AddMovMag : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_ProjList",
|
||||
table: "ProjList");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "ProjExtDbId",
|
||||
table: "RequestPlan",
|
||||
newName: "ProjDbId");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "ProjExtDbId",
|
||||
table: "ProjList",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int")
|
||||
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "ProjDbId",
|
||||
table: "ProjList",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_ProjList",
|
||||
table: "ProjList",
|
||||
column: "ProjDbId");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MovMag",
|
||||
columns: table => new
|
||||
{
|
||||
MovID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
DtRec = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
RawItemId = table.Column<int>(type: "int", nullable: false),
|
||||
QtyRec = table.Column<int>(type: "int", nullable: false),
|
||||
UserId = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Note = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MovMag", x => x.MovID);
|
||||
table.ForeignKey(
|
||||
name: "FK_MovMag_RawItemList_RawItemId",
|
||||
column: x => x.RawItemId,
|
||||
principalTable: "RawItemList",
|
||||
principalColumn: "RawItemId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ResourceList_RawItemId",
|
||||
table: "ResourceList",
|
||||
column: "RawItemId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MovMag_RawItemId",
|
||||
table: "MovMag",
|
||||
column: "RawItemId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ResourceList_RawItemList_RawItemId",
|
||||
table: "ResourceList",
|
||||
column: "RawItemId",
|
||||
principalTable: "RawItemList",
|
||||
principalColumn: "RawItemId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ResourceList_RawItemList_RawItemId",
|
||||
table: "ResourceList");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MovMag");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ResourceList_RawItemId",
|
||||
table: "ResourceList");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_ProjList",
|
||||
table: "ProjList");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ProjDbId",
|
||||
table: "ProjList");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "ProjDbId",
|
||||
table: "RequestPlan",
|
||||
newName: "ProjExtDbId");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "ProjExtDbId",
|
||||
table: "ProjList",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int")
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_ProjList",
|
||||
table: "ProjList",
|
||||
column: "ProjExtDbId");
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -11,8 +11,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
namespace MagMan.Data.Tenant.Migrations
|
||||
{
|
||||
[DbContext(typeof(MagManContext))]
|
||||
[Migration("20240125174127_AddMovMag")]
|
||||
partial class AddMovMag
|
||||
[Migration("20240125174457_InitDb")]
|
||||
partial class InitDb
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
+48
-3
@@ -150,6 +150,32 @@ namespace MagMan.Data.Tenant.Migrations
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MovMag",
|
||||
columns: table => new
|
||||
{
|
||||
MovID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
DtRec = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
RawItemId = table.Column<int>(type: "int", nullable: false),
|
||||
QtyRec = table.Column<int>(type: "int", nullable: false),
|
||||
UserId = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Note = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MovMag", x => x.MovID);
|
||||
table.ForeignKey(
|
||||
name: "FK_MovMag_RawItemList_RawItemId",
|
||||
column: x => x.RawItemId,
|
||||
principalTable: "RawItemList",
|
||||
principalColumn: "RawItemId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ResourceList",
|
||||
columns: table => new
|
||||
@@ -163,6 +189,12 @@ namespace MagMan.Data.Tenant.Migrations
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ResourceList", x => x.ResourceId);
|
||||
table.ForeignKey(
|
||||
name: "FK_ResourceList_RawItemList_RawItemId",
|
||||
column: x => x.RawItemId,
|
||||
principalTable: "RawItemList",
|
||||
principalColumn: "RawItemId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_ResourceList_RequestPlan_RequestId",
|
||||
column: x => x.RequestId,
|
||||
@@ -172,6 +204,11 @@ namespace MagMan.Data.Tenant.Migrations
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MovMag_RawItemId",
|
||||
table: "MovMag",
|
||||
column: "RawItemId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProjList_IsActive",
|
||||
table: "ProjList",
|
||||
@@ -202,6 +239,11 @@ namespace MagMan.Data.Tenant.Migrations
|
||||
table: "RawItemList",
|
||||
column: "MatId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ResourceList_RawItemId",
|
||||
table: "ResourceList",
|
||||
column: "RawItemId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ResourceList_RequestId",
|
||||
table: "ResourceList",
|
||||
@@ -217,19 +259,22 @@ namespace MagMan.Data.Tenant.Migrations
|
||||
name: "Config");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ProjList");
|
||||
name: "MovMag");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RawItemList");
|
||||
name: "ProjList");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ResourceList");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MaterialsList");
|
||||
name: "RawItemList");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RequestPlan");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MaterialsList");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user