allow modules to be able to specify the databases they support

This commit is contained in:
sbwalker
2025-09-02 08:32:46 -04:00
parent 6daf675e52
commit b5fdf42c37
3 changed files with 39 additions and 2 deletions

View File

@ -476,7 +476,7 @@ namespace Oqtane.Infrastructure
{
index = -1;
}
if (index != (versions.Length - 1))
if (index != (versions.Length - 1) && ModuleSupportsDatabase(moduleDefinition.Databases, tenant.DBType))
{
for (var i = (index + 1); i < versions.Length; i++)
{
@ -789,5 +789,21 @@ namespace Oqtane.Infrastructure
_configManager.AddOrUpdateSetting(SettingKeys.AvailableDatabasesSection, databases, true);
}
}
private bool ModuleSupportsDatabase(string databases, string dbtype)
{
// check if module supports tenant database
if (!string.IsNullOrEmpty(databases))
{
foreach (var database in databases.Split(',', StringSplitOptions.RemoveEmptyEntries))
{
if (dbtype.ToLower().Contains(database.ToLower()))
{
return true;
}
}
}
return string.IsNullOrEmpty(databases);
}
}
}