Modify

Ticket #368 (closed enhancement: fixed)

Opened 4 years ago

Last modified 4 years ago

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

comment:1 Changed 4 years ago by andrew

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone set to 0.7

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].

View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.