skillfed

django-add-default-value

This django Migration Operation can be used to transfer a fields default value to the database scheme.

django-add-default-value v0.10.0 326.4K downloads/30d#7,577 on PyPI138
Permissive license Apache-2.0 DORMANT released

What it is and what it does

django-add-default-value is a Django migration operation that lets you set default values at the database level when adding new fields to existing tables. Instead of relying on Django's ORM default (which only applies to new rows created through Django), this operation runs a SQL ALTER TABLE statement to set the default in the schema itself, ensuring backward compatibility and consistency across all database access patterns.

You use it by adding an AddDefaultValue operation to your migration file after the AddField operation. It supports MySQL, PostgreSQL, CockroachDB, and MSSQL. The package has been dormant since early 2022, so while it remains functional for the Django versions it was tested against, there is no active maintenance or support for newer Django releases.

Use it for:

  • Adding a required field with a default value to an existing Django model without breaking existing code or database queries
  • Ensuring database-level consistency when a field default must apply to all rows, not just those created through Django ORM
  • Migrating legacy schemas where the database itself needs to enforce default values independent of application logic
  • Handling backward compatibility in production deployments where you need to add a column with a safe default without downtime

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a Django migration operation to set database-level default values for fields, enabling backward-compatible schema changes when adding new columns with defaults to existing tables.

Yes, if you are on Django 1.11–3.2 and need to set database-level defaults during migrations. No, if you are on a newer Django version—the package is dormant and has not been tested or updated for Django 4.0+. Check your Django version against the classifiers before installing.

Install

django-add-default-value on PyPI

pip

pip install django-add-default-value

uv

uv add django-add-default-value

poetry

poetry add django-add-default-value

Installing django-add-default-value

Before you install

Low install friction with a single Django dependency. Maintenance is dormant—last release was 2022-02-02 and no commits since 2024-03-20—so expect no active support or updates for newer Django versions.

License in practice

Released under Apache 2.0 (permissive), so you can use, modify, and distribute it freely in commercial and private projects without restriction.

Quickstart

pip install django-add-default-value

In your migration file:
from django_add_default_value import AddDefaultValue

operations = [
    migrations.AddField(...),
    AddDefaultValue(
        model_name='my_model',
        name='my_field',
        value='my_default'
    )
]

Verify before relying

  • Whether the package works with Django versions released after 2022 (classifiers list only up to 3.2)
  • Current test coverage and whether MSSQL support has been validated since the 'currently not tested' note

Package facts

License Apache-2.0 (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — Django
Maintenance dormant — 1,654 days since the last release
Last repo commit
First released
Downloads 326,397/month — #7,577 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_add_default_value-0.10.0-py3-none-any.whl

Keywords: django, migration, default, database backward compatibility

Development Status :: 3 - AlphaEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 1.11Framework :: Django :: 2.0Framework :: Django :: 2.1Framework :: Django :: 2.2Framework :: Django :: 3.0Framework :: Django :: 3.1Framework :: Django :: 3.2Intended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Tags

django migration default valuedatabase schema default columndjango add field with defaultbackward compatible django migrationsdjango field default to database
django-migrationsschema-management

More Python Modules packages