def _migrate_down(self, engine, version, with_data=False): migration_api.downgrade(engine, TestMigrations.REPOSITORY, version) self.assertEqual( version, migration_api.db_version(engine, TestMigrations.REPOSITORY)) # NOTE(sirp): `version` is what we're downgrading to (i.e. the 'target' # version). So if we have any downgrade checks, they need to be run for # the previous (higher numbered) migration. if with_data: post_downgrade = getattr(self, "_post_downgrade_%03d" % (version + 1), None) if post_downgrade: post_downgrade(engine)
def _migrate_down(self, engine, version, with_data=False): migration_api.downgrade(engine, TestMigrations.REPOSITORY, version) self.assertEqual(version, migration_api.db_version(engine, TestMigrations.REPOSITORY)) # NOTE(sirp): `version` is what we're downgrading to (i.e. the 'target' # version). So if we have any downgrade checks, they need to be run for # the previous (higher numbered) migration. if with_data: post_downgrade = getattr(self, "_post_downgrade_%03d" % (version + 1), None) if post_downgrade: post_downgrade(engine)
def _migrate_up(self, engine, version, with_data=False): """migrate up to a new version of the db. We allow for data insertion and post checks at every migration version with special _pre_upgrade_### and _check_### functions in the main test. """ if with_data: data = None pre_upgrade = getattr(self, "_pre_upgrade_%3.3d" % version, None) if pre_upgrade: data = pre_upgrade(engine) migration_api.upgrade(engine, TestMigrations.REPOSITORY, version) self.assertEqual( version, migration_api.db_version(engine, TestMigrations.REPOSITORY)) if with_data: check = getattr(self, "_check_%3.3d" % version, None) if check: check(engine, data)
def _migrate_up(self, engine, version, with_data=False): """migrate up to a new version of the db. We allow for data insertion and post checks at every migration version with special _pre_upgrade_### and _check_### functions in the main test. """ if with_data: data = None pre_upgrade = getattr(self, "_pre_upgrade_%3.3d" % version, None) if pre_upgrade: data = pre_upgrade(engine) migration_api.upgrade(engine, TestMigrations.REPOSITORY, version) self.assertEqual(version, migration_api.db_version(engine, TestMigrations.REPOSITORY)) if with_data: check = getattr(self, "_check_%3.3d" % version, None) if check: check(engine, data)
def db_version(): return migration_api.db_version(engine, TestMigrations.REPOSITORY)
def db_version(): return migration_api.db_version(engine, TestMigrations.REPOSITORY)