def undo(self): from simplemigrations.models import AppliedMigration am = AppliedMigration.latest() version = am.version file_name = self.migration_file(version) file_path = os.path.join(settings.MIGRATION_DIRECTORY, file_name) klass = self.load_migration_model(file_path) self.migrate_down(klass, am)
def migrations_to_run(self): from simplemigrations.models import AppliedMigration latest_version = AppliedMigration.latest_version() return sorted([t for t in self.migration_files_with_version() if t[1] > latest_version], key=lambda x: x[1])