{"id":13735187,"url":"https://github.com/browniebroke/flake8-django-migrations","last_synced_at":"2025-03-16T12:32:32.630Z","repository":{"id":37030875,"uuid":"311745381","full_name":"browniebroke/flake8-django-migrations","owner":"browniebroke","description":"Flake8 plugin to lint for backwards incompatible database migrations","archived":false,"fork":false,"pushed_at":"2024-04-30T11:44:20.000Z","size":324,"stargazers_count":9,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-01T13:51:54.872Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/browniebroke.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["browniebroke"],"patreon":"browniebroke","custom":["https://paypal.me/browneibroke"]}},"created_at":"2020-11-10T18:10:33.000Z","updated_at":"2024-05-03T16:34:22.432Z","dependencies_parsed_at":"2023-02-19T06:01:20.182Z","dependency_job_id":"f54ec893-0e4a-4a34-8acd-7ac62455aaf7","html_url":"https://github.com/browniebroke/flake8-django-migrations","commit_stats":{"total_commits":359,"total_committers":7,"mean_commits":"51.285714285714285","dds":"0.46796657381615603","last_synced_commit":"f8505083ed8f83247c17b7bda561f444cc609a8c"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browniebroke%2Fflake8-django-migrations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browniebroke%2Fflake8-django-migrations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browniebroke%2Fflake8-django-migrations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browniebroke%2Fflake8-django-migrations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/browniebroke","download_url":"https://codeload.github.com/browniebroke/flake8-django-migrations/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221663667,"owners_count":16859882,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-08-03T03:01:03.953Z","updated_at":"2025-03-16T12:32:32.617Z","avatar_url":"https://github.com/browniebroke.png","language":"Python","funding_links":["https://github.com/sponsors/browniebroke","https://patreon.com/browniebroke","https://paypal.me/browneibroke"],"categories":["Library-specific checks"],"sub_categories":[],"readme":"# flake8-django-migrations\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/browniebroke/flake8-django-migrations/actions/workflows/ci.yml?query=branch%3Amain\"\u003e\n    \u003cimg alt=\"CI Status\" src=\"https://img.shields.io/github/actions/workflow/status/browniebroke/flake8-django-migrations/ci.yml?branch=main\u0026label=CI\u0026logo=github\u0026style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/browniebroke/flake8-django-migrations\"\u003e\n    \u003cimg src=\"https://img.shields.io/codecov/c/github/browniebroke/flake8-django-migrations.svg?logo=codecov\u0026style=flat-square\" alt=\"Test coverage percentage\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/astral-sh/uv\"\u003e\n    \u003cimg src=\"https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json\" alt=\"uv\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/astral-sh/ruff\"\u003e\n    \u003cimg src=\"https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json\" alt=\"Ruff\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/pre-commit/pre-commit\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\u0026logoColor=white\u0026style=flat-square\" alt=\"pre-commit\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://pypi.org/project/flake8-django-migrations/\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/flake8-django-migrations.svg?logo=python\u0026amp;logoColor=fff\u0026amp;style=flat-square\" alt=\"PyPi Status\"\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/pypi/pyversions/flake8-django-migrations.svg?style=flat-square\" alt=\"pyversions\"\u003e\n  \u003cimg src=\"https://img.shields.io/pypi/l/flake8-django-migrations.svg?style=flat-square\" alt=\"license\"\u003e\n\u003c/p\u003e\n\n---\n\n**Source Code**: \u003ca href=\"https://github.com/browniebroke/flake8-django-migrations\" target=\"_blank\"\u003ehttps://github.com/browniebroke/flake8-django-migrations\u003c/a\u003e\n\n---\n\nFlake8 plugin to lint for backwards incompatible database migrations.\n\n## Installation\n\nInstall using `pip` (or your favourite package manager):\n\n```sh\npip install flake8-django-migrations\n```\n\n## Usage\n\nThis plugin should be used automatically when running flake8:\n\n```sh\nflake8\n```\n\n## Checks\n\nThis is the list of checks currently implemented by this plugin.\n\n### DM001\n\n`RemoveField` operation should be wrapped in `SeparateDatabaseAndState`.\n\nSuch an operation should be run in two separate steps, using `SeparateDatabaseAndState`, otherwise it is not backwards compatible.\n\n- Step 1: remove the field from the model and code. For foreign key fields, the foreign key constraint should also be dropped.\n- Step 2: remove the column from the database.\n\n#### Bad\n\n```python\nclass Migration(migrations.Migration):\n    operations = [\n        migrations.RemoveField(\n            model_name=\"order\",\n            name=\"total\",\n        ),\n    ]\n```\n\n#### Good\n\n```python\nclass Migration(migrations.Migration):\n    operations = [\n        migrations.SeparateDatabaseAndState(\n            state_operations=[\n                migrations.RemoveField(\n                    model_name=\"order\",\n                    name=\"total\",\n                ),\n            ],\n        ),\n    ]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowniebroke%2Fflake8-django-migrations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrowniebroke%2Fflake8-django-migrations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowniebroke%2Fflake8-django-migrations/lists"}