Merge branch 'release/FixMigrateError'

This commit is contained in:
Samuele Locatelli
2021-09-29 12:15:35 +02:00
11 changed files with 107 additions and 46 deletions
+15
View File
@@ -46,6 +46,21 @@ namespace GWMS.Data.Controllers
return roundDate;
}
public bool DbForceMigrate()
{
bool answ = false;
try
{
dbCtx.DbForceMigrate();
answ = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in DbForceMigrate");
}
return answ;
}
public void Dispose()
{
// Clear database context
+28 -9
View File
@@ -28,15 +28,6 @@ namespace GWMS.Data
public GWMSContext(IConfiguration configuration)
{
_configuration = configuration;
try
{
// se non ci fosse... crea o migra!
Database.Migrate();
}
catch (Exception exc)
{
Log.Error(exc, "Exception during context initialization 01");
}
}
public GWMSContext(DbContextOptions<GWMSContext> options) : base(options)
@@ -57,19 +48,29 @@ namespace GWMS.Data
#region Public Properties
public virtual DbSet<RebootLogModel> DbRebootLog { get; set; }
public virtual DbSet<ConfigModel> DbSetConfig { get; set; }
public virtual DbSet<ItemModel> DbSetItems { get; set; }
public virtual DbSet<AnKeyValModel> DbSetKeyVal { get; set; }
public virtual DbSet<ListValModel> DbSetListVal { get; set; }
public virtual DbSet<OrderModel> DbSetOrders { get; set; }
public virtual DbSet<PlantDetailModel> DbSetPlant { get; set; }
public virtual DbSet<PlantLogModel> DbSetPlantLog { get; set; }
public virtual DbSet<PlantStatusModel> DbSetPlantStatus { get; set; }
public virtual DbSet<WeekPlanModel> DbSetPlantSupplWeekPlan { get; set; }
public virtual DbSet<SupplierModel> DbSetSupplier { get; set; }
public virtual DbSet<TransporterModel> DbSetTransporter { get; set; }
public virtual DbSet<UserModel> DbSetUser { get; set; }
#endregion Public Properties
@@ -133,5 +134,23 @@ namespace GWMS.Data
}
#endregion Protected Methods
#region Public Methods
public void DbForceMigrate()
{
try
{
// se non ci fosse... crea o migra!
Database.Migrate();
Log.Info("DbForceMigrate: done!");
}
catch (Exception exc)
{
Log.Error(exc, "DbForceMigrate: Exception during context initialization 01");
}
}
#endregion Public Methods
}
}
+1 -1
View File
@@ -33,7 +33,7 @@
<li class="list-group-item d-flex justify-content-between align-items-center small">
<span><i class="fas fa-compress-arrows-alt"></i> Alimentazione</span> <span><b>@getPressData("BHA", "N1")</b> <sub>bar</sub></span>
</li>
<li class="list-group-item active d-flex justify-content-between align-items-center py-1">PB Bassa</li>
<li class="list-group-item active d-flex justify-content-between align-items-center py-1">PB Media</li>
<li class="list-group-item d-flex justify-content-between align-items-center small">
<span><i class="fas fa-compress-arrows-alt"></i> Stoccaggio</span> <span><b>@getPressData("BL", "N1")</b> <sub>bar</sub></span>
</li>
+5
View File
@@ -396,6 +396,11 @@ namespace GWMS.UI.Data
return answ;
}
public async Task<bool> DbForceMigrate()
{
return await Task.FromResult(dbController.DbForceMigrate());
}
public void Dispose()
{
// Clear database controller
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<Version>1.0.2109.2909</Version>
<Version>1.0.2109.2912</Version>
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
+1 -31
View File
@@ -3,10 +3,6 @@
@using GWMS.UI.Data
@using GWMS.UI.Components
@inject GWMSDataService DataService
@inject MessageService AppMService
@inject IJSRuntime JSRuntime
<div class="card">
<div class="card-header table-primary h3">
<h2>Setup Parametri</h2>
@@ -24,30 +20,4 @@
</div>
</div>
</div>
</div>
@code {
protected int numDays { get; set; } = 7;
protected int stepMin { get; set; } = 30;
protected int maxHourRate { get; set; } = 800;
protected bool processRunning { get; set; } = false;
protected async Task resetDB()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler risimulare l'intero set di dati?"))
return;
processRunning = true;
//DataService.RegenDB(numDays, stepMin, maxHourRate);
processRunning = false;
}
protected override async Task OnInitializedAsync()
{
AppMService.ShowSearch = false;
AppMService.PageName = "Setup Parametri";
AppMService.PageIcon = "fas fa-wrench pr-2";
}
}
</div>
+52
View File
@@ -0,0 +1,52 @@
using GWMS.UI.Data;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace GWMS.UI.Pages
{
public partial class Parameters
{
#region Protected Properties
[Inject]
protected MessageService AppMService { get; set; }
[Inject]
protected GWMSDataService DataService { get; set; }
[Inject]
protected IJSRuntime JSRuntime { get; set; }
protected int maxHourRate { get; set; } = 800;
protected int numDays { get; set; } = 7;
protected bool processRunning { get; set; } = false;
protected int stepMin { get; set; } = 30;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
AppMService.ShowSearch = false;
AppMService.PageName = "Setup Parametri";
AppMService.PageIcon = "fas fa-wrench pr-2";
}
protected async Task resetDB()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler risimulare l'intero set di dati?"))
return;
processRunning = true;
//DataService.RegenDB(numDays, stepMin, maxHourRate);
processRunning = false;
}
#endregion Protected Methods
}
}
+1 -1
View File
@@ -122,7 +122,7 @@ namespace GWMS.UI
// inizializzo il DB e creo (se necessario) l'utente
DbConfig.CheckUser(nKey, sKey);
// verifico se serve applicazione migrazioni
//DbConfig.ExecMigrationMain();
DbConfig.ExecMigrationMain();
//DbConfig.ExecMigrationIdentity();
// altri parametri per check vari
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GWMS - Gas Warehouse Management System</i>
<h4>Versione: 1.0.2109.2909</h4>
<h4>Versione: 1.0.2109.2912</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.0.2109.2909
1.0.2109.2912
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.0.2109.2909</version>
<version>1.0.2109.2912</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>