Aggiunta migrazione DB x Tickets

This commit is contained in:
Samuele Locatelli
2021-11-16 12:38:12 +01:00
parent eeb3ea43d8
commit 0607b87a17
3 changed files with 422 additions and 0 deletions
@@ -0,0 +1,304 @@
// <auto-generated />
using System;
using LiMan.DB;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace LiMan.DB.Migrations
{
[DbContext(typeof(LMDbContext))]
[Migration("20211116113345_AddTicketModel")]
partial class AddTicketModel
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.10")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("LiMan.DB.DBModels.ApplicativoModel", b =>
{
b.Property<string>("CodApp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.HasKey("CodApp");
b.ToTable("Applicativi");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstallazioneModel", b =>
{
b.Property<string>("CodInst")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Cliente")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Contatto")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Email")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.HasKey("CodInst");
b.ToTable("Installazioni");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Property<int>("IdxLic")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("DataEnigma")
.HasColumnType("datetime2");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Enigma")
.HasColumnType("nvarchar(max)");
b.Property<bool>("Locked")
.HasColumnType("bit");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<string>("Payload")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.ToTable("Licenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.Property<int>("IdxLogLic")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLogLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.HasIndex("IdxLic");
b.ToTable("LogLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.Property<int>("IdxSubLic")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.Property<DateTime>("VetoUnlock")
.HasColumnType("datetime2");
b.HasKey("IdxSubLic");
b.HasIndex("IdxLic");
b.ToTable("SubLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.Property<int>("IdxTicket")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactPhone")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DtReq")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("IdxSubLic")
.HasColumnType("int");
b.Property<string>("ReqBody")
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<string>("SupplAnsw")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplUserCode")
.HasColumnType("nvarchar(max)");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxTicket");
b.HasIndex("IdxLic");
b.ToTable("TicketLog");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany()
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Attivazioni")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany()
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Navigation("Attivazioni");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,52 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace LiMan.DB.Migrations
{
public partial class AddTicketModel : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "TicketLog",
columns: table => new
{
IdxTicket = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DtReq = table.Column<DateTime>(type: "datetime2", nullable: false),
Tipo = table.Column<int>(type: "int", nullable: false),
IdxLic = table.Column<int>(type: "int", nullable: false),
IdxSubLic = table.Column<int>(type: "int", nullable: false),
CodImpiego = table.Column<string>(type: "nvarchar(max)", nullable: true),
ContactEmail = table.Column<string>(type: "nvarchar(max)", nullable: true),
ContactPhone = table.Column<string>(type: "nvarchar(max)", nullable: true),
ReqBody = table.Column<string>(type: "nvarchar(max)", nullable: true),
Status = table.Column<int>(type: "int", nullable: false),
SupplEmail = table.Column<string>(type: "nvarchar(max)", nullable: true),
SupplUserCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
SupplAnsw = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TicketLog", x => x.IdxTicket);
table.ForeignKey(
name: "FK_TicketLog_Licenze_IdxLic",
column: x => x.IdxLic,
principalTable: "Licenze",
principalColumn: "IdxLic",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_TicketLog_IdxLic",
table: "TicketLog",
column: "IdxLic");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "TicketLog");
}
}
}
@@ -182,6 +182,56 @@ namespace LiMan.DB.Migrations
b.ToTable("SubLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.Property<int>("IdxTicket")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactPhone")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DtReq")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("IdxSubLic")
.HasColumnType("int");
b.Property<string>("ReqBody")
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<string>("SupplAnsw")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplUserCode")
.HasColumnType("nvarchar(max)");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxTicket");
b.HasIndex("IdxLic");
b.ToTable("TicketLog");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
@@ -221,6 +271,17 @@ namespace LiMan.DB.Migrations
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Attivazioni")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany()
@@ -230,6 +291,11 @@ namespace LiMan.DB.Migrations
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Navigation("Attivazioni");
});
#pragma warning restore 612, 618
}
}