Skip to main content

Django migrations without unnecesary change alert triggers.

Project description

Community-Project

Contributor Covenant

PyPI - Supported versions PyPI - Package version PyPI - Downloads PyPI - MIT License

Codacy Badge Codacy Badge

Django Simple Migrations

Django migrations without unnecesary change alert triggers.

This project was originally taken from Pretix source code and battle testet across many projects on SoftButterfly.

This package overrides the commands makemigrations and migrate, mainly to make that makemigrations doesn't create migrations on non-significant database model fields and avoid migrate warnings. As is stated in the source code

  • makemigrations

    Django, for theoretically very valid reasons, creates migrations for every single thing we change on a model. Even the help_text! This makes sense, as we don't know if any database backend unknown to us might actually use this information for its database schema.

    However, many projects only supports PostgreSQL, MySQL, MariaDB and SQLite and we can be pretty certain that some changes to models will never require a change to the database. In this case, not creating a migration for certain changes will save us some performance while applying them and allow for a cleaner git history. Win-win!

    Only caveat is that we need to do some dirty monkeypatching to achieve it...

  • migrate

    Django tries to be helpful by suggesting to run "makemigrations" in red font on every "migrate" run when there are things we have no migrations for. Usually, this is intended, and running "makemigrations" can really screw up the environment of a user, so we want to prevent novice users from doing that by going really dirty and filtering it from the output.

Requirements

  • Python 3.9, 3.10, 3.11, 3.12

Install

pip install django-sb-simple-migrations

Usage

Just add django_sb_simple_migrations to your INSTALLED_APPS settings

INSTALLED_APPS = [
  # ...
  "django_sb_simple_migrations",
  # ...
]

Docs

Changelog

All changes to versions of this library are listed in the change history.

Development

Check out our contribution guide.

Contributors

See the list of contributors here.

Project details


Download files

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

Source Distribution

django_sb_simple_migrations-0.10.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_sb_simple_migrations-0.10.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file django_sb_simple_migrations-0.10.0.tar.gz.

File metadata

File hashes

Hashes for django_sb_simple_migrations-0.10.0.tar.gz
Algorithm Hash digest
SHA256 3cefa039bea6922435f7460b087c537e4c4aee87d33576d6bc76749379d617f4
MD5 2ab9093b37e193875eb1f7418391c776
BLAKE2b-256 0ef192de9fa03cc52920448ccad05eee9e1d497937e51fcef6146e4245e80540

See more details on using hashes here.

File details

Details for the file django_sb_simple_migrations-0.10.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_sb_simple_migrations-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fbc4c3d3a2daee88d74e19b94db38e7701e8ef12adc97ae65cafe6b57973ad1f
MD5 9e25d90f37b42a6ac6deb9d9ad4475e2
BLAKE2b-256 119215be22f193abbd653ac9b07018847935a52e7fb7749c9a9c43ebb82af6b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page