From 0607b87a17548b00e6b8d2d3a2cbeef91cc26e1d Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 16 Nov 2021 12:38:12 +0100 Subject: [PATCH] Aggiunta migrazione DB x Tickets --- .../20211116113345_AddTicketModel.Designer.cs | 304 ++++++++++++++++++ .../20211116113345_AddTicketModel.cs | 52 +++ .../Migrations/LMDbContextModelSnapshot.cs | 66 ++++ 3 files changed, 422 insertions(+) create mode 100644 LiMan.DB/Migrations/20211116113345_AddTicketModel.Designer.cs create mode 100644 LiMan.DB/Migrations/20211116113345_AddTicketModel.cs diff --git a/LiMan.DB/Migrations/20211116113345_AddTicketModel.Designer.cs b/LiMan.DB/Migrations/20211116113345_AddTicketModel.Designer.cs new file mode 100644 index 0000000..e47f6f0 --- /dev/null +++ b/LiMan.DB/Migrations/20211116113345_AddTicketModel.Designer.cs @@ -0,0 +1,304 @@ +// +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("CodApp") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Descrizione") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.HasKey("CodApp"); + + b.ToTable("Applicativi"); + }); + + modelBuilder.Entity("LiMan.DB.DBModels.InstallazioneModel", b => + { + b.Property("CodInst") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Cliente") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Contatto") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Descrizione") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Email") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.HasKey("CodInst"); + + b.ToTable("Installazioni"); + }); + + modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b => + { + b.Property("IdxLic") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Chiave") + .HasColumnType("nvarchar(max)"); + + b.Property("CodApp") + .HasColumnType("nvarchar(50)"); + + b.Property("CodInst") + .HasColumnType("nvarchar(50)"); + + b.Property("DataEnigma") + .HasColumnType("datetime2"); + + b.Property("Descrizione") + .HasColumnType("nvarchar(max)"); + + b.Property("Enigma") + .HasColumnType("nvarchar(max)"); + + b.Property("Locked") + .HasColumnType("bit"); + + b.Property("NumLicenze") + .HasColumnType("int"); + + b.Property("Payload") + .HasColumnType("nvarchar(max)"); + + b.Property("Scadenza") + .HasColumnType("datetime2"); + + b.Property("Tipo") + .HasColumnType("int"); + + b.HasKey("IdxLic"); + + b.HasIndex("CodApp"); + + b.HasIndex("CodInst"); + + b.ToTable("Licenze"); + }); + + modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b => + { + b.Property("IdxLogLic") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Chiave") + .HasColumnType("nvarchar(max)"); + + b.Property("CodApp") + .HasColumnType("nvarchar(50)"); + + b.Property("CodInst") + .HasColumnType("nvarchar(50)"); + + b.Property("Descrizione") + .HasColumnType("nvarchar(max)"); + + b.Property("IdxLic") + .HasColumnType("int"); + + b.Property("NumLicenze") + .HasColumnType("int"); + + b.Property("Scadenza") + .HasColumnType("datetime2"); + + b.Property("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("IdxSubLic") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Chiave") + .HasColumnType("nvarchar(max)"); + + b.Property("CodImpiego") + .HasColumnType("nvarchar(max)"); + + b.Property("IdxLic") + .HasColumnType("int"); + + b.Property("Tipo") + .HasColumnType("int"); + + b.Property("VetoUnlock") + .HasColumnType("datetime2"); + + b.HasKey("IdxSubLic"); + + b.HasIndex("IdxLic"); + + b.ToTable("SubLicenze"); + }); + + modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b => + { + b.Property("IdxTicket") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CodImpiego") + .HasColumnType("nvarchar(max)"); + + b.Property("ContactEmail") + .HasColumnType("nvarchar(max)"); + + b.Property("ContactPhone") + .HasColumnType("nvarchar(max)"); + + b.Property("DtReq") + .HasColumnType("datetime2"); + + b.Property("IdxLic") + .HasColumnType("int"); + + b.Property("IdxSubLic") + .HasColumnType("int"); + + b.Property("ReqBody") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("SupplAnsw") + .HasColumnType("nvarchar(max)"); + + b.Property("SupplEmail") + .HasColumnType("nvarchar(max)"); + + b.Property("SupplUserCode") + .HasColumnType("nvarchar(max)"); + + b.Property("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 + } + } +} diff --git a/LiMan.DB/Migrations/20211116113345_AddTicketModel.cs b/LiMan.DB/Migrations/20211116113345_AddTicketModel.cs new file mode 100644 index 0000000..10895bd --- /dev/null +++ b/LiMan.DB/Migrations/20211116113345_AddTicketModel.cs @@ -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(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + DtReq = table.Column(type: "datetime2", nullable: false), + Tipo = table.Column(type: "int", nullable: false), + IdxLic = table.Column(type: "int", nullable: false), + IdxSubLic = table.Column(type: "int", nullable: false), + CodImpiego = table.Column(type: "nvarchar(max)", nullable: true), + ContactEmail = table.Column(type: "nvarchar(max)", nullable: true), + ContactPhone = table.Column(type: "nvarchar(max)", nullable: true), + ReqBody = table.Column(type: "nvarchar(max)", nullable: true), + Status = table.Column(type: "int", nullable: false), + SupplEmail = table.Column(type: "nvarchar(max)", nullable: true), + SupplUserCode = table.Column(type: "nvarchar(max)", nullable: true), + SupplAnsw = table.Column(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"); + } + } +} diff --git a/LiMan.DB/Migrations/LMDbContextModelSnapshot.cs b/LiMan.DB/Migrations/LMDbContextModelSnapshot.cs index a390127..343604c 100644 --- a/LiMan.DB/Migrations/LMDbContextModelSnapshot.cs +++ b/LiMan.DB/Migrations/LMDbContextModelSnapshot.cs @@ -182,6 +182,56 @@ namespace LiMan.DB.Migrations b.ToTable("SubLicenze"); }); + modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b => + { + b.Property("IdxTicket") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CodImpiego") + .HasColumnType("nvarchar(max)"); + + b.Property("ContactEmail") + .HasColumnType("nvarchar(max)"); + + b.Property("ContactPhone") + .HasColumnType("nvarchar(max)"); + + b.Property("DtReq") + .HasColumnType("datetime2"); + + b.Property("IdxLic") + .HasColumnType("int"); + + b.Property("IdxSubLic") + .HasColumnType("int"); + + b.Property("ReqBody") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("SupplAnsw") + .HasColumnType("nvarchar(max)"); + + b.Property("SupplEmail") + .HasColumnType("nvarchar(max)"); + + b.Property("SupplUserCode") + .HasColumnType("nvarchar(max)"); + + b.Property("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 } }