Skip to content

Instantly share code, notes, and snippets.

@jhrr
Created July 21, 2020 13:52
Show Gist options
  • Save jhrr/efb0c3e33a944fb20362dc5706218668 to your computer and use it in GitHub Desktop.
Save jhrr/efb0c3e33a944fb20362dc5706218668 to your computer and use it in GitHub Desktop.
from django.db.migrations.recorder import MigrationRecorder
>>> MigrationRecorder.Migration.objects.all()
>>> MigrationRecorder.Migration.objects.latest('id')
Out[5]: <Migration: Migration 0050_auto_20170603_1814 for model>
>>> MigrationRecorder.Migration.objects.latest('id').delete()
Out[4]: (1, {u'migrations.Migration': 1})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment