NDB.Infrastructure.DatabaseMigration fic

messaging
Tudor Stanciu 2022-01-22 00:48:17 +02:00
parent 234fb05896
commit 5bb9145443
3 changed files with 7 additions and 7 deletions

View File

@ -18,10 +18,10 @@ namespace NDB.Infrastructure.DatabaseMigration
public static void AddMigration(this IServiceCollection services, public static void AddMigration(this IServiceCollection services,
DatabaseType databaseType = DatabaseType.SQLite, DatabaseType databaseType = DatabaseType.SQLite,
string connectionName = "DatabaseConnection", string connectionName = "DatabaseConnection",
string workspacePath = "Workspace", string workspace = "Workspace",
string scriptsDirectoryPath = "Scripts") string scriptsDirectoryPath = "Scripts")
{ {
var serviceConfiguration = new ServiceConfiguration(databaseType, connectionName, workspacePath, scriptsDirectoryPath); var serviceConfiguration = new ServiceConfiguration(databaseType, connectionName, workspace, scriptsDirectoryPath);
services.AddSingleton(serviceConfiguration); services.AddSingleton(serviceConfiguration);
services.AddDataAccess(serviceConfiguration); services.AddDataAccess(serviceConfiguration);
services.AddSingleton<IMigrationService, MigrationService>(); services.AddSingleton<IMigrationService, MigrationService>();

View File

@ -2,12 +2,12 @@
namespace NDB.Infrastructure.DatabaseMigration.Models namespace NDB.Infrastructure.DatabaseMigration.Models
{ {
internal class MigrationThumbprint public class MigrationThumbprint
{ {
public MigrationSignature[] MigrationSignatures { get; set; } public MigrationSignature[] MigrationSignatures { get; set; }
} }
internal class MigrationSignature public class MigrationSignature
{ {
public DateTime MigrationDate { get; set; } public DateTime MigrationDate { get; set; }
public string MachineName { get; set; } public string MachineName { get; set; }
@ -15,13 +15,13 @@ namespace NDB.Infrastructure.DatabaseMigration.Models
public string LastVersion { get; set; } public string LastVersion { get; set; }
} }
internal class MigratedVersion public class MigratedVersion
{ {
public string Version { get; set; } public string Version { get; set; }
public string[] Scripts { get; set; } public string[] Scripts { get; set; }
} }
internal class ScriptPack public class ScriptPack
{ {
public string Path { get; set; } public string Path { get; set; }
public Version Version { get; set; } public Version Version { get; set; }

View File

@ -21,7 +21,7 @@ namespace NDB.Infrastructure.DatabaseMigration.Services
public MigrationService(ILogger<MigrationService> logger, IServiceProvider serviceProvider, ServiceConfiguration configuration) public MigrationService(ILogger<MigrationService> logger, IServiceProvider serviceProvider, ServiceConfiguration configuration)
{ {
_migrationSignaturesFilePath = Path.Combine(_configuration.Workspace, _migrationSignaturesFileName); _migrationSignaturesFilePath = Path.Combine(configuration.Workspace, _migrationSignaturesFileName);
_logger = logger; _logger = logger;
_serviceProvider = serviceProvider; _serviceProvider = serviceProvider;
_configuration = configuration; _configuration = configuration;