示例#1
0
        public override void Process(DeleteSchemaExpression expression)
        {
            this.ExecuteCodeBlockUntilNoExeception(() =>
            {
                if (!SchemaExists(expression.SchemaName))
                {
                    return;
                }

                var stopwatch = new StopWatch();
                Logger.LogHeader("Drop Oracle schema(user)");
                Logger.LogSay($"Dropping Oracle schema(user) '{expression.SchemaName}'...");
                stopwatch.Time(() => Process(ExtendedGenerator.Generate(expression)));
                Logger.LogSay($"Dropped Oracle schema(user) '{expression.SchemaName}'...");
                Logger.LogElapsedTime(stopwatch.ElapsedTime());

                RunCustomAction(() =>
                                CustomMigrationProcessor?.ProcessAfter(new DropSchemaWithPrefixExpression
                {
                    SchemaName           = expression.SchemaName,
                    SchemaPrefixId       = SchemaPrefix,
                    SchemaPrefixUniqueId = SchemaPrefixUniqueId
                }));
            },
                                                   ex => Logger.LogError(ex, $"Dropping Oracle schema(user) '{expression.SchemaName}' failed with exception :-("));
        }
        public override void Process(DeleteSchemaExpression expression)
        {
            this.ExecuteCodeBlockUntilNoExeception(() =>
            {
                if (!SchemaExists(expression.SchemaName))
                {
                    return;
                }

                var stopwatch = new StopWatch();
                Logger.LogSay($"Dropping Postgres schema '{expression.SchemaName}'...");
                stopwatch.Time(() => Process(ExtendedGeneratorField.Generate(expression)));
                Logger.LogSay($"Dropped Postgres schema '{expression.SchemaName}'...");
                Logger.LogElapsedTime(stopwatch.ElapsedTime());

                Process(new DeleteUserExpression(expression));
                PostgresDatabaseCreator.DropDatabase(
                    DbMigrationConfig,
                    () =>
                {
                    stopwatch.Start();
                    Logger.LogSay($"Dropping Postgres database '{DbMigrationConfig.DatabaseName.ToLower()}'...");
                },
                    sql =>
                {
                    stopwatch.Stop();
                    Logger.LogSql(sql);
                    Logger.LogSay($"Dropped Postgres database '{DbMigrationConfig.DatabaseName.ToLower()}'...");
                    Logger.LogElapsedTime(stopwatch.ElapsedTime());
                });
            },
                                                   ex => Logger.LogError(ex, $"Dropping Postgres schema(user) '{expression.SchemaName}' failed with exception :-("));
        }
        public override void CanDeleteSchema()
        {
            var expression = new DeleteSchemaExpression();
            var result     = generator.Generate(expression);

            result.ShouldBe(string.Empty);
        }
        public void Schema(string schemaName)
        {
            var expression = new DeleteSchemaExpression {
                SchemaName = schemaName
            };

            _context.Expressions.Add(expression);
        }
示例#5
0
        public void CanDeleteSchema()
        {
            var expression = new DeleteSchemaExpression()
            {
                SchemaName = "TestSchema"
            };

            generator.Generate(expression);
        }
        public void CanDeleteSchema()
        {
            var expression = new DeleteSchemaExpression()
            {
                SchemaName = "TestSchema"
            };
            var sql = generator.Generate(expression);

            sql.ShouldBe("DROP SCHEMA [TestSchema]");
        }
        public void ErrorIsNotReturnedWhenSchemaNameIsSet()
        {
            var expression = new DeleteSchemaExpression {
                SchemaName = "schema1"
            };

            var errors = ValidationHelper.CollectErrors(expression);

            Assert.That(errors.Count, Is.EqualTo(0));
        }
        public void CanDropSchema()
        {
            var expression = new DeleteSchemaExpression()
            {
                SchemaName = "Schema1"
            };
            var sql = generator.Generate(expression);

            sql.ShouldBe("DROP SCHEMA \"Schema1\"");
        }
        public void ErrorIsReturnedWhenSchemaNameIsEmptyString()
        {
            var expression = new DeleteSchemaExpression {
                SchemaName = String.Empty
            };

            var errors = ValidationHelper.CollectErrors(expression);

            errors.ShouldContain(ErrorMessages.SchemaNameCannotBeNullOrEmpty);
        }
示例#10
0
        public override void Process(DeleteSchemaExpression expression)
        {
            this.ExecuteCodeBlockUntilNoExeception(() =>
            {
                if (!SchemaExists(expression.SchemaName))
                {
                    return;
                }

                Logger.LogSay($"Dropping Oracle schema(user) '{expression.SchemaName}'...");
                Process(ExtendedGenerator.Generate(expression));
                Logger.LogSay($"Dropped Oracle schema(user) '{expression.SchemaName}'...");
            },
                                                   ex => Logger.LogError(ex, $"Dropping Oracle schema(user) '{expression.SchemaName}' failed with exception :-("));
        }
示例#11
0
        public void RemoveVersionTable()
        {
            var expression = new DeleteTableExpression {
                TableName = VersionTableMetaData.TableName, SchemaName = VersionTableMetaData.SchemaName
            };

            expression.ExecuteWith(Processor);

            if (OwnsVersionSchema && !string.IsNullOrEmpty(VersionTableMetaData.SchemaName))
            {
                var schemaExpression = new DeleteSchemaExpression {
                    SchemaName = VersionTableMetaData.SchemaName
                };
                schemaExpression.ExecuteWith(Processor);
            }
        }
        public override void Process(DeleteSchemaExpression expression)
        {
            this.ExecuteCodeBlockUntilNoExeception(() =>
            {
                if (!SchemaExists(expression.SchemaName))
                {
                    return;
                }

                Logger.LogSay($"Dropping Postgres schema(user) '{expression.SchemaName}'...");
                Process(ExtendedGeneratorField.Generate(expression));
                Logger.LogSay($"Dropped Postgres schema(user) '{expression.SchemaName}'...");

                Process(new DeleteUserExpression(expression));
                PostgresDatabaseCreator.DropDatabase(DbConfig);
            },
                                                   ex => Logger.LogError(ex, $"Dropping Postgres schema(user) '{expression.SchemaName}' failed with exception :-("));
        }
示例#13
0
 public virtual void Process(DeleteSchemaExpression expression)
 {
     Process(Generator.Generate(expression));
 }
示例#14
0
 public override string Generate(DeleteSchemaExpression expression)
 {
     return(string.Format("DROP SCHEMA {0};", Quoter.QuoteSchemaName(expression.SchemaName)));
 }
示例#15
0
 public override string Generate(DeleteSchemaExpression expression)
 {
     throw new NotImplementedException();
 }
 public override string Generate(DeleteSchemaExpression expression)
 {
     throw new DatabaseOperationNotSupportedException();
 }
 public string Generate(DeleteSchemaExpression expression)
 {
     return(string.Format(DropSchemaSqlTemplate, Quoter.QuoteSchemaName(expression.SchemaName)));
 }
 public override string Generate(DeleteSchemaExpression expression)
 {
     return(String.Format(DropSchema, Quoter.QuoteSchemaName(expression.SchemaName)));
 }
示例#19
0
 public abstract string Generate(DeleteSchemaExpression expression);
示例#20
0
 public override void Process(DeleteSchemaExpression expression)
 {
     truncator.Truncate(expression);
     RegisterExpression <DeleteSchemaExpression>(expression);
     InternalProcess(Generator.Generate(expression));
 }
示例#21
0
 public override string Generate(DeleteSchemaExpression expression)
 {
     return(CompatibilityMode.HandleCompatibilty("Schemas are not supported"));
 }
 public string Generate(DeleteSchemaExpression expression)
 {
     return(string.Format(DropSchemaSqlTemplate, expression.SchemaName.ToUpper()));
 }
示例#23
0
 public DeleteUserExpression(DeleteSchemaExpression expression)
 {
     SchemaName = expression.SchemaName;
 }
示例#24
0
 public void Truncate(DeleteSchemaExpression expression)
 {
 }
 public override void Process(DeleteSchemaExpression expression)
 {
     ExtendedMigrationProcessor.Process(expression);
 }