Fix/revisit docs

Started with a follow-up to fa9b2f97, which missed applying the fix to
docs, and then added some more while reading it.
This commit is contained in:
Daniel Hahler authored and David Wobrock committed 2021-11-12 08:53:25 +01:00
1 parent 7520735aa2
commit 6ba4010381
3 files changed
+14 -10

No files matched your search

+7 -8
View File
@@ -57,7 +57,7 @@ More advanced usages of the linter and options [can be found at docs/usage.md](.
## Integration ## Integration
One can either integrate the linter in the CI and the `lintmigrations` command, or detect incompatibilities during generation with One can either integrate the linter in the CI using its `lintmigrations` command, or detect incompatibilities during generation of migrations with
``` ```
$ python manage.py makemigrations --lint $ python manage.py makemigrations --lint
@@ -68,23 +68,22 @@ Linting for 'app_correct':
(app_correct, 0003_a_column)... ERR (app_correct, 0003_a_column)... ERR
NOT NULL constraint on columns NOT NULL constraint on columns
The migration linter detected that this migration is not be backward compatible. The migration linter detected that this migration is not backward compatible.
- If you keep the migration, you will want to fix the issue or ignore the migration. - If you keep the migration, you will want to fix the issue or ignore the migration.
- By default, the newly created migration file will be deleted. - By default, the newly created migration file will be deleted.
Do you want to keep the migration? [y/N] Do you want to keep the migration? [y/N] n
[...]
Deleted tests/test_project/app_correct/migrations/0003_a_column.py Deleted tests/test_project/app_correct/migrations/0003_a_column.py
``` ```
The linter found that the newly created migration is not backward compatible and deletes the files. The linter found that the newly created migration is not backward compatible and deleted the file after confirmation.
This behaviour can be the default of the `makemigrations` command through the `MIGRATION_LINTER_OVERRIDE_MAKEMIGRATIONS` Django settings. This behaviour can be the default of the `makemigrations` command through the `MIGRATION_LINTER_OVERRIDE_MAKEMIGRATIONS` Django setting.
Find out more about the [makemigrations command at docs/makemigrations.md](./docs/makemigrations.md). Find out more about the [makemigrations command at docs/makemigrations.md](./docs/makemigrations.md).
### More information ### More information
Please find more documentation generally [in the docs/ folder](./docs/). Please find more documentation [in the docs/ folder](./docs/).
Some implementation details [can found in the ./docs/internals/ folder](./docs/internals/). Some implementation details [can be found in the ./docs/internals/ folder](./docs/internals/).
### Blog post ### Blog post
+1 -1
View File
@@ -23,7 +23,7 @@ On data migrations, the linter will show a warning when:
## Codes ## Codes
You can ignore check through the `--exclude-migration-tests` option and specifying any of the codes: You can ignore checks through the `--exclude-migration-tests` option by specifying any of the codes:
| Code | Description | | Code | Description |
|-----------------------------------|----------------------------------------------------------------------| |-----------------------------------|----------------------------------------------------------------------|
+6 -1
View File
@@ -1,6 +1,6 @@
# makemigrations # makemigrations
The linter can override behaviour of the [Django makemigrations command](https://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-makemigrations). The linter can override the behaviour of the [Django makemigrations command](https://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-makemigrations).
Either: Either:
* by specifying the `--lint` option in the command line * by specifying the `--lint` option in the command line
@@ -16,6 +16,11 @@ Migrations for 'app_correct':
Linting for 'app_correct': Linting for 'app_correct':
(app_correct, 0003_a_column)... ERR (app_correct, 0003_a_column)... ERR
NOT NULL constraint on columns NOT NULL constraint on columns
The migration linter detected that this migration is not backward compatible.
- If you keep the migration, you will want to fix the issue or ignore the migration.
- By default, the newly created migration file will be deleted.
Do you want to keep the migration? [y/N] n
Deleted tests/test_project/app_correct/migrations/0003_a_column.py Deleted tests/test_project/app_correct/migrations/0003_a_column.py
``` ```