From bf790a05914223b8f29d90b147c547baddbcd151 Mon Sep 17 00:00:00 2001 From: David Wobrock Date: Sat, 20 Jun 2020 21:53:45 +0200 Subject: [PATCH] Do not lint migrations on dry_run If the migration file is not generated, we're not able yet to generate the associated SQL. That'll come in a later version :) --- django_migration_linter/management/commands/makemigrations.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/django_migration_linter/management/commands/makemigrations.py b/django_migration_linter/management/commands/makemigrations.py index 72adf5e..16f9f82 100644 --- a/django_migration_linter/management/commands/makemigrations.py +++ b/django_migration_linter/management/commands/makemigrations.py @@ -30,11 +30,14 @@ class Command(MakeMigrationsCommand): def write_migration_files(self, changes): super(Command, self).write_migration_files(changes) + if ( not getattr(settings, "MIGRATION_LINTER_OVERRIDE_MAKEMIGRATIONS", False) and not self.lint ): return + if self.dry_run: + return # Lint migrations linter = MigrationLinter(