code: def get_migrations_to_up(self, migration_id=None):
          
          if migration_id is not None:
              migration_id = MigrationFile.validate_id(migration_id)
              if not migration_id:
                  return []
  
          migrations = self.get_unregistered_migrations()
          if not migrations:
              logger.info(self.NO_MIGRATIONS_MSG)
              return []
  
          if migration_id:
              try:
                  last_migration = [m for m in migrations
                                    if m.id == migration_id][0]
              except IndexError:
                  logger.error('Migration is not in unregistered list: %s'
                               % migration_id)
                  self.show_status()
                  return []
          else:
              last_migration = list(migrations)[-1]
  
          return [m for m in migrations if m.id <= last_migration.id]
docs: Find migrations to execute.