Merge branch 'release/AddDbMigrationTabCount01'

This commit is contained in:
Samuele Locatelli
2024-04-18 16:46:45 +02:00
10 changed files with 103 additions and 7 deletions
+5 -3
View File
@@ -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
/// <summary>
/// Classe fake x il conteggio tabelle e check preliminari
/// </summary>
[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
}
+7
View File
@@ -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
}
}
@@ -0,0 +1,39 @@
// <auto-generated />
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<string>("TableName")
.HasColumnType("varchar(255)");
b.Property<int>("Count")
.HasColumnType("int");
b.HasKey("TableName");
b.ToTable("DbSetCounts");
});
#pragma warning restore 612, 618
}
}
}
@@ -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<string>(type: "varchar(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Count = table.Column<int>(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");
}
}
}
@@ -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<string>("TableName")
.HasColumnType("varchar(255)");
b.Property<int>("Count")
.HasColumnType("int");
b.HasKey("TableName");
b.ToTable("DbSetCounts");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
@@ -78,6 +78,8 @@
protected async Task Processing()
{
processRunning = true;
DbConfig.ExecMigrationMain();
DbConfig.ExecMigrationIdentity();
await ReloadData();
}
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>1.0.2404.1117</Version>
<Version>1.0.2404.1816</Version>
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GWMS - Gas Warehouse Management System</i>
<h4>Versione: 1.0.2404.1117</h4>
<h4>Versione: 1.0.2404.1816</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.0.2404.1117
1.0.2404.1816
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.0.2404.1117</version>
<version>1.0.2404.1816</version>
<url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog>
<mandatory>false</mandatory>