I want to get the name of the last applied migration in Django. I know that Django migrations are stored in django_migrations
table, however django.db.migrations.migration.Migration
is not a models.Model
backed by that table. This means you cannot do:
migration_info = Migration.objects.all()
Is there any built-in way of retrieveing the data from django_migrations
, or should i just create my own read-only Model:
class MigrationInfo(models.Model):
class Meta:
managed = False
db_table = "django_migrations"