Modify ↓
Ticket #368 (closed enhancement: fixed)
South keeps default values for one-off values when adding a NOT-NULL column
| Reported by: | Timo | Owned by: | andrew |
|---|---|---|---|
| Priority: | major | Milestone: | 0.7 |
| Component: | migrations | Version: | 0.7-pre |
| Keywords: | Cc: |
Description
After adding a NOT-NULL column to a model without a default value, South asks me what to do. If I just want to have a one-off value for existing data in the database, South generates following migration entry:
# Adding field 'Adopter.last_name'
db.add_column('southdemo_adopter', 'last_name', self.gf('django.db.models.fields.CharField')(default='', max_length=50))
But more comfortable would be:
# Adding field 'Adopter.last_name'
db.add_column('southdemo_adopter', 'last_name', self.gf('django.db.models.fields.CharField')(default='', max_length=50), keep_default=False)
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

In fact, you never want keep_default to be on, since that's not how Django does things, and South aims to be as similar to Django as possible.
Fixed in [8ee701cb2279].