From 82eea1eb0b922f4656aba805cf07bc803d46ab54 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 18 Apr 2024 13:04:53 +0200 Subject: [PATCH 1/3] Inizio re-adding DbSetCount --- GWMS.Data/DatabaseModels/TableCount.cs | 8 ++-- ...749_ReAddTableCounter4Identity.Designer.cs | 39 +++++++++++++++++++ ...240418104749_ReAddTableCounter4Identity.cs | 33 ++++++++++++++++ .../UserIdentityDbContextModelSnapshot.cs | 13 +++++++ GWMS.UI/GWMS.UI.csproj | 2 +- Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 8 files changed, 94 insertions(+), 7 deletions(-) create mode 100644 GWMS.Data/Migrations/20240418104749_ReAddTableCounter4Identity.Designer.cs create mode 100644 GWMS.Data/Migrations/20240418104749_ReAddTableCounter4Identity.cs diff --git a/GWMS.Data/DatabaseModels/TableCount.cs b/GWMS.Data/DatabaseModels/TableCount.cs index 618f54b..a86a551 100644 --- a/GWMS.Data/DatabaseModels/TableCount.cs +++ b/GWMS.Data/DatabaseModels/TableCount.cs @@ -1,6 +1,7 @@ using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; @@ -11,13 +12,14 @@ namespace GWMS.Data.DatabaseModels /// /// Classe fake x il conteggio tabelle e check preliminari /// - [NotMapped] + [Table("DbSetCounts")] public class TableCount { #region Public Properties - public int Count { get; set; } - public string TableName { get; set; } + [Key] + public string TableName { get; set; } = "ND"; + public int Count { get; set; } = 0; #endregion Public Properties } diff --git a/GWMS.Data/Migrations/20240418104749_ReAddTableCounter4Identity.Designer.cs b/GWMS.Data/Migrations/20240418104749_ReAddTableCounter4Identity.Designer.cs new file mode 100644 index 0000000..da8b293 --- /dev/null +++ b/GWMS.Data/Migrations/20240418104749_ReAddTableCounter4Identity.Designer.cs @@ -0,0 +1,39 @@ +// +using System; +using GWMS.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace GWMS.User.Migrations +{ + [DbContext(typeof(UserIdentityDbContext))] + [Migration("20240418104749_ReAddTableCounter4Identity")] + partial class ReAddTableCounter4Identity + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.2") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.TableCount", b => + { + b.Property("TableName") + .HasColumnType("varchar(255)"); + + b.Property("Count") + .HasColumnType("int"); + + b.HasKey("TableName"); + + b.ToTable("DbSetCounts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/GWMS.Data/Migrations/20240418104749_ReAddTableCounter4Identity.cs b/GWMS.Data/Migrations/20240418104749_ReAddTableCounter4Identity.cs new file mode 100644 index 0000000..9b0bfe7 --- /dev/null +++ b/GWMS.Data/Migrations/20240418104749_ReAddTableCounter4Identity.cs @@ -0,0 +1,33 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace GWMS.User.Migrations +{ + public partial class ReAddTableCounter4Identity : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "DbSetCounts", + columns: table => new + { + TableName = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Count = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DbSetCounts", x => x.TableName); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "DbSetCounts"); + } + } +} diff --git a/GWMS.Data/Migrations/UserIdentityDbContextModelSnapshot.cs b/GWMS.Data/Migrations/UserIdentityDbContextModelSnapshot.cs index 6ab71fb..a262f01 100644 --- a/GWMS.Data/Migrations/UserIdentityDbContextModelSnapshot.cs +++ b/GWMS.Data/Migrations/UserIdentityDbContextModelSnapshot.cs @@ -19,6 +19,19 @@ namespace GWMS.User.Migrations .HasAnnotation("ProductVersion", "6.0.2") .HasAnnotation("Relational:MaxIdentifierLength", 64); + modelBuilder.Entity("GWMS.Data.DatabaseModels.TableCount", b => + { + b.Property("TableName") + .HasColumnType("varchar(255)"); + + b.Property("Count") + .HasColumnType("int"); + + b.HasKey("TableName"); + + b.ToTable("DbSetCounts"); + }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { b.Property("Id") diff --git a/GWMS.UI/GWMS.UI.csproj b/GWMS.UI/GWMS.UI.csproj index 8eeffc2..71ee3f5 100644 --- a/GWMS.UI/GWMS.UI.csproj +++ b/GWMS.UI/GWMS.UI.csproj @@ -2,7 +2,7 @@ net6.0 - 1.0.2404.1117 + 1.0.2404.1812 95c9f021-52d1-4390-a670-5810b7b777b0 true true diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 7fc31c4..0166022 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GWMS - Gas Warehouse Management System -

Versione: 1.0.2404.1117

+

Versione: 1.0.2404.1812


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 3551ccd..5d81679 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.0.2404.1117 +1.0.2404.1812 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 9faab04..879d6b2 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.0.2404.1117 + 1.0.2404.1812 http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html false From 341029019fcbd19e22f1150c135f7ba3d73f115e Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 18 Apr 2024 16:30:17 +0200 Subject: [PATCH 2/3] Rimsso anche migrazione identity --- GWMS.UI/GWMS.UI.csproj | 2 +- GWMS.UI/Startup.cs | 2 +- Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/GWMS.UI/GWMS.UI.csproj b/GWMS.UI/GWMS.UI.csproj index 71ee3f5..2baedb8 100644 --- a/GWMS.UI/GWMS.UI.csproj +++ b/GWMS.UI/GWMS.UI.csproj @@ -2,7 +2,7 @@ net6.0 - 1.0.2404.1812 + 1.0.2404.1816 95c9f021-52d1-4390-a670-5810b7b777b0 true true diff --git a/GWMS.UI/Startup.cs b/GWMS.UI/Startup.cs index ddd4f5c..a78eef7 100644 --- a/GWMS.UI/Startup.cs +++ b/GWMS.UI/Startup.cs @@ -122,7 +122,7 @@ namespace GWMS.UI DbConfig.CheckUser(nKey, sKey); // verifico se serve applicazione migrazioni DbConfig.ExecMigrationMain(); - //DbConfig.ExecMigrationIdentity(); + DbConfig.ExecMigrationIdentity(); // altri parametri per check vari string connStringDB = DbConfig.CONNECTION_STRING; diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 0166022..2ccfe3a 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GWMS - Gas Warehouse Management System -

    Versione: 1.0.2404.1812

    +

    Versione: 1.0.2404.1816


    Note di rilascio:
    • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 5d81679..7b4d59f 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.0.2404.1812 +1.0.2404.1816 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 879d6b2..4b4fcba 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.0.2404.1812 + 1.0.2404.1816 http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html false From 46854b969f09507de6e9074a1f299a54e625733d Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 18 Apr 2024 16:41:25 +0200 Subject: [PATCH 3/3] Update log x gestione update DB --- GWMS.Data/DbConfig.cs | 7 +++++++ GWMS.UI/Components/SetupDiagnostics.razor | 2 ++ GWMS.UI/Startup.cs | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/GWMS.Data/DbConfig.cs b/GWMS.Data/DbConfig.cs index 0bc5898..d350030 100644 --- a/GWMS.Data/DbConfig.cs +++ b/GWMS.Data/DbConfig.cs @@ -1,4 +1,5 @@ using Microsoft.EntityFrameworkCore; +using NLog; using System.Threading.Tasks; namespace GWMS.Data @@ -43,17 +44,21 @@ namespace GWMS.Data public static bool ExecMigrationIdentity() { + Log.Info($"ExecMigrationIdentity: Start"); // esecuzione migrazione var migrateTask = Task.Run(async () => await DbAdmin.migrateDbIdentity()); migrateTask.Wait(); + Log.Info($"ExecMigrationIdentity: Completed"); return migrateTask.Result; } public static bool ExecMigrationMain() { + Log.Info($"ExecMigrationMain: Start"); // esecuzione migrazione var migrateTask = Task.Run(async () => await DbAdmin.migrateDbMain()); migrateTask.Wait(); + Log.Info($"ExecMigrationMain: Completed"); return migrateTask.Result; } @@ -74,6 +79,8 @@ namespace GWMS.Data return serverVersion; } + private static Logger Log = LogManager.GetCurrentClassLogger(); + #endregion Public Methods } } \ No newline at end of file diff --git a/GWMS.UI/Components/SetupDiagnostics.razor b/GWMS.UI/Components/SetupDiagnostics.razor index 838ae54..670750a 100644 --- a/GWMS.UI/Components/SetupDiagnostics.razor +++ b/GWMS.UI/Components/SetupDiagnostics.razor @@ -78,6 +78,8 @@ protected async Task Processing() { processRunning = true; + DbConfig.ExecMigrationMain(); + DbConfig.ExecMigrationIdentity(); await ReloadData(); } diff --git a/GWMS.UI/Startup.cs b/GWMS.UI/Startup.cs index a78eef7..ddd4f5c 100644 --- a/GWMS.UI/Startup.cs +++ b/GWMS.UI/Startup.cs @@ -122,7 +122,7 @@ namespace GWMS.UI DbConfig.CheckUser(nKey, sKey); // verifico se serve applicazione migrazioni DbConfig.ExecMigrationMain(); - DbConfig.ExecMigrationIdentity(); + //DbConfig.ExecMigrationIdentity(); // altri parametri per check vari string connStringDB = DbConfig.CONNECTION_STRING;