code: def get_migrations_to_down(self, migration_id):
          
          migration_id = MigrationFile.validate_id(migration_id)
          if not migration_id:
              return []
  
          migrations = self.get_migration_files()
          last_migration_id = self.get_last_migrated_id()
  
          if migration_id in (m.id for m in self.get_unregistered_migrations()):
              logger.error('Migration is not applied %s' % migration_id)
              return []
  
          try:
              migration = [m for m in migrations if m.id == migration_id][0]
          except IndexError:
              logger.error('Migration does not exists %s' % migration_id)
              return []
  
          return list(reversed([m for m in migrations
                                if migration.id <= m.id <= last_migration_id]))
docs: Find migrations to rollback.