Just wanted to chime in on this. For me, I had to add a "length=255" to all my "unique=True" fields, even after adding length=255 for the "string" fields.
On Wednesday, October 9, 2013 11:46:48 AM UTC-7, Niphlod wrote: > > sorry for being late. This is from web2py's 2.6.0 changelog. > > Attention MySQL users: The length of string fields changed from 255 to 512 > bytes. If you have migrations enabled this will trigger a large migration. > To prevent it, first set migrate_enabled=False, upgrade, check everything > is ok, then add length=255 to your string Fields, then re-enable migrations > with migrate_enabled=True if needed. > > tl;dr: remember to ALWAYS set length= for strings. > > tl;dr n.2 : Mysql has huge issues. One of them is that you can't index a > too large column. > > > On Wednesday, October 9, 2013 9:25:51 AM UTC+2, Gwayne aka Mike Veltman > wrote: >> >> >> >> I found it. >> >> >> >> It was in db.py >> >> >> >> db.define_table('frame', >> >> >> >> Field('framename', type='string', >> >> # #unique=True, <-------------------------------------------------------- >> the problem. Is it a bug ? >> >> label=T('Framename')), >> >> Field('description', type='string', >> >> label=T('Description')), >> >> Field('netboot', type='string',default="None", >> >> label=T('Netboot information')), >> >> Field('ip', type='string', >> >> #unique=True, >> >> label=T('IP Address')), >> >> Field('servermodel', type='string',default="p6", >> >> label=T('Server model')), >> >> Field('serial', type='string',default="None", >> >> label=T('Serial Number')), >> >> Field('lvname', type='string',default="FRAMEx", >> >> label=T('Frame extension for storage logical volumes')), >> >> Field('framestaterecord_ID', type='integer', >> >> label=T('Frame State record ID')), >> >> Field('created_on','datetime',default=request.now, >> >> label=T('Created On'),writable=False,readable=False), >> >> Field('modified_on','datetime',default=request.now, >> >> label=T('Modified On'),writable=False,readable=False, >> >> update=request.now), >> >> format='%(framename)s', >> >> migrate=True) >> >> >> >> >> >> >> >> On Tuesday 08 October 2013 13:41:31 Mike Veltman wrote: >> >> Ok, I am now fighting with it for two days and it drives me crazy. >> >> My gut feeling says mysql 5.1 --> mysql 5.5 upgrade is the cause. Am I >> right ? And how do I solve it. :-) >> >> >> >> Error ticket for "adeploy" >> >> Ticket ID >> >> 192.168.2.106.2013-10-08.12-46-19.24f3f1a5-d637-4522-965b-fed4958115ed >> >> <class '_mysql_exceptions.OperationalError'> (1071, 'Specified key was >> too long; max key length is 767 bytes') >> >> Version >> >> web2py™ >> >> Version 2.7.2-stable+timestamp.2013.10.07.13.52.24 >> >> Traceback >> >> >> >> 1. >> 2. >> 3. >> 4. >> 5. >> 6. >> 7. >> 8. >> 9. >> 10. >> 11. >> 12. >> 13. >> 14. >> 15. >> 16. >> 17. >> 18. >> 19. >> 20. >> 21. >> 22. >> >> Traceback (most recent call last): >> File "/srv/web-apps/web2py/gluon/restricted.py", line 217, in restricted >> exec ccode in environment >> File "/srv/web-apps/web2py/applications/adeploy/compiled/models/db.py", line >> 178, in <module> >> File "/srv/web-apps/web2py/gluon/dal.py", line 7911, in define_table >> table = self.lazy_define_table(tablename,*fields,**args) >> File "/srv/web-apps/web2py/gluon/dal.py", line 7948, in lazy_define_table >> polymodel=polymodel) >> File "/srv/web-apps/web2py/gluon/dal.py", line 1029, in create_table >> fake_migrate=fake_migrate) >> File "/srv/web-apps/web2py/gluon/dal.py", line 1136, in migrate_table >> self.execute(sub_query) >> File "/srv/web-apps/web2py/gluon/dal.py", line 1836, in execute >> return self.log_execute(*a, **b) >> File "/srv/web-apps/web2py/gluon/dal.py", line 1830, in log_execute >> ret = self.cursor.execute(command, *a[1:], **b) >> File "/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py", line 173, in >> execute >> self.errorhandler(self, exc, value) >> File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 36, >> in defaulterrorhandler >> raise errorclass, errorvalue >> OperationalError: (1071, 'Specified key was too long; max key length is >> 767 bytes') >> >> In file: /srv/web-apps/web2py/applications/adeploy/compiled/models/db.pyc >> >> 1. >> >> <code object <module> at 0x168c468, file >> "/srv/web-apps/web2py/applications/adeploy/compiled/models/db.py", line >> 28> >> >> >> >> >> >> >> >> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.