Allow ignoring initial migrations

Sometimes, if your apps have cyclic dependencies or complicated FK structure,
django migrations creates multiple initial migration files, which can very
easily fail linting because they are adding foreign keys or constraints etc.

This adds an option to automatically ignore all initial migrations.
This commit is contained in:
Mikuláš Poul authored and David Wobrock committed 2025-03-30 19:29:56 +02:00
1 parent dfd83cf9b8
commit 979b6b1046
6 files changed
+35 -2

No files matched your search

+2
View File
@@ -48,6 +48,7 @@ If you are using a config file, replace any dashes (`-`) with an underscore (`_`
| `--warnings-as-errors [MIGRATION_TEST_CODE [...]]` | Handle warnings as errors and therefore return an error status code if we should. Optionally specify migration test codes to handle as errors. When no test code specified, all warnings are handled as errors. |
| `--sql-analyser` | Specify the SQL analyser that should be used. Allowed values: 'sqlite', 'mysql', 'postgresql'. |
| `--ignore-sqlmigrate-errors` | Ignore failures of sqlmigrate commands. |
| `--ignore-initial-migrations` | Ignore initial migrations. |
## Django settings configuration
@@ -86,6 +87,7 @@ class Migration(migrations.Migration):
```
Or you can restrict the migrations that should be selected by a file containing there paths with the `--include-migrations-from` option.
Or you can ignore all initial migrations with the `--ignore-initial-migrations` option.
## Ignoring migration tests