{"id":37751100,"url":"https://github.com/xplor/django-add-default-value-postgresql","last_synced_at":"2026-01-16T14:22:10.560Z","repository":{"id":45046136,"uuid":"244955055","full_name":"xplor/django-add-default-value-postgresql","owner":"xplor","description":"Add default field value in Django migrations for PostgreSQL","archived":false,"fork":false,"pushed_at":"2025-04-07T19:48:16.000Z","size":45,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":23,"default_branch":"main","last_synced_at":"2025-08-28T05:18:44.263Z","etag":null,"topics":["django","postgresql"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xplor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-04T16:55:22.000Z","updated_at":"2025-04-07T19:47:52.000Z","dependencies_parsed_at":"2024-11-18T04:35:28.480Z","dependency_job_id":null,"html_url":"https://github.com/xplor/django-add-default-value-postgresql","commit_stats":null,"previous_names":["mariana-tek/django-add-default-value-postgresql"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/xplor/django-add-default-value-postgresql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xplor%2Fdjango-add-default-value-postgresql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xplor%2Fdjango-add-default-value-postgresql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xplor%2Fdjango-add-default-value-postgresql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xplor%2Fdjango-add-default-value-postgresql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xplor","download_url":"https://codeload.github.com/xplor/django-add-default-value-postgresql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xplor%2Fdjango-add-default-value-postgresql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28479393,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","postgresql"],"created_at":"2026-01-16T14:22:09.874Z","updated_at":"2026-01-16T14:22:10.556Z","avatar_url":"https://github.com/xplor.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django Add Default Value for PostgreSQL\n\nDjango Migration Operation that can be used to transfer a field's default value\nto the database scheme.\n\nBased on [django-add-default-value](https://github.com/3YOURMIND/django-add-default-value/) by [3YOURMIND](https://github.com/3YOURMIND). This variant drops support for other databases, specifically the Azure ODBC driver which does not support current versions of Django.\n\n[![CI](https://github.com/Mariana-Tek/django-add-default-value-postgresql/workflows/Python%20package/badge.svg)](https://github.com/Mariana-Tek/django-add-default-value-postgresql/actions?query=workflow%3A%22Python+package%22)\n[![PyPi](https://img.shields.io/pypi/v/django-add-default-value-postgresql.svg?branch=master)](https://pypi.org/project/django-add-default-value-postgresql/)\n\n## Supported Versions of Python and Django\n\n- Python 3.10, 3.11, and 3.12\n- Django 4.0, 4.1, 4.2, 5.0, 5.1, and 5.2\n\n## Installation\n\n`uv add django-add-default-value-postgresql`\n\nYou can then use `AddDefaultValue` in your migration file to transfer the default\nvalues to your database. Afterwards, it's just the usual `./manage.py migrate`.\n\n## Usage\n\nAdd this manually to an autogenerated Migration that adds a new field:\n\n    AddDefaultValue(\n        model_name='my_model',\n        name='my_field',\n        value='my_default'\n    )\n\n### Example\n\nGiven the following migration:\n\n    operations = [\n        migrations.AddField(\n            field=models.CharField(default='my_default', max_length=255),\n            model_name='my_model',\n            name='my_field',\n        ),\n    ]\n\nModify the migration to add a default value:\n\n    +from django_add_default_value import AddDefaultValue\n    +\n     operations = [\n         migrations.AddField(\n             field=models.CharField(default='my_default', max_length=255),\n             model_name='my_model',\n             name='my_field',\n         ),\n    +    AddDefaultValue(\n    +        model_name='my_model',\n    +        name='my_field',\n    +        value='my_default'\n    +    )\n     ]\n\nIf you check `python manage.py sqlmigrate [app name] [migration]`,\nyou will see that the default value now gets set.\n\n## Testing\n\nYou can test against multiple versions of Django using `tox`. To test across Python versions, use pyenv to run `tox` under each version.\n\n## License\n\ndjango-add-default-value-postgresql is released under the Apache 2.0 License, based on [django-add-default-value](https://github.com/3YOURMIND/django-add-default-value/) by [3YOURMIND](https://github.com/3YOURMIND) which is also released under the Apache 2.0 License.\n\n### Changes from original source\n\n- removed MySQL-related code\n- removed MSSQL-related code\n- added allow_migrate_model check on database_forwards and database_backwards\n- added support for Python 3.10, 3.11, and 3.12, dropped support for \u003c3.10\n- added support for Django 4.0, 4.1, 4.2, 5.0, 5.1, and 5.2, dropped support for \u003c4.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxplor%2Fdjango-add-default-value-postgresql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxplor%2Fdjango-add-default-value-postgresql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxplor%2Fdjango-add-default-value-postgresql/lists"}