diff options
| author | Chris Beaven <smileychris@gmail.com> | 2014-06-23 13:29:27 +1200 |
|---|---|---|
| committer | Chris Beaven <smileychris@gmail.com> | 2014-06-23 13:36:22 +1200 |
| commit | 21c496ea52b8bdf0d97507c00a87286425dac087 (patch) | |
| tree | 34b67646fd791a23d3833108cf64ef724f10e5c5 /django | |
| parent | ecc06d44ed67c5bd27278244e5cf315d6fa2c893 (diff) | |
Fixed #22881 -- Better soft_applied migration detection
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/migrations/executor.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/django/db/migrations/executor.py b/django/db/migrations/executor.py index 04d2b778f5..ecd9d0fdf2 100644 --- a/django/db/migrations/executor.py +++ b/django/db/migrations/executor.py @@ -132,11 +132,13 @@ class MigrationExecutor(object): """ project_state = self.loader.project_state((migration.app_label, migration.name), at_end=True) apps = project_state.render() + found_create_migration = False for operation in migration.operations: if isinstance(operation, migrations.CreateModel): model = apps.get_model(migration.app_label, operation.name) if model._meta.db_table not in self.connection.introspection.get_table_list(self.connection.cursor()): return False - else: - return False - return True + found_create_migration = True + # If we get this far and we found at least one CreateModel migration, + # the migration is considered implicitly applied. + return found_create_migration |
