public void Executes_Migration_For_Spanning_One_Target_2() { var runner = new MigrationRunner( Mock.Of <IMigrationEntryService>(), Mock.Of <ILogger>(), new SemVersion(5, 0, 1), new SemVersion(6, 0, 0), "Test"); var migrations = runner.OrderedUpgradeMigrations(new List <IMigration> { new MultiMigration(new SqlCeSyntaxProvider(), Mock.Of <ILogger>()) }); var ctx = runner.InitializeMigrations( //new List<IMigration> {new DoRunMigration(), new DoNotRunMigration()}, migrations.ToList(), new Database("umbracoDbDSN") , DatabaseProviders.SqlServerCE, true); Assert.AreEqual(1, ctx.Expressions.Count()); }
public void Can_Find_Targetted_Migrations() { var db = GetConfiguredDatabase(); //Create db schema and data from old Total.sql file for Sql Ce string statements = GetDatabaseSpecificSqlScript(); // replace block comments by whitespace statements = FindComments.Replace(statements, " "); // execute all non-empty statements foreach (string statement in statements.Split(";".ToCharArray())) { string rawStatement = statement.Replace("GO", "").Trim(); if (rawStatement.Length > 0) { db.Execute(new Sql(rawStatement)); } } var configuredVersion = new SemVersion(4, 8, 0); var targetVersion = new SemVersion(6, 0, 0); var foundMigrations = MigrationResolver.Current.Migrations; var migrationRunner = new MigrationRunner( Mock.Of <IMigrationEntryService>(), Logger, configuredVersion, targetVersion, GlobalSettings.UmbracoMigrationName); var migrations = migrationRunner.OrderedUpgradeMigrations(foundMigrations).ToList(); var context = new MigrationContext(DatabaseProviders.SqlServerCE, db, Logger); foreach (var migration1 in migrations) { var migration = (MigrationBase)migration1; migration.GetUpExpressions(context); } foreach (var expression in context.Expressions) { Console.WriteLine(expression.ToString()); } Assert.That(migrations.Count(), Is.EqualTo(12)); }
public void Can_Find_Targetted_Migrations() { var configuredVersion = new Version("4.11.0"); var targetVersion = new Version("6.0.0"); var foundMigrations = MigrationResolver.Current.Migrations; var migrationRunner = new MigrationRunner(configuredVersion, targetVersion, GlobalSettings.UmbracoMigrationName); var migrations = migrationRunner.OrderedUpgradeMigrations(foundMigrations); var context = new MigrationContext(DatabaseProviders.SqlServerCE, null); foreach (MigrationBase migration in migrations) { migration.GetUpExpressions(context); } foreach (var expression in context.Expressions) { Console.WriteLine(expression.ToString()); } Assert.That(migrations.Count(), Is.EqualTo(11)); }