How does django know whether a migration has been applied yet? It usually gets it right, but when it doesn't I don't ever know where to start troubleshooting.
Django writes a record into the table django_migrations
consisting of some information like the app the migration belongs to, the name of the migration, and the date it was applied.