diff --git a/posthog/test/base.py b/posthog/test/base.py index 707b445f0840c..a8a06dcf3e480 100644 --- a/posthog/test/base.py +++ b/posthog/test/base.py @@ -792,6 +792,14 @@ def _execute_migration_with_snapshots(self, executor): def setUpBeforeMigration(self, apps): pass + @classmethod + def tearDownClass(cls): + super().tearDownClass() # type: ignore + executor = MigrationExecutor(connection) # Reset Django's migration state + targets = executor.loader.graph.leaf_nodes() + executor.migrate(targets) # Migrate to the latest migration + executor.loader.build_graph() # Reload. + class TestMigrations(BaseTestMigrations, BaseTest): """