Fix #264 -- Don't detect an index creation during a transaction with an exclusive lock, when the table is being created

Improve documentation on this issue.
This commit is contained in:
Chris Conn authored and David Wobrock committed 2025-03-30 18:53:34 +02:00
1 parent c2c0d5886a
commit eb59c472fb
4 files changed
+50 -21

No files matched your search

+18 -18
View File
@@ -25,24 +25,24 @@ On data migrations, the linter will show a warning when:
You can ignore checks through the `--exclude-migration-tests` option by specifying any of the codes:
| Code | Description | Default type |
|------------------------------------|----------------------------------------------------------------------------------------------------------------------|--------------|
| `NOT_NULL` | Not NULL constraint on columns | Error |
| `DROP_COLUMN` | Dropping columns | Error |
| `DROP_TABLE` | Dropping tables | Error |
| `RENAME_COLUMN` | Renaming columns | Error |
| `RENAME_TABLE` | Renaming tables | Error |
| `ALTER_COLUMN` | Altering columns (could be backward compatible) | Error |
| `ADD_UNIQUE` | Add unique constraints | Error |
| `RUNPYTHON_REVERSIBLE` | RunPython data migration is not reversible (missing reverse code) | Warning |
| `RUNPYTHON_ARGS_NAMING_CONVENTION` | By convention, RunPython names two arguments: apps, schema_editor | Warning |
| `RUNPYTHON_MODEL_IMPORT` | Missing apps.get_model() calls for model | Error |
| `RUNPYTHON_MODEL_VARIABLE_NAME` | The model variable name is different from the model class itself | Warning |
| `RUNSQL_REVERSIBLE` | RunSQL data migration is not reversible (missing reverse SQL) | Warning |
| `CREATE_INDEX` | (Postgresql specific) Creating an index without the concurrent keyword will lock the table and may generate downtime | Warning |
| `CREATE_INDEX_EXCLUSIVE` | (Postgresql specific) Creating an index in a transaction (after an `EXCLUSIVE` lock) prolongs the exclusive lock | Warning |
| `DROP_INDEX` | (Postgresql specific) Dropping an index without the concurrent keyword will lock the table and may generate downtime | Warning |
| `REINDEX` | (Postgresql specific) Reindexing will lock the table and may generate downtime | Warning |
| Code | Description | Default type |
|------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
| `NOT_NULL` | Not NULL constraint on columns | Error |
| `DROP_COLUMN` | Dropping columns | Error |
| `DROP_TABLE` | Dropping tables | Error |
| `RENAME_COLUMN` | Renaming columns | Error |
| `RENAME_TABLE` | Renaming tables | Error |
| `ALTER_COLUMN` | Altering columns (could be backward compatible) | Error |
| `ADD_UNIQUE` | Add unique constraints | Error |
| `RUNPYTHON_REVERSIBLE` | RunPython data migration is not reversible (missing reverse code) | Warning |
| `RUNPYTHON_ARGS_NAMING_CONVENTION` | By convention, RunPython names two arguments: apps, schema_editor | Warning |
| `RUNPYTHON_MODEL_IMPORT` | Missing apps.get_model() calls for model | Error |
| `RUNPYTHON_MODEL_VARIABLE_NAME` | The model variable name is different from the model class itself | Warning |
| `RUNSQL_REVERSIBLE` | RunSQL data migration is not reversible (missing reverse SQL) | Warning |
| `CREATE_INDEX` | (Postgresql specific) Creating an index without the concurrent keyword will lock the table and may generate downtime | Warning |
| `CREATE_INDEX_EXCLUSIVE` | (Postgresql specific) Creating an index in a transaction acquiring an `EXCLUSIVE` lock (e.g. most `ALTER TABLE` statements acquire one) prolongs the exclusive lock on the table. Using concurrently clause does not address the issue. On the contrary, it prolongs the transaction, making it more dangerous in this situation. | Warning |
| `DROP_INDEX` | (Postgresql specific) Dropping an index without the concurrent keyword will lock the table and may generate downtime | Warning |
| `REINDEX` | (Postgresql specific) Reindexing will lock the table and may generate downtime | Warning |
## Details about backward incompatibilities