Skip to main content

Handle deletion of django model field without downtime

Project description

Actions Status

django_remove_field

Help to remove a django model fields without downtime.

Soft deprecation

Use @deprecated_fields(fieldnames=[]) to generate logs when one of the fieldnames is used:

@deprecated_fields(["is_active"])
class ModelWithDeprecatedField(models.Model):
    name = models.CharField(max_length=64)
    is_active = models.BooleanField()

Hard deprecation

Use @removed_field(fieldnames=[]) to raise error when one of the fieldnames is used:

@removed_fields(["is_active"])
class ModelWithRemovedField(models.Model):
    name = models.CharField(max_length=64)
    is_active = models.BooleanField(null=True)

DB migration

When you run migration (makemigrations, migrate, ...), set the environment variable DJANGO_REMOVE_FIELD_DISABLED to not generate remove field migration.

developers

Run all tests with make test

We need to run twice tests with different value for environment variable to be able to test the both case (using the decorator and ignoring decorator)

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_remove_field-0.3.0.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

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

django_remove_field-0.3.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file django_remove_field-0.3.0.tar.gz.

File metadata

  • Download URL: django_remove_field-0.3.0.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.0 Linux/6.14.0-36-generic

File hashes

Hashes for django_remove_field-0.3.0.tar.gz
Algorithm Hash digest
SHA256 93010bf0c3fbfbd8a0879b0a996ade0a70049ba442ad206222cc99fe11c2c8d7
MD5 606c68c18f92d0d0cbee27802173538f
BLAKE2b-256 574988bb7b3044cb17963ccebed18c7e19fd448022d1ea0b8fb4baf1f32d7b28

See more details on using hashes here.

File details

Details for the file django_remove_field-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: django_remove_field-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.0 Linux/6.14.0-36-generic

File hashes

Hashes for django_remove_field-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e8da75605d083e95cddc287096aa0cab485fd2a571986ab7cde7315455fdc405
MD5 5587f0bb980dea4bec19489d79a87f9d
BLAKE2b-256 584cfddfda8f603b4e1fa232c3359a2cbc74b29c4a682103cb42761de4c18503

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