{ "info": { "author": "Ryan Hiebert", "author_email": "ryan@aspiredu.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "===========================================================\ndjango-safemigrate: Safely run migrations before deployment\n===========================================================\n\n.. image:: https://img.shields.io/pypi/v/django-safemigrate.svg\n :target: https://pypi.org/project/django-safemigrate/\n :alt: Latest Version\n\n.. image:: https://dev.azure.com/aspiredu/django-safemigrate/_apis/build/status/1?branchName=master\n :target: https://dev.azure.com/aspiredu/django-safemigrate/_build/latest?definitionId=1&branchName=master\n :alt: Build status\n\n.. image:: https://codecov.io/gh/aspiredu/django-safemigrate/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/aspiredu/django-safemigrate\n :alt: Code Coverage\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/ambv/black\n :alt: Code style: black\n\n|\n\ndjango-safemigrate adds a ``safemigrate`` command to Django\nto allow for safely running a migration command when deploying.\n\nUsage\n=====\n\nInstall ``django-safemigrate``, then add this to the\n``INSTALLED_APPS`` in the settings file:\n\n.. code-block:: python\n\n INSTALLED_APPS = [\n # ...\n \"django_safemigrate.apps.SafeMigrateConfig\",\n ]\n\nThen mark any migration that may be run\nduring a pre-deployment stage,\nsuch as a migration to add a column.\n\n.. code-block:: python\n\n from django_safemigrate import Safe\n\n class Migration(migrations.Migration):\n safe = Safe.before_deploy\n\nAt this point you can run the ``safemigrate`` Django command\nto run the migrations, and only these migrations will run.\nHowever, if migrations that are not safe to run before\nthe code is deployed are dependencies of this migration,\nthen these migrations will be blocked, and the safemigrate\ncommand will fail with an error.\n\nWhen the code is fully deployed, just run the normal ``migrate``\nDjango command, which still functions normally.\nFor example, you could add the command to the release phase\nfor your Heroku app, and the safe migrations will be run\nautomatically when the new release is promoted.\n\nSafety Options\n==============\n\nThere are three options for the value of the\n``safe`` property of the migration.\n\n* ``Safe.before_deploy``\n\n This migration is only safe to run before the code change is deployed.\n For example, a migration that adds a new field to a model.\n\n* ``Safe.after_deploy``\n\n This migration is only safe to run after the code change is deployed.\n This is the default that is applied if no ``safe`` property is given.\n For example, a migration that removes a field from a model.\n\n* ``Safe.always``\n\n This migration is safe to run before *and* after\n the code change is deployed.\n For example, a migration that changes the ``help_text`` of a field.\n\nNonstrict Mode\n==============\n\nUnder normal operation, if there are migrations\nthat must run before the deployment that depend\non any migration that is marked to run after deployment\n(or is not marked),\nthe command will raise an error to indicate\nthat there are protected migrations that\nshould have already been run, but have not been,\nand are blocking migrations that are expected to run.\n\nIn development, however, it is common that these\nwould accumulate between developers,\nand since it is acceptable for there to be downtime\nduring the transitional period in development,\nit is better to allow the command to continue without raising.\n\nTo enable nonstrict mode, add the ``SAFEMIGRATE`` setting:\n\n.. code-block:: python\n\n SAFEMIGRATE = \"nonstrict\"\n\nIn this mode ``safemigrate`` will run all the migrations\nthat are not blocked by any unsafe migrations.\nAny remaining migrations can be run after the fact\nusing the normal ``migrate`` Django command.\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "MIT", "maintainer": "Ryan Hiebert", "maintainer_email": "ryan@aspiredu.com", "name": "django-safemigrate", "package_url": "https://pypi.org/project/django-safemigrate/", "platform": "", "project_url": "https://pypi.org/project/django-safemigrate/", "project_urls": null, "release_url": "https://pypi.org/project/django-safemigrate/2.0/", "requires_dist": [ "django (>=2.1,<3.0)" ], "requires_python": ">=3.6,<4.0", "summary": "Safely run migrations before deployment", "version": "2.0" }, "last_serial": 4709544, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "34d3ab286ab2fcd93105f83ea3c93ee3", "sha256": "7c8d25f1b17e6dd72d4db2515067efb9525a0ba1d8cf79f0eaf98b9f9f385210" }, "downloads": -1, "filename": "django_safemigrate-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "34d3ab286ab2fcd93105f83ea3c93ee3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 7220, "upload_time": "2019-01-13T18:17:45", "url": "https://files.pythonhosted.org/packages/1e/68/0d68be097ee5550288c7dd265ee1e8dbe74c812f0c8d2ce0ca15c3e73b06/django_safemigrate-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f10197dd74da0a36d0ace7ae38283316", "sha256": "aaee0bf695c4ef452ad4eaa4b76866b4fab57bb9afddf4339f5a54e40ccc4982" }, "downloads": -1, "filename": "django-safemigrate-1.0.tar.gz", "has_sig": false, "md5_digest": "f10197dd74da0a36d0ace7ae38283316", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 3147, "upload_time": "2019-01-13T18:17:42", "url": "https://files.pythonhosted.org/packages/b4/11/48019a1806af717cfd43259ea5210df64ebfec814d70073166824d0f08c6/django-safemigrate-1.0.tar.gz" } ], "2.0": [ { "comment_text": "", "digests": { "md5": "b41fd2acd946e85b8f92e5de20347d58", "sha256": "611303b68623c72a44c1c487a46e72b53d4859b14c9953fc68721e2991f73893" }, "downloads": -1, "filename": "django_safemigrate-2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b41fd2acd946e85b8f92e5de20347d58", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 9673, "upload_time": "2019-01-17T20:24:21", "url": "https://files.pythonhosted.org/packages/fe/89/7fe25eb068e6160cd199335483b68c85fe1e05a1cf98edb43eb6c83f24c6/django_safemigrate-2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "268653071e65449000178e5a87121de7", "sha256": "256a2265d072ba93c18dfe8e0087cf50fc23ce69983ea63ee6febbcf63cc003a" }, "downloads": -1, "filename": "django-safemigrate-2.0.tar.gz", "has_sig": false, "md5_digest": "268653071e65449000178e5a87121de7", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 5083, "upload_time": "2019-01-17T20:24:19", "url": "https://files.pythonhosted.org/packages/1a/7b/d99ebe5c8ff877d94256c532a31c5c45be97d41279dc2f5029eddb854ee3/django-safemigrate-2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b41fd2acd946e85b8f92e5de20347d58", "sha256": "611303b68623c72a44c1c487a46e72b53d4859b14c9953fc68721e2991f73893" }, "downloads": -1, "filename": "django_safemigrate-2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b41fd2acd946e85b8f92e5de20347d58", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 9673, "upload_time": "2019-01-17T20:24:21", "url": "https://files.pythonhosted.org/packages/fe/89/7fe25eb068e6160cd199335483b68c85fe1e05a1cf98edb43eb6c83f24c6/django_safemigrate-2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "268653071e65449000178e5a87121de7", "sha256": "256a2265d072ba93c18dfe8e0087cf50fc23ce69983ea63ee6febbcf63cc003a" }, "downloads": -1, "filename": "django-safemigrate-2.0.tar.gz", "has_sig": false, "md5_digest": "268653071e65449000178e5a87121de7", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 5083, "upload_time": "2019-01-17T20:24:19", "url": "https://files.pythonhosted.org/packages/1a/7b/d99ebe5c8ff877d94256c532a31c5c45be97d41279dc2f5029eddb854ee3/django-safemigrate-2.0.tar.gz" } ] }