public MigrationManager(IDatabaseConnectionService databaseConnectionService, IMigrationScriptConverter migrationScriptConverter, string initMigrationScriptFullPath, MigrationStrategy migrationStrategy) { this._databaseConnectionService = databaseConnectionService; this._migrationScriptConverter = migrationScriptConverter; this._initMigrationScriptFullPath = initMigrationScriptFullPath; this._migrationStrategy = migrationStrategy; }
private static void Init(string[] args) { string baseDirectory = AppDomain.CurrentDomain.BaseDirectory; string initMigrationScriptPath = string.Format("{0}{1}", baseDirectory, "V0.0.0_InitMigrationTable.sql"); _artifactContentFolder = string.Format("{0}{1}", baseDirectory, "artifact"); Console.WriteLine("========== Row Settings =========="); Console.WriteLine(args == null ? string.Empty : string.Join(" - ", args)); Console.WriteLine("========================================"); _settings = new Settings(args); if (_settings == null) { throw new ArgumentException("Args empty or not valid"); } Console.WriteLine("========== Settings =========="); Console.WriteLine(JsonSerializer.Serialize(_settings, new JsonSerializerOptions() { WriteIndented = true, IgnoreNullValues = true })); Console.WriteLine("========================================"); WaitForKey(_settings.DebugMode); ExtractArtifactTo(_settings.ArtifactPath, _artifactContentFolder); _migrationScriptsFolder = GetScriptMigrationFolderPath(_artifactContentFolder, _settings.MigrationScriptsFolderName); _databaseConnection = new DatabaseConnectionService(_settings.ConnectionString, DatabaseType.SqlServer2012, SqlClientFactory.Instance); _migrationScriptConverter = new MigrationScriptConverter(); _migrationManager = new MigrationManager(_databaseConnection, _migrationScriptConverter, initMigrationScriptPath, _settings.MigrationStrategy); }