def migrate(self, migrations_package_name, up_to=9999):
        '''
        Executes schema migrations.

        - `migrations_package_name` - fully qualified name of the Python package
          containing the migrations.
        - `up_to` - number of the last migration to apply.
        '''
        from .migrations import MigrationHistory
        logger = logging.getLogger('migrations')
        applied_migrations = self._get_applied_migrations(migrations_package_name)
        modules = import_submodules(migrations_package_name)
        unapplied_migrations = set(modules.keys()) - applied_migrations
        for name in sorted(unapplied_migrations):
            logger.info('Applying migration %s...', name)
            for operation in modules[name].operations:
                operation.apply(self)
            self.insert([MigrationHistory(package_name=migrations_package_name, module_name=name, applied=datetime.date.today())])
            if int(name[:4]) >= up_to:
                break
def migrate ( self , migrations_package_name , up_to = 9999 ) : from . migrations import MigrationHistory logger = logging . getLogger ( 'migrations' ) applied_migrations = self . _get_applied_migrations ( migrations_package_name ) modules = import_submodules ( migrations_package_name ) unapplied_migrations = set ( modules . keys ( ) ) - applied_migrations for name in sorted ( unapplied_migrations ) : logger . info ( 'Applying migration %s...' , name ) for operation in modules [ name ] . operations : operation . apply ( self ) self . insert ( [ MigrationHistory ( package_name = migrations_package_name , module_name = name , applied = datetime . date . today ( ) ) ] ) if int ( name [ : 4 ] ) >= up_to : break
Executes schema migrations.

        - `migrations_package_name` - fully qualified name of the Python package
          containing the migrations.
        - `up_to` - number of the last migration to apply.