public void UpgradeSchema(SchemaExtractionResult extractedSchema, StorageModel sourceModel, StorageModel targetModel, ActionSequence upgradeActions) { var enforceChangedColumns = context.Hints .OfType <ChangeFieldTypeHint>() .SelectMany(hint => hint.AffectedColumns) .ToList(); var skipConstraints = context.Stage == UpgradeStage.Upgrading; var translator = new SqlActionTranslator( session.Handlers, executor, context.Services.MappingResolver, upgradeActions, extractedSchema, sourceModel, targetModel, enforceChangedColumns, !skipConstraints); var result = translator.Translate(); if (SqlLog.IsLogged(LogLevel.Info)) { LogStatements(result); } foreach (var handler in context.OrderedUpgradeHandlers) { handler.OnBeforeExecuteActions(result); } result.ProcessWith(statementProcessor, ExecuteNonTransactionally); }
private StorageDriver( SqlDriver driver, ProviderInfo providerInfo, DomainConfiguration configuration, Func <DomainModel> modelProvider) { underlyingDriver = driver; ProviderInfo = providerInfo; this.configuration = configuration; ExceptionBuilder = new StorageExceptionBuilder(driver, configuration, modelProvider); allMappings = underlyingDriver.TypeMappings; translator = underlyingDriver.Translator; hasSavepoints = underlyingDriver.ServerInfo.ServerFeatures.Supports(ServerFeatures.Savepoints); isLoggingEnabled = SqlLog.IsLogged(LogLevel.Info); // Just to cache this value ServerInfo = underlyingDriver.ServerInfo; }
private UpgradeActionSequence TranslateActions(SchemaExtractionResult extractedSchema, StorageModel sourceModel, StorageModel targetModel, ActionSequence upgradeActions) { var enforceChangedColumns = context.Hints .OfType <ChangeFieldTypeHint>() .SelectMany(hint => hint.AffectedColumns) .ToList(); var skipConstraints = context.Stage == UpgradeStage.Upgrading; var translator = new SqlActionTranslator( session.Handlers, executor, context.Services.MappingResolver, upgradeActions, extractedSchema, sourceModel, targetModel, enforceChangedColumns, !skipConstraints); var result = translator.Translate(); if (SqlLog.IsLogged(LogLevel.Info)) { LogStatements(result); } return(result); }