fix issue where module migrations were not being executed on upgrade due to version not being overridden
This commit is contained in:
parent
29741c0ec8
commit
916663b493
|
@ -4,7 +4,6 @@ using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Xml;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
using Oqtane.Infrastructure;
|
using Oqtane.Infrastructure;
|
||||||
|
@ -148,10 +147,11 @@ namespace Oqtane.Repository
|
||||||
|
|
||||||
if (moduledefinition == null)
|
if (moduledefinition == null)
|
||||||
{
|
{
|
||||||
// new module definition (version is explicitly not set because it is updated as part of module migrations at startup)
|
// new module definition
|
||||||
moduledefinition = new ModuleDefinition { ModuleDefinitionName = ModuleDefinition.ModuleDefinitionName };
|
moduledefinition = new ModuleDefinition { ModuleDefinitionName = ModuleDefinition.ModuleDefinitionName };
|
||||||
_db.ModuleDefinition.Add(moduledefinition);
|
_db.ModuleDefinition.Add(moduledefinition);
|
||||||
_db.SaveChanges();
|
_db.SaveChanges();
|
||||||
|
// version is explicitly not set because it is updated as part of module migrations at startup
|
||||||
ModuleDefinition.Version = "";
|
ModuleDefinition.Version = "";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -160,6 +160,8 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinition.Name = (!string.IsNullOrEmpty(moduledefinition.Name)) ? moduledefinition.Name : ModuleDefinition.Name;
|
ModuleDefinition.Name = (!string.IsNullOrEmpty(moduledefinition.Name)) ? moduledefinition.Name : ModuleDefinition.Name;
|
||||||
ModuleDefinition.Description = (!string.IsNullOrEmpty(moduledefinition.Description)) ? moduledefinition.Description : ModuleDefinition.Description;
|
ModuleDefinition.Description = (!string.IsNullOrEmpty(moduledefinition.Description)) ? moduledefinition.Description : ModuleDefinition.Description;
|
||||||
ModuleDefinition.Categories = (!string.IsNullOrEmpty(moduledefinition.Categories)) ? moduledefinition.Categories : ModuleDefinition.Categories;
|
ModuleDefinition.Categories = (!string.IsNullOrEmpty(moduledefinition.Categories)) ? moduledefinition.Categories : ModuleDefinition.Categories;
|
||||||
|
// get current version
|
||||||
|
ModuleDefinition.Version = moduledefinition.Version;
|
||||||
|
|
||||||
// remove module definition from list as it is already synced
|
// remove module definition from list as it is already synced
|
||||||
moduledefinitions.Remove(moduledefinition);
|
moduledefinitions.Remove(moduledefinition);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user