Esempio n. 1
0
 def testDirectAppy(self):
     command = "create table xxx (yyy integer primary key);"
     creator = MigrationCreator("migration_test", locationInTestspace())
     target = creator.createMigration()
     self.assertFolderExists("migration_test", target)
     writeToFile(locationInTestspace("migration_test", target, "up"), command)
     conf = Config()
     conf.fromMap(testConfig)
     migrator = MigrationApplier(locationInTestspace(), conf)
     migrator.plugin = FakeDatabasePlugin(self)
     migrator.applySingleMigration(target)
     migrator.plugin.assertCommandWasExecuted(command)
Esempio n. 2
0
 def testAppliesOutOfOrderMigrations(self):
     creator = MigrationCreator("migration_test", locationInTestspace())
     target1 = creator.createMigration(version=23, body="select 1")
     conf = Config()
     conf.fromMap(testConfig)
     migrator = MigrationApplier(locationInTestspace(), conf)
     migrator.plugin = FakeMultiPlugin(self)
     migrator.applySingleMigration(target1)
     target2 = creator.createMigration(version=17, body="select 2")
     migrator.applyMigrations([target1, target2])
     migrator.plugin.assertCurrentVersion(23)
     migrator.plugin.assertCommandWasExecuted("select 1")
     migrator.plugin.assertCommandWasExecuted("select 2")