public async Task ApplySchemaAsync(int version, bool applyFullSchemaSnapshot, CancellationToken cancellationToken) { _logger.LogInformation("Applying schema {version}", version); if (!applyFullSchemaSnapshot) { await InsertSchemaVersionAsync(version, cancellationToken); } await _schemaManagerDataStore.ExecuteScriptAsync(_scriptProvider.GetMigrationScript(version, applyFullSchemaSnapshot), cancellationToken); await CompleteSchemaVersionAsync(version, cancellationToken); _logger.LogInformation("Completed applying schema {version}", version); }
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); } }