Skip to main content

Do not generate unnecessary migrations

Project description

https://img.shields.io/pypi/v/django-migrations-ignore-attrs.svg https://travis-ci.org/dex4er/django-migrations-ignore-attrs.svg?branch=master https://readthedocs.org/projects/django-migrations-ignore-attrs/badge/?version=latest https://img.shields.io/pypi/pyversions/django-migrations-ignore-attrs.svg https://img.shields.io/pypi/djversions/django-migrations-ignore-attrs.svg

django-migrations-ignore-attrs

django-migrations-ignore-attrs is a package that overrides makemigration and migrate commands for Django’s manage.py command.

django-migrations-ignore-attrs allows to avoid making of unnecessary migrations for attributes that do not have any representation in database schema.

Following attributes of model are ignored:

  • verbose_name
  • verbose_name_plural

Following attributes of standard fields are ignored:

  • choices
  • help_text
  • verbose_name

Following attributes of ForeignKey are ignored:

  • related_name
  • related_query_name

Installation

Install with pip or pipenv:

pip install django-migrations-ignore-attrs

Add django_migrations_ignore_attrs to your installed apps in your settings.py file:

INSTALLED_APPS = [
    'django_migrations_ignore_attrs',
    ...
]

Optional configuration:

# ignored attributes of model
MIGRATION_IGNORE_MODEL_ATTRS = ['verbose_name', 'verbose_name_plural']

# ignored attributes of standard fields
MIGRATION_IGNORE_FIELD_ATTRS = ['choices', 'help_text', 'verbose_name']

# ignored attributes of ForeignKey
MIGRATION_IGNORE_RELATED_FIELD_ATTRS = ['related_name', 'related_query_name']

Commands

makemigrations

Creates new migration(s) for apps.

All options are the same as for original makemigrations command from django app.

migrate

Updates database schema. Manages both apps with migrations and those without.

All options are the same as for original migrate command from django app.

License

Copyright © 2019, Piotr Roszatycki

This software is distributed under the GNU Lesser General Public License (LGPL 3 or greater).

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-migrations-ignore-attrs, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size django_migrations_ignore_attrs-0.1.0-py2.py3-none-any.whl (7.1 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size django-migrations-ignore-attrs-0.1.0.tar.gz (16.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page