#22424: Default value for TextField
---------------------------------+--------------------------------------
     Reporter:  Nevsky           |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  Migrations       |                  Version:  1.7-beta-1
     Severity:  Release blocker  |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+--------------------------------------

Old description:

> Hi! I start testing Django 1.7beta1. I use MySQL database.
> I add new TextField into my model like that:
>
> {{{
> class Article(models.Model):
>     title = models.CharField(max_length=200)
>     pub_date = models.DateField()
>     text = models.TextField()
>     text2 = models.TextField() #new TextField
> }}}
>
> When I type "python manage.py migrate" I am asked to enter default value.
> But BLOB/TEXT columns can't have a default value and if i will type
> something like 'blabla' then after command "python manage.py
> makemigrations" i will see error. I think it is bug :)

New description:

 Hi! I start testing Django 1.7beta1. I use MySQL database.
 I add new TextField into my model like that:

 {{{
 class Article(models.Model):
     title = models.CharField(max_length=200)
     pub_date = models.DateField()
     text = models.TextField()
     text2 = models.TextField() #new TextField
 }}}

 When I type "python manage.py makemigrations" I am asked to enter default
 value.
 But BLOB/TEXT columns can't have a default value and if i will type
 something like 'blabla' then after command "python manage.py migrate" i
 will see error. I think it is bug :)

--

Comment (by loic84):

 Fixed the name of the commands in the ticket description.

 I originally assumed this was an issue before the migrate step, but it's
 indeed an SQL issue due to one-off defaults, Django uses db defaults for
 these.

 The fix for MySQL is to not provide a default for BLOB/TEXT in the
 SchemaEditor. Although we'll now need to propagate the default value
 manually.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22424#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.e6af334067dc5f442e25d41b458a9d67%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to