diff --git a/Oqtane.Client/Modules/Admin/Jobs/Edit.razor b/Oqtane.Client/Modules/Admin/Jobs/Edit.razor index 26d96688..3a7c3005 100644 --- a/Oqtane.Client/Modules/Admin/Jobs/Edit.razor +++ b/Oqtane.Client/Modules/Admin/Jobs/Edit.razor @@ -197,7 +197,7 @@ } catch (Exception ex) { - await logger.LogError(ex, "Error Udate Job {Job} {Error}", job, ex.Message); + await logger.LogError(ex, "Error Updating Job {Job} {Error}", job, ex.Message); AddModuleMessage(Localizer["Error.Job.Update"], MessageType.Error); } } diff --git a/Oqtane.Server/Databases/MySQL/MySQLDatabase.cs b/Oqtane.Server/Databases/MySQL/MySQLDatabase.cs index 0272068b..66d8e4cb 100644 --- a/Oqtane.Server/Databases/MySQL/MySQLDatabase.cs +++ b/Oqtane.Server/Databases/MySQL/MySQLDatabase.cs @@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations.Operations; using Microsoft.EntityFrameworkCore.Migrations.Operations.Builders; using MySql.Data.MySqlClient; +using MySql.EntityFrameworkCore.Metadata; using Oqtane.Databases; namespace Oqtane.Database.MySQL @@ -25,7 +26,7 @@ namespace Oqtane.Database.MySQL public override OperationBuilder AddAutoIncrementColumn(ColumnsBuilder table, string name) { - return table.Column(name: name, nullable: false).Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + return table.Column(name: name, nullable: false).Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn); } public override string ConcatenateSql(params string[] values) @@ -96,7 +97,7 @@ namespace Oqtane.Database.MySQL public override DbContextOptionsBuilder UseDatabase(DbContextOptionsBuilder optionsBuilder, string connectionString) { - return optionsBuilder.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)); + return optionsBuilder.UseMySQL(connectionString); } private void PrepareCommand(MySqlConnection conn, MySqlCommand cmd, string query) diff --git a/Oqtane.Server/Infrastructure/UpgradeManager.cs b/Oqtane.Server/Infrastructure/UpgradeManager.cs index d57e2eb7..64e02f03 100644 --- a/Oqtane.Server/Infrastructure/UpgradeManager.cs +++ b/Oqtane.Server/Infrastructure/UpgradeManager.cs @@ -78,9 +78,6 @@ namespace Oqtane.Infrastructure case "5.2.1": Upgrade_5_2_1(tenant, scope); break; - case "6.1.0": - Upgrade_6_1_0(tenant, scope); - break; case "6.1.1": Upgrade_6_1_1(tenant, scope); break; @@ -93,6 +90,9 @@ namespace Oqtane.Infrastructure case "6.2.1": Upgrade_6_2_1(tenant, scope); break; + case "10.0.4": + Upgrade_10_0_4(tenant, scope); + break; } } } @@ -447,16 +447,6 @@ namespace Oqtane.Infrastructure AddPagesToSites(scope, tenant, pageTemplates); } - private void Upgrade_6_1_0(Tenant tenant, IServiceScope scope) - { - // remove MySql.EntityFrameworkCore package (replaced by Pomelo.EntityFrameworkCore.MySql) - string[] assemblies = { - "MySql.EntityFrameworkCore.dll" - }; - - RemoveAssemblies(tenant, assemblies, "6.1.0"); - } - private void Upgrade_6_1_1(Tenant tenant, IServiceScope scope) { var localizer = scope.ServiceProvider.GetRequiredService>(); @@ -602,6 +592,16 @@ namespace Oqtane.Infrastructure RemoveFiles(tenant, files, "6.2.1"); } + private void Upgrade_10_0_4(Tenant tenant, IServiceScope scope) + { + // remove Pomelo.EntityFrameworkCore.MySql package (replaced by MySql.EntityFrameworkCore) + string[] assemblies = { + "Pomelo.EntityFrameworkCore.MySql.dll" + }; + + RemoveAssemblies(tenant, assemblies, "10.0.4"); + } + private void AddPagesToSites(IServiceScope scope, Tenant tenant, List pageTemplates) { var tenants = scope.ServiceProvider.GetRequiredService(); diff --git a/Oqtane.Server/Oqtane.Server.csproj b/Oqtane.Server/Oqtane.Server.csproj index 1f282058..80b7316b 100644 --- a/Oqtane.Server/Oqtane.Server.csproj +++ b/Oqtane.Server/Oqtane.Server.csproj @@ -40,7 +40,7 @@ - + diff --git a/Oqtane.Server/Repository/Context/TenantDBContext.cs b/Oqtane.Server/Repository/Context/TenantDBContext.cs index e8b1bb3d..47932d7d 100644 --- a/Oqtane.Server/Repository/Context/TenantDBContext.cs +++ b/Oqtane.Server/Repository/Context/TenantDBContext.cs @@ -43,14 +43,6 @@ namespace Oqtane.Repository { optionsBuilder.ReplaceService(); - // specify the SchemaVersion for .NET Identity as it is not being persisted when using AddIdentityCore() - var services = new ServiceCollection(); - services.AddIdentityCore(options => - { - options.Stores.SchemaVersion = IdentitySchemaVersions.Version3; - }); - optionsBuilder.UseApplicationServiceProvider(services.BuildServiceProvider()); - if (string.IsNullOrEmpty(_connectionString)) { Tenant tenant = _tenantManager.GetTenant(); @@ -75,6 +67,22 @@ namespace Oqtane.Repository ActiveDatabase = Activator.CreateInstance(type) as IDatabase; } + // specify the SchemaVersion for .NET Identity as it is not being persisted when using AddIdentityCore() + var services = new ServiceCollection(); + services.AddIdentityCore(options => + { + if (!string.IsNullOrEmpty(_databaseType) && _databaseType.ToLower().Contains("mysql")) + { + // MySQL does not support some of the newer features of .NET Identity (ie. Passkeys) + options.Stores.SchemaVersion = IdentitySchemaVersions.Version2; + } + else + { + options.Stores.SchemaVersion = IdentitySchemaVersions.Version3; + } + }); + optionsBuilder.UseApplicationServiceProvider(services.BuildServiceProvider()); + if (!string.IsNullOrEmpty(_connectionString) && ActiveDatabase != null) { optionsBuilder.UseOqtaneDatabase(ActiveDatabase, _connectionString);