[1.7.x] Fixed #22576: Ensure makemigrations doesn't touch the database.