Flake8 plugin to lint for backwards incompatible database migrations
Project description
flake8-django-migrations
Source Code: https://github.com/browniebroke/flake8-django-migrations
Flake8 plugin to lint for backwards incompatible database migrations.
Installation
Install using pip (or your favourite package manager):
pip install flake8-django-migrations
Usage
This plugin should be used automatically when running flake8:
flake8
Checks
This is the list of checks currently implemented by this plugin.
DM001
RemoveField operation should be wrapped in SeparateDatabaseAndState.
Such an operation should be run in two separate steps, using SeparateDatabaseAndState, otherwise it is not backwards compatible.
- Step 1: remove the field from the model and code. For foreign key fields, the foreign key constraint should also be dropped.
- Step 2: remove the column from the database.
Bad
class Migration(migrations.Migration):
operations = [
migrations.RemoveField(
model_name="order",
name="total",
),
]
Good
class Migration(migrations.Migration):
operations = [
migrations.SeparateDatabaseAndState(
state_operations=[
migrations.RemoveField(
model_name="order",
name="total",
),
],
),
]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flake8_django_migrations-1.1.1.tar.gz.
File metadata
- Download URL: flake8_django_migrations-1.1.1.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2466a90d3092044002562b3c032159ee074510dbfe22672767ecda3f90430b6
|
|
| MD5 |
71519c48f7ad402c7b3b7a2ef7ad692c
|
|
| BLAKE2b-256 |
d1bfa0788c5556ebc81903a01c1a5eb903bc5a3335c84cff5c3d9bee7119b056
|
Provenance
The following attestation bundles were made for flake8_django_migrations-1.1.1.tar.gz:
Publisher:
ci.yml on browniebroke/flake8-django-migrations
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flake8_django_migrations-1.1.1.tar.gz -
Subject digest:
e2466a90d3092044002562b3c032159ee074510dbfe22672767ecda3f90430b6 - Sigstore transparency entry: 429965103
- Sigstore integration time:
-
Permalink:
browniebroke/flake8-django-migrations@39e15426c12e26b59389d0a78481ce1ed7d65158 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/browniebroke
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@39e15426c12e26b59389d0a78481ce1ed7d65158 -
Trigger Event:
push
-
Statement type:
File details
Details for the file flake8_django_migrations-1.1.1-py3-none-any.whl.
File metadata
- Download URL: flake8_django_migrations-1.1.1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae79120ebf728ee97a8be4f6b2ee2debec04687344e59041a226e26c621f6b02
|
|
| MD5 |
b57d79194e870932e94faa2d2e6709a2
|
|
| BLAKE2b-256 |
9fc6f0a0106acede2cf3e0ccb3b15a03e2ea318cc0c7731465b9225a7d46e192
|
Provenance
The following attestation bundles were made for flake8_django_migrations-1.1.1-py3-none-any.whl:
Publisher:
ci.yml on browniebroke/flake8-django-migrations
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flake8_django_migrations-1.1.1-py3-none-any.whl -
Subject digest:
ae79120ebf728ee97a8be4f6b2ee2debec04687344e59041a226e26c621f6b02 - Sigstore transparency entry: 429965116
- Sigstore integration time:
-
Permalink:
browniebroke/flake8-django-migrations@39e15426c12e26b59389d0a78481ce1ed7d65158 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/browniebroke
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@39e15426c12e26b59389d0a78481ce1ed7d65158 -
Trigger Event:
push
-
Statement type: