public async Task EnsureBaseSchemaExistsAsync(CancellationToken cancellationToken) { IBaseScriptProvider baseScriptProvider = new BaseScriptProvider(); await InitializeAsync(cancellationToken); if (!await _schemaManagerDataStore.BaseSchemaExistsAsync(cancellationToken)) { var script = baseScriptProvider.GetScript(); _logger.LogInformation(Resources.BaseSchemaExecuting); await _schemaManagerDataStore.ExecuteScriptAsync(script, cancellationToken); _logger.LogInformation(Resources.BaseSchemaSuccess); } else { _logger.LogWarning(Resources.BaseSchemaAlreadyExists); } }
public static async Task EnsureBaseSchemaExistsAsync(string connectionString, CancellationToken cancellationToken) { IBaseScriptProvider baseScriptProvider = new BaseScriptProvider(); await InitializeAsync(connectionString, cancellationToken); if (!await SchemaDataStore.BaseSchemaExistsAsync(connectionString, cancellationToken)) { var script = baseScriptProvider.GetScript(); Console.WriteLine(Resources.BaseSchemaExecuting); await SchemaDataStore.ExecuteScript(connectionString, script, cancellationToken); Console.WriteLine(Resources.BaseSchemaSuccess); } else { Console.WriteLine(Resources.BaseSchemaAlreadyExists); } }