Issue 99 in django-evolution: the auto_now attribute for a date field generates error when the field is "not null"

7 views
Skip to first unread message

codesite...@google.com

unread,
Feb 6, 2009, 5:00:11 PM2/6/09
to django-evolu...@googlegroups.com
Status: New
Owner: ----

New issue 99 by imosquer: the auto_now attribute for a date field generates
error when the field is "not null"
http://code.google.com/p/django-evolution/issues/detail?id=99

What steps will reproduce the problem?
1. generate a model with a date field as such:
last_saved = models.DateTimeField(auto_now=True)

2. run python manage.py evolve --hint --execute

What is the expected output? What do you see instead?
this should add a column to the table however I receive the following error:
Cannot use hinted evolution: AddField or ChangeField mutation for
'Application.last_saved1' in 'myapps' requires user-specified initial value.

What version of the product are you using? On what operating system? What
database backend?
version = trunk, OS = Mac OSX, DB = MySQL

I understand why the result is as such. however django allows these fields
to be created with no default initial value, so django_evolution seems to
be conflicting with django itself.


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

codesite...@google.com

unread,
Oct 23, 2009, 12:09:28 PM10/23/09
to django-evolu...@googlegroups.com

Comment #1 on issue 99 by Maris.Nartiss: the auto_now attribute for a date
field generates error when the field is "not null"
http://code.google.com/p/django-evolution/issues/detail?id=99

This is not a bug and it doesn't conflict with other Django
parts. "user-specified
initial value" is required for existing fields as existing database entries
can not
have NULL as column value due to "not NULL" propery. When Django creates
new fields,
there are NO records and thus "not NULL" is statisfied. Solution - just set
some
inital value (e.g. now) and remove it after evolution.

Reply all
Reply to author
Forward
0 new messages