#5725: Inspectdb makes too long CharFields
-------------------------------------+-------------------------------------
     Reporter:  anonymous            |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Core (Management     |                  Version:  master
  commands)                          |               Resolution:  fixed
     Severity:  Normal               |             Triage Stage:  Ready for
     Keywords:  introspection mysql  |  checkin
  inspectdb                          |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by mark0978):

 Looks like this one is back in 1.4.2

 A similar problem happens with mysql 5.5 where the size is 3x greater than
 that specified, given the SQL:

 CREATE TABLE `primaryfields` (
   `fpost` int(11) NOT NULL,
   `index1911` char(36) DEFAULT NULL,
   `ssn` char(11) DEFAULT NULL,
   `middleinitial` char(1) DEFAULT NULL,
   `firstname` char(30) DEFAULT NULL,
   `lastname` char(30) DEFAULT NULL,
   `employeeid` char(10) DEFAULT NULL,
   PRIMARY KEY (`fpost`),
   CONSTRAINT `primaryfields_ibfk_1` FOREIGN KEY (`fpost`) REFERENCES
 `filenames` (`fpost`)
 ) ENGINE=InnoDB DEFAULT CHARSET='''latin1''' |

 You get the Python:

 class Primaryfields(models.Model):
     fpost = models.ForeignKey(Filenames, primary_key=True,
 db_column='fpost')
     index1911 = models.CharField(max_length=108, blank=True)
     ssn = models.CharField(max_length=33, blank=True)
     middleinitial = models.CharField(max_length=3, blank=True)
     firstname = models.CharField(max_length=90, blank=True)
     lastname = models.CharField(max_length=90, blank=True)
     employeeid = models.CharField(max_length=30, blank=True)
     class Meta:
         db_table = u'primaryfields'

-- 
Ticket URL: <https://code.djangoproject.com/ticket/5725#comment:14>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to