def migrate_data(registry, destination=None): plugins_config = registry.app_meta.plugins existing_plugins = get_plugins(plugins_config) if registry.app_meta.plugins and not any(existing_plugins): return cur_version = get_db_schema_version(registry.db) if cur_version == SCHEMA_VERSION: return cur_version for step in xrange(cur_version, destination or SCHEMA_VERSION): LOGGER.info("Migrate openprocurement auction schema from {} to {}".format(step, step + 1), extra={'MESSAGE_ID': 'migrate_data'}) migration_func = globals().get('from{}to{}'.format(step, step + 1)) if migration_func: migration_func(registry) set_db_schema_version(registry.db, step + 1)
def migrate_data(registry, destination=None): if isinstance(registry, Configurator): registry = registry.registry plugins_config = registry.app_meta.plugins existing_plugins = get_plugins(plugins_config) if registry.app_meta.plugins and 'auctions.core' not in existing_plugins: return cur_version = get_db_schema_version(registry.db) if cur_version == SCHEMA_VERSION: return cur_version for step in xrange(cur_version, destination or SCHEMA_VERSION): LOGGER.info("Migrate flash auctions schema from {} to {}".format( step, step + 1), extra={'MESSAGE_ID': 'migrate_data'}) migration_func = globals().get('from{}to{}'.format(step, step + 1)) if migration_func: migration_func(registry) set_db_schema_version(registry.db, step + 1)