From b5a9c32c3eab483159daa1cf204b358799f71025 Mon Sep 17 00:00:00 2001 From: sbwalker Date: Thu, 14 Aug 2025 15:19:52 -0400 Subject: [PATCH] migrate database providers to core framework --- .../Oqtane.Database.MySQL.csproj | 52 ------------------ .../Oqtane.Database.PostgreSQL.csproj | 53 ------------------- .../Oqtane.Database.SqlServer.csproj | 51 ------------------ .../Oqtane.Database.Sqlite.csproj | 51 ------------------ .../Controllers/DatabaseController.cs | 6 +-- .../Databases/MySQL}/MySQLDatabase.cs | 0 .../Databases/PostgreSQL/HistoryRepository.cs | 4 +- .../PostgreSQL}/PostgreSQLDatabase.cs | 2 +- .../Databases/SqlServer/HistoryRepository.cs | 4 +- .../Databases/SqlServer}/SqlServerDatabase.cs | 2 +- .../Databases/Sqlite/HistoryRepository.cs | 4 +- .../Databases/Sqlite}/SqliteDatabase.cs | 4 +- .../Infrastructure/DatabaseManager.cs | 40 +++++++------- .../Infrastructure/UpgradeManager.cs | 21 ++++++++ .../Master/06010501_UpdateTenantDBType.cs | 33 ++++++++++++ Oqtane.Server/Oqtane.Server.csproj | 39 ++++++++++---- Oqtane.Server/Startup.cs | 2 +- Oqtane.Shared/Models/Database.cs | 2 +- Oqtane.Shared/Shared/Constants.cs | 2 +- Oqtane.sln | 24 --------- 20 files changed, 120 insertions(+), 276 deletions(-) delete mode 100644 Oqtane.Database.MySQL/Oqtane.Database.MySQL.csproj delete mode 100644 Oqtane.Database.PostgreSQL/Oqtane.Database.PostgreSQL.csproj delete mode 100644 Oqtane.Database.SqlServer/Oqtane.Database.SqlServer.csproj delete mode 100644 Oqtane.Database.Sqlite/Oqtane.Database.Sqlite.csproj rename {Oqtane.Database.MySQL => Oqtane.Server/Databases/MySQL}/MySQLDatabase.cs (100%) rename Oqtane.Database.PostgreSQL/OqtaneHistoryRepository.cs => Oqtane.Server/Databases/PostgreSQL/HistoryRepository.cs (90%) rename {Oqtane.Database.PostgreSQL => Oqtane.Server/Databases/PostgreSQL}/PostgreSQLDatabase.cs (98%) rename Oqtane.Database.SqlServer/OqtaneHistoryRepository.cs => Oqtane.Server/Databases/SqlServer/HistoryRepository.cs (90%) rename {Oqtane.Database.SqlServer => Oqtane.Server/Databases/SqlServer}/SqlServerDatabase.cs (98%) rename Oqtane.Database.Sqlite/OqtaneHistoryRepository.cs => Oqtane.Server/Databases/Sqlite/HistoryRepository.cs (90%) rename {Oqtane.Database.Sqlite => Oqtane.Server/Databases/Sqlite}/SqliteDatabase.cs (96%) create mode 100644 Oqtane.Server/Migrations/Master/06010501_UpdateTenantDBType.cs diff --git a/Oqtane.Database.MySQL/Oqtane.Database.MySQL.csproj b/Oqtane.Database.MySQL/Oqtane.Database.MySQL.csproj deleted file mode 100644 index e2b748fe..00000000 --- a/Oqtane.Database.MySQL/Oqtane.Database.MySQL.csproj +++ /dev/null @@ -1,52 +0,0 @@ - - - - net9.0 - 6.1.5 - Oqtane - Shaun Walker - .NET Foundation - Modular Application Framework for Blazor and MAUI - .NET Foundation - https://www.oqtane.org - https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE - https://github.com/oqtane/oqtane.framework/releases/tag/v6.1.5 - https://github.com/oqtane/oqtane.framework - Git - true - - - - bin - - - - bin - - - - 1701;1702;EF1001;AD0001 - - - - 1701;1702;EF1001;AD0001 - - - - - - - - - - - - - - - - - - - - diff --git a/Oqtane.Database.PostgreSQL/Oqtane.Database.PostgreSQL.csproj b/Oqtane.Database.PostgreSQL/Oqtane.Database.PostgreSQL.csproj deleted file mode 100644 index 77747a21..00000000 --- a/Oqtane.Database.PostgreSQL/Oqtane.Database.PostgreSQL.csproj +++ /dev/null @@ -1,53 +0,0 @@ - - - - net9.0 - 6.1.5 - Oqtane - Shaun Walker - .NET Foundation - Modular Application Framework for Blazor and MAUI - .NET Foundation - https://www.oqtane.org - https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE - https://github.com/oqtane/oqtane.framework/releases/tag/v6.1.5 - https://github.com/oqtane/oqtane.framework - Git - true - - - - bin - - - - bin - - - - 1701;1702;EF1001;AD0001;NU1608 - - - - 1701;1702;EF1001;AD0001 - - - - - - - - - - - - - - - - - - - - - diff --git a/Oqtane.Database.SqlServer/Oqtane.Database.SqlServer.csproj b/Oqtane.Database.SqlServer/Oqtane.Database.SqlServer.csproj deleted file mode 100644 index 1ea0a521..00000000 --- a/Oqtane.Database.SqlServer/Oqtane.Database.SqlServer.csproj +++ /dev/null @@ -1,51 +0,0 @@ - - - - net9.0 - 6.1.5 - Oqtane - Shaun Walker - .NET Foundation - Modular Application Framework for Blazor and MAUI - .NET Foundation - https://www.oqtane.org - https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE - https://github.com/oqtane/oqtane.framework/releases/tag/v6.1.5 - https://github.com/oqtane/oqtane.framework - Git - true - - - - bin - - - - bin - - - - 1701;1702;EF1001;AD0001 - - - - 1701;1702;EF1001;AD0001 - - - - - - - - - - - - - - - - - - - diff --git a/Oqtane.Database.Sqlite/Oqtane.Database.Sqlite.csproj b/Oqtane.Database.Sqlite/Oqtane.Database.Sqlite.csproj deleted file mode 100644 index b9c593cc..00000000 --- a/Oqtane.Database.Sqlite/Oqtane.Database.Sqlite.csproj +++ /dev/null @@ -1,51 +0,0 @@ - - - - net9.0 - 6.1.5 - Oqtane - Shaun Walker - .NET Foundation - Modular Application Framework for Blazor and MAUI - .NET Foundation - https://www.oqtane.org - https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE - https://github.com/oqtane/oqtane.framework/releases/tag/v6.1.5 - https://github.com/oqtane/oqtane.framework - Git - true - - - - bin - - - - bin - - - - 1701;1702;EF1001;AD0001 - - - - 1701;1702;EF1001;AD0001 - - - - - - - - - - - - - - - - - - - diff --git a/Oqtane.Server/Controllers/DatabaseController.cs b/Oqtane.Server/Controllers/DatabaseController.cs index 95f34824..8a56f8e5 100644 --- a/Oqtane.Server/Controllers/DatabaseController.cs +++ b/Oqtane.Server/Controllers/DatabaseController.cs @@ -10,10 +10,10 @@ namespace Oqtane.Controllers [Route(ControllerRoutes.ApiRoute)] public class DatabaseController : Controller { - private IOptions> _databaseOptions; + private IOptions> _databaseOptions; private IConfigManager _config; - public DatabaseController(IOptions> databaseOptions, IConfigManager config) + public DatabaseController(IOptions> databaseOptions, IConfigManager config) { _databaseOptions = databaseOptions; _config = config; @@ -21,7 +21,7 @@ namespace Oqtane.Controllers // GET: api/ [HttpGet] - public IEnumerable Get() + public IEnumerable Get() { var databases = _databaseOptions.Value; var master = _config.GetSetting(SettingKeys.DatabaseSection, SettingKeys.DatabaseTypeKey, ""); diff --git a/Oqtane.Database.MySQL/MySQLDatabase.cs b/Oqtane.Server/Databases/MySQL/MySQLDatabase.cs similarity index 100% rename from Oqtane.Database.MySQL/MySQLDatabase.cs rename to Oqtane.Server/Databases/MySQL/MySQLDatabase.cs diff --git a/Oqtane.Database.PostgreSQL/OqtaneHistoryRepository.cs b/Oqtane.Server/Databases/PostgreSQL/HistoryRepository.cs similarity index 90% rename from Oqtane.Database.PostgreSQL/OqtaneHistoryRepository.cs rename to Oqtane.Server/Databases/PostgreSQL/HistoryRepository.cs index cbc96246..9e233a09 100644 --- a/Oqtane.Database.PostgreSQL/OqtaneHistoryRepository.cs +++ b/Oqtane.Server/Databases/PostgreSQL/HistoryRepository.cs @@ -9,13 +9,13 @@ using Oqtane.Models; namespace Oqtane.Database.PostgreSQL { - public class OqtaneHistoryRepository : NpgsqlHistoryRepository + public class HistoryRepository : NpgsqlHistoryRepository { private string _appliedDateColumnName = "applied_date"; private string _appliedVersionColumnName = "applied_version"; private MigrationHistoryTable _migrationHistoryTable; - public OqtaneHistoryRepository(HistoryRepositoryDependencies dependencies) : base(dependencies) + public HistoryRepository(HistoryRepositoryDependencies dependencies) : base(dependencies) { _migrationHistoryTable = new MigrationHistoryTable { diff --git a/Oqtane.Database.PostgreSQL/PostgreSQLDatabase.cs b/Oqtane.Server/Databases/PostgreSQL/PostgreSQLDatabase.cs similarity index 98% rename from Oqtane.Database.PostgreSQL/PostgreSQLDatabase.cs rename to Oqtane.Server/Databases/PostgreSQL/PostgreSQLDatabase.cs index c41ecb3a..c22908b2 100644 --- a/Oqtane.Database.PostgreSQL/PostgreSQLDatabase.cs +++ b/Oqtane.Server/Databases/PostgreSQL/PostgreSQLDatabase.cs @@ -147,7 +147,7 @@ namespace Oqtane.Database.PostgreSQL { return optionsBuilder.UseNpgsql(connectionString) .UseSnakeCaseNamingConvention() - .ReplaceService(); + .ReplaceService(); } private void PrepareCommand(NpgsqlConnection conn, NpgsqlCommand cmd, string query) diff --git a/Oqtane.Database.SqlServer/OqtaneHistoryRepository.cs b/Oqtane.Server/Databases/SqlServer/HistoryRepository.cs similarity index 90% rename from Oqtane.Database.SqlServer/OqtaneHistoryRepository.cs rename to Oqtane.Server/Databases/SqlServer/HistoryRepository.cs index d3adacdf..23e1df39 100644 --- a/Oqtane.Database.SqlServer/OqtaneHistoryRepository.cs +++ b/Oqtane.Server/Databases/SqlServer/HistoryRepository.cs @@ -9,13 +9,13 @@ using Oqtane.Models; namespace Oqtane.Database.SqlServer { - public class OqtaneHistoryRepository : SqlServerHistoryRepository + public class HistoryRepository : SqlServerHistoryRepository { private string _appliedDateColumnName = "AppliedDate"; private string _appliedVersionColumnName = "AppliedVersion"; private MigrationHistoryTable _migrationHistoryTable; - public OqtaneHistoryRepository(HistoryRepositoryDependencies dependencies) : base(dependencies) + public HistoryRepository(HistoryRepositoryDependencies dependencies) : base(dependencies) { _migrationHistoryTable = new MigrationHistoryTable { diff --git a/Oqtane.Database.SqlServer/SqlServerDatabase.cs b/Oqtane.Server/Databases/SqlServer/SqlServerDatabase.cs similarity index 98% rename from Oqtane.Database.SqlServer/SqlServerDatabase.cs rename to Oqtane.Server/Databases/SqlServer/SqlServerDatabase.cs index 9c8f5fa5..eb28a935 100644 --- a/Oqtane.Database.SqlServer/SqlServerDatabase.cs +++ b/Oqtane.Server/Databases/SqlServer/SqlServerDatabase.cs @@ -98,7 +98,7 @@ namespace Oqtane.Database.SqlServer public override DbContextOptionsBuilder UseDatabase(DbContextOptionsBuilder optionsBuilder, string connectionString) { return optionsBuilder.UseSqlServer(connectionString) - .ReplaceService(); + .ReplaceService(); } private string FormatConnectionString(string connectionString) diff --git a/Oqtane.Database.Sqlite/OqtaneHistoryRepository.cs b/Oqtane.Server/Databases/Sqlite/HistoryRepository.cs similarity index 90% rename from Oqtane.Database.Sqlite/OqtaneHistoryRepository.cs rename to Oqtane.Server/Databases/Sqlite/HistoryRepository.cs index e1961358..22e5bb8f 100644 --- a/Oqtane.Database.Sqlite/OqtaneHistoryRepository.cs +++ b/Oqtane.Server/Databases/Sqlite/HistoryRepository.cs @@ -9,13 +9,13 @@ using Oqtane.Models; namespace Oqtane.Database.Sqlite { - public class OqtaneHistoryRepository : SqliteHistoryRepository + public class HistoryRepository : SqliteHistoryRepository { private string _appliedDateColumnName = "AppliedDate"; private string _appliedVersionColumnName = "AppliedVersion"; private MigrationHistoryTable _migrationHistoryTable; - public OqtaneHistoryRepository(HistoryRepositoryDependencies dependencies) : base(dependencies) + public HistoryRepository(HistoryRepositoryDependencies dependencies) : base(dependencies) { _migrationHistoryTable = new MigrationHistoryTable { diff --git a/Oqtane.Database.Sqlite/SqliteDatabase.cs b/Oqtane.Server/Databases/Sqlite/SqliteDatabase.cs similarity index 96% rename from Oqtane.Database.Sqlite/SqliteDatabase.cs rename to Oqtane.Server/Databases/Sqlite/SqliteDatabase.cs index 151e79d6..e8cd6fd3 100644 --- a/Oqtane.Database.Sqlite/SqliteDatabase.cs +++ b/Oqtane.Server/Databases/Sqlite/SqliteDatabase.cs @@ -11,7 +11,7 @@ namespace Oqtane.Database.Sqlite { public class SqliteDatabase : DatabaseBase { - private static string _friendlyName => "Sqlite"; + private static string _friendlyName => "SQLite"; private static string _name => "Sqlite"; @@ -106,7 +106,7 @@ namespace Oqtane.Database.Sqlite public override DbContextOptionsBuilder UseDatabase(DbContextOptionsBuilder optionsBuilder, string connectionString) { return optionsBuilder.UseSqlite(connectionString) - .ReplaceService(); + .ReplaceService(); } private void PrepareCommand(SqliteConnection conn, SqliteCommand cmd, string query) diff --git a/Oqtane.Server/Infrastructure/DatabaseManager.cs b/Oqtane.Server/Infrastructure/DatabaseManager.cs index 99f456f7..af54c35f 100644 --- a/Oqtane.Server/Infrastructure/DatabaseManager.cs +++ b/Oqtane.Server/Infrastructure/DatabaseManager.cs @@ -663,7 +663,7 @@ namespace Oqtane.Infrastructure var connectionString = NormalizeConnectionString(_config.GetConnectionString(SettingKeys.ConnectionStringKey)); var databaseType = _config.GetSection(SettingKeys.DatabaseSection)[SettingKeys.DatabaseTypeKey]; - Oqtane.Databases.Interfaces.IDatabase database = null; + Databases.Interfaces.IDatabase database = null; if (!string.IsNullOrEmpty(databaseType)) { var type = Type.GetType(databaseType); @@ -744,32 +744,34 @@ namespace Oqtane.Infrastructure private void ValidateConfiguration() { - if (_configManager.GetSetting(SettingKeys.DatabaseSection, SettingKeys.DatabaseTypeKey, "") == "") + var defaultDatabaseType = _configManager.GetSetting(SettingKeys.DatabaseSection, SettingKeys.DatabaseTypeKey, ""); + if (defaultDatabaseType == "" || defaultDatabaseType.Contains(", Oqtane.Database.")) { - _configManager.AddOrUpdateSetting($"{SettingKeys.DatabaseSection}:{SettingKeys.DatabaseTypeKey}", Constants.DefaultDBType, true); + // DefaultDBType migrated to Oqtane.Server in 6.1.5 + defaultDatabaseType = defaultDatabaseType.Substring(0, defaultDatabaseType.IndexOf(", ")) + ", Oqtane.Server"; + _configManager.AddOrUpdateSetting($"{SettingKeys.DatabaseSection}:{SettingKeys.DatabaseTypeKey}", defaultDatabaseType, true); } + var updateAvailableDatabases = false; if (!_configManager.GetSection(SettingKeys.AvailableDatabasesSection).Exists()) { - string databases = "["; - databases += "{ \"Name\": \"LocalDB\", \"ControlType\": \"Oqtane.Installer.Controls.LocalDBConfig, Oqtane.Client\", \"DBTYpe\": \"Oqtane.Database.SqlServer.SqlServerDatabase, Oqtane.Database.SqlServer\" },"; - databases += "{ \"Name\": \"SQL Server\", \"ControlType\": \"Oqtane.Installer.Controls.SqlServerConfig, Oqtane.Client\", \"DBTYpe\": \"Oqtane.Database.SqlServer.SqlServerDatabase, Oqtane.Database.SqlServer\" },"; - databases += "{ \"Name\": \"SQLite\", \"ControlType\": \"Oqtane.Installer.Controls.SqliteConfig, Oqtane.Client\", \"DBTYpe\": \"Oqtane.Database.Sqlite.SqliteDatabase, Oqtane.Database.Sqlite\" },"; - databases += "{ \"Name\": \"MySQL\", \"ControlType\": \"Oqtane.Installer.Controls.MySQLConfig, Oqtane.Client\", \"DBTYpe\": \"Oqtane.Database.MySQL.MySQLDatabase, Oqtane.Database.MySQL\" },"; - databases += "{ \"Name\": \"PostgreSQL\", \"ControlType\": \"Oqtane.Installer.Controls.PostgreSQLConfig, Oqtane.Client\", \"DBTYpe\": \"Oqtane.Database.PostgreSQL.PostgreSQLDatabase, Oqtane.Database.PostgreSQL\" }"; - databases += "]"; - _configManager.AddOrUpdateSetting(SettingKeys.AvailableDatabasesSection, databases, true); + updateAvailableDatabases = true; } - var availabledatabases = _configManager.GetSection(SettingKeys.AvailableDatabasesSection).GetChildren(); - if (!availabledatabases.Any(item => item.GetSection("Name").Value == "Azure SQL")) + else + { + // available databases migrated to Oqtane.Server in 6.1.5 + updateAvailableDatabases = !_configManager.GetSection(SettingKeys.AvailableDatabasesSection).GetChildren() + .Any(item => item.GetSection("DBType").Value == "Oqtane.Database.SqlServer.SqlServerDatabase, Oqtane.Server"); + } + if (updateAvailableDatabases) { - // Azure SQL added in 6.1.2 string databases = "["; - foreach (var database in availabledatabases) - { - databases += "{ " + $"\"Name\": \"{database["Name"]}\", \"ControlType\": \"{database["ControlType"]}\", \"DBTYpe\": \"{database["DBType"]}\"" + " },"; - } - databases += "{ \"Name\": \"Azure SQL\", \"ControlType\": \"Oqtane.Installer.Controls.AzureSqlConfig, Oqtane.Client\", \"DBTYpe\": \"Oqtane.Database.SqlServer.SqlServerDatabase, Oqtane.Database.SqlServer\" }"; + databases += "{ \"Name\": \"LocalDB\", \"ControlType\": \"Oqtane.Installer.Controls.LocalDBConfig, Oqtane.Client\", \"DBType\": \"Oqtane.Database.SqlServer.SqlServerDatabase, Oqtane.Server\" },"; + databases += "{ \"Name\": \"SQL Server\", \"ControlType\": \"Oqtane.Installer.Controls.SqlServerConfig, Oqtane.Client\", \"DBType\": \"Oqtane.Database.SqlServer.SqlServerDatabase, Oqtane.Server\" },"; + databases += "{ \"Name\": \"SQLite\", \"ControlType\": \"Oqtane.Installer.Controls.SqliteConfig, Oqtane.Client\", \"DBType\": \"Oqtane.Database.Sqlite.SqliteDatabase, Oqtane.Server\" },"; + databases += "{ \"Name\": \"MySQL\", \"ControlType\": \"Oqtane.Installer.Controls.MySQLConfig, Oqtane.Client\", \"DBType\": \"Oqtane.Database.MySQL.MySQLDatabase, Oqtane.Server\" },"; + databases += "{ \"Name\": \"PostgreSQL\", \"ControlType\": \"Oqtane.Installer.Controls.PostgreSQLConfig, Oqtane.Client\", \"DBType\": \"Oqtane.Database.PostgreSQL.PostgreSQLDatabase, Oqtane.Server\" },"; + databases += "{ \"Name\": \"Azure SQL\", \"ControlType\": \"Oqtane.Installer.Controls.AzureSqlConfig, Oqtane.Client\", \"DBType\": \"Oqtane.Database.SqlServer.SqlServerDatabase, Oqtane.Server\" }"; databases += "]"; _configManager.AddOrUpdateSetting(SettingKeys.AvailableDatabasesSection, databases, true); } diff --git a/Oqtane.Server/Infrastructure/UpgradeManager.cs b/Oqtane.Server/Infrastructure/UpgradeManager.cs index 4b40f3ae..1169867d 100644 --- a/Oqtane.Server/Infrastructure/UpgradeManager.cs +++ b/Oqtane.Server/Infrastructure/UpgradeManager.cs @@ -84,6 +84,9 @@ namespace Oqtane.Infrastructure case "6.1.1": Upgrade_6_1_1(tenant, scope); break; + case "6.1.5": + Upgrade_6_1_5(tenant, scope); + break; } } } @@ -537,6 +540,24 @@ namespace Oqtane.Infrastructure AddPagesToSites(scope, tenant, pageTemplates); } + private void Upgrade_6_1_5(Tenant tenant, IServiceScope scope) + { + // remove Database Providers which were moved to Oqtane.Server + string[] assemblies = { + "Oqtane.Database.MySQL.dll", + "Oqtane.Database.MySQL.pdb", + "Oqtane.Database.PostgreSQL.dll", + "Oqtane.Database.PostgreSQL.pdb", + "Oqtane.Database.Sqlite.dll", + "Oqtane.Database.Sqlite.pdb", + "Oqtane.Database.SqlServer.dll", + "Oqtane.Database.SqlServer.pdb" + }; + + RemoveAssemblies(tenant, assemblies, "6.1.5"); + } + + private void AddPagesToSites(IServiceScope scope, Tenant tenant, List pageTemplates) { var tenants = scope.ServiceProvider.GetRequiredService(); diff --git a/Oqtane.Server/Migrations/Master/06010501_UpdateTenantDBType.cs b/Oqtane.Server/Migrations/Master/06010501_UpdateTenantDBType.cs new file mode 100644 index 00000000..09d9a501 --- /dev/null +++ b/Oqtane.Server/Migrations/Master/06010501_UpdateTenantDBType.cs @@ -0,0 +1,33 @@ +using System.Data; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Oqtane.Databases.Interfaces; +using Oqtane.Migrations.EntityBuilders; +using Oqtane.Repository; + +namespace Oqtane.Migrations.Master +{ + [DbContext(typeof(MasterDBContext))] + [Migration("Master.06.01.05.01")] + public class UpdateTenantDBType : MultiDatabaseMigration + { + public UpdateTenantDBType(IDatabase database) : base(database) + { + } + + protected override void Up(MigrationBuilder migrationBuilder) + { + // database providers moved to oqtane.server + var tenantEntityBuilder = new TenantEntityBuilder(migrationBuilder, ActiveDatabase); + tenantEntityBuilder.UpdateData("DBType", "'Oqtane.Database.SqlServer.SqlServerDatabase, Oqtane.Server'", $"{DelimitName(RewriteName("DBType"))} = 'Oqtane.Database.SqlServer.SqlServerDatabase, Oqtane.Database.SqlServer'"); + tenantEntityBuilder.UpdateData("DBType", "'Oqtane.Database.Sqlite.SqliteDatabase, Oqtane.Server'", $"{DelimitName(RewriteName("DBType"))} = 'Oqtane.Database.Sqlite.SqliteDatabase, Oqtane.Database.Sqlite'"); + tenantEntityBuilder.UpdateData("DBType", "'Oqtane.Database.MySQL.MySQLDatabase, Oqtane.Server'", $"{DelimitName(RewriteName("DBType"))} = 'Oqtane.Database.MySQL.MySQLDatabase, Oqtane.Database.MySQL'"); + tenantEntityBuilder.UpdateData("DBType", "'Oqtane.Database.PostgreSQL.PostgreSQLDatabase, Oqtane.Server'", $"{DelimitName(RewriteName("DBType"))} = 'Oqtane.Database.PostgreSQL.PostgreSQLDatabase, Oqtane.Database.PostgreSQL'"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + // not implemented + } + } +} diff --git a/Oqtane.Server/Oqtane.Server.csproj b/Oqtane.Server/Oqtane.Server.csproj index f05db85a..fc21ef6a 100644 --- a/Oqtane.Server/Oqtane.Server.csproj +++ b/Oqtane.Server/Oqtane.Server.csproj @@ -33,6 +33,7 @@ + @@ -44,33 +45,51 @@ - - + + + + + + + + + + + + + + + + + + + + 1701;1702;EF1001;AD0001;NU1608 + + + 1701;1702;EF1001;AD0001 + + + - - - - + - - - - + diff --git a/Oqtane.Server/Startup.cs b/Oqtane.Server/Startup.cs index 2101a861..b1138db7 100644 --- a/Oqtane.Server/Startup.cs +++ b/Oqtane.Server/Startup.cs @@ -69,7 +69,7 @@ namespace Oqtane // register localization services services.AddLocalization(options => options.ResourcesPath = "Resources"); - services.AddOptions>().Bind(Configuration.GetSection(SettingKeys.AvailableDatabasesSection)); + services.AddOptions>().Bind(Configuration.GetSection(SettingKeys.AvailableDatabasesSection)); // register scoped core services services.AddScoped() diff --git a/Oqtane.Shared/Models/Database.cs b/Oqtane.Shared/Models/Database.cs index 8c7f40f8..b5684ba1 100644 --- a/Oqtane.Shared/Models/Database.cs +++ b/Oqtane.Shared/Models/Database.cs @@ -16,7 +16,7 @@ namespace Oqtane.Models public string ControlType { get; set; } /// - /// Type of DB using the full namespace, like `Oqtane.Database.SqlServer.SqlServerDatabase, Oqtane.Database.SqlServer` + /// Type of DB using the full namespace, like `Oqtane.Database.SqlServer.SqlServerDatabase, Oqtane.Server` /// public string DBType { get; set; } diff --git a/Oqtane.Shared/Shared/Constants.cs b/Oqtane.Shared/Shared/Constants.cs index b6c402f1..bf30580b 100644 --- a/Oqtane.Shared/Shared/Constants.cs +++ b/Oqtane.Shared/Shared/Constants.cs @@ -12,7 +12,7 @@ namespace Oqtane.Shared public const string PackageRegistryUrl = "https://www.oqtane.net"; public const string DataDirectory = "DataDirectory"; - public const string DefaultDBType = "Oqtane.Database.SqlServer.SqlServerDatabase, Oqtane.Database.SqlServer"; + public const string DefaultDBType = "Oqtane.Database.SqlServer.SqlServerDatabase, Oqtane.Server"; public const string DefaultTheme = "Oqtane.Themes.OqtaneTheme.Default, Oqtane.Client"; public const string DefaultContainer = "Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client"; diff --git a/Oqtane.sln b/Oqtane.sln index bae318dd..f6d07ccb 100644 --- a/Oqtane.sln +++ b/Oqtane.sln @@ -16,14 +16,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution README.md = README.md EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Oqtane.Database.MySQL", "Oqtane.Database.MySQL\Oqtane.Database.MySQL.csproj", "{17082878-FA9B-4F08-BC9A-467C23560AEB}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Oqtane.Database.PostgreSQL", "Oqtane.Database.PostgreSQL\Oqtane.Database.PostgreSQL.csproj", "{C54A9201-2EA6-499A-BEE8-9E7EE80B9FEE}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Oqtane.Database.Sqlite", "Oqtane.Database.Sqlite\Oqtane.Database.Sqlite.csproj", "{61754121-6D69-4B99-B28F-03C8854732DB}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Oqtane.Database.SqlServer", "Oqtane.Database.SqlServer\Oqtane.Database.SqlServer.csproj", "{C1BD386B-0832-41D2-8E37-410127318556}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -42,22 +34,6 @@ Global {19D67A9D-3F2E-41BD-80E6-0B50CA83C3AE}.Debug|Any CPU.Build.0 = Debug|Any CPU {19D67A9D-3F2E-41BD-80E6-0B50CA83C3AE}.Release|Any CPU.ActiveCfg = Release|Any CPU {19D67A9D-3F2E-41BD-80E6-0B50CA83C3AE}.Release|Any CPU.Build.0 = Release|Any CPU - {17082878-FA9B-4F08-BC9A-467C23560AEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {17082878-FA9B-4F08-BC9A-467C23560AEB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {17082878-FA9B-4F08-BC9A-467C23560AEB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {17082878-FA9B-4F08-BC9A-467C23560AEB}.Release|Any CPU.Build.0 = Release|Any CPU - {C54A9201-2EA6-499A-BEE8-9E7EE80B9FEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C54A9201-2EA6-499A-BEE8-9E7EE80B9FEE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C54A9201-2EA6-499A-BEE8-9E7EE80B9FEE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C54A9201-2EA6-499A-BEE8-9E7EE80B9FEE}.Release|Any CPU.Build.0 = Release|Any CPU - {61754121-6D69-4B99-B28F-03C8854732DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {61754121-6D69-4B99-B28F-03C8854732DB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {61754121-6D69-4B99-B28F-03C8854732DB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {61754121-6D69-4B99-B28F-03C8854732DB}.Release|Any CPU.Build.0 = Release|Any CPU - {C1BD386B-0832-41D2-8E37-410127318556}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C1BD386B-0832-41D2-8E37-410127318556}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C1BD386B-0832-41D2-8E37-410127318556}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C1BD386B-0832-41D2-8E37-410127318556}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE