Not sure what the problem is but list:reference does work with mysql.
Are you sure the table does not exist already?

On Dec 30, 10:25 pm, Thomas Dall'Agnese <[email protected]>
wrote:
> Hi,
>
> After having errors in PostgreSQL, I moved to MySQL and also got errors.
> With MySQL, I can't create some tables (but some tables worked!).
>
> Error:
>
> Traceback (most recent call last):
>   File "/home/dotcloud/current/gluon/restricted.py", line 204, in restricted
>     exec ccode in environment
>   File 
> "/home/dotcloud/rsync-1325304927060/applications/myapp/models/db_wizard.py" , 
> line 54, in <module>
>     migrate=settings.migrate)
>   File "/home/dotcloud/current/gluon/dal.py", line 5097, in define_table
>     polymodel=polymodel)
>   File "/home/dotcloud/current/gluon/dal.py", line 705, in create_table
>     self.create_sequence_and_triggers(query,table)
>   File "/home/dotcloud/current/gluon/dal.py", line 1348, in 
> create_sequence_and_triggers
>     self.execute(query)
>   File "/home/dotcloud/current/gluon/dal.py", line 1359, in execute
>     return self.log_execute(*a, **b)
>   File "/home/dotcloud/current/gluon/dal.py", line 1353, in log_execute
>     ret = self.cursor.execute(*a, **b)
>   File "/home/dotcloud/current/gluon/contrib/pymysql/cursors.py", line 108, 
> in execute
>     self.errorhandler(self, exc, value)
>   File "/home/dotcloud/current/gluon/contrib/pymysql/connections.py", line 
> 184, in defaulterrorhandler
>     raise errorclass, errorvalue
> InternalError: (1005, u"Can't create table 'mysql.sub_comment' (errno: 150)")
>
> My sub_comment table is defined as follow:
> db.define_table('sub_comment',
>     Field('sub', type='reference sub',
>           label=T('Sub')),
>     Field('user', type='reference auth_user',
>           label=T('User')),
>     Field('date_added', type='datetime',
>           label=T('Date Added')),
>     Field('error_types', type='list:reference error_type',
>           label=T('Error Type')),
>     Field('balises', type='list:reference balise',
>           label=T('Balise')),
>     Field('content', type='text', notnull=True, required=True,
>           label=T('Content')),
>     auth.signature,
>     format='%(content)s',
>     migrate=settings.migrate)
>
> And the referenced tables are already created by web2py (worked)
> Maybe "list:" doesn't work with MySQL?
>
> Best regards,
>
> Thomas

Reply via email to