Migration service - sqlite fix

messaging
Tudor Stanciu 2022-02-18 08:56:07 +02:00
parent fd92ceeb06
commit 92e7b3e2ca
2 changed files with 4 additions and 0 deletions

View File

@ -36,6 +36,7 @@ namespace NDB.Infrastructure.DatabaseMigration.Repositories
command.CommandText = query; command.CommandText = query;
await _dbContext.Database.OpenConnectionAsync(); await _dbContext.Database.OpenConnectionAsync();
var result = await command.ExecuteScalarAsync(); var result = await command.ExecuteScalarAsync();
await _dbContext.Database.CloseConnectionAsync();
return result != null && result != DBNull.Value && Convert.ToInt32(result) > 0; return result != null && result != DBNull.Value && Convert.ToInt32(result) > 0;
} }

View File

@ -51,6 +51,9 @@ namespace NDB.Infrastructure.DatabaseMigration.Services
private async Task CheckMigrationTables() private async Task CheckMigrationTables()
{ {
if (_configuration.DatabaseType == DatabaseType.SQLite)
CheckWorkspace();
using (var scope = _serviceProvider.CreateScope()) using (var scope = _serviceProvider.CreateScope())
{ {
var _repository = scope.ServiceProvider.GetRequiredService<IMigrationRepository>(); var _repository = scope.ServiceProvider.GetRequiredService<IMigrationRepository>();