Hi all,
I'm interested on implementing a many-to-many relation for kind of graph
structure, i.e., there are a set of nodes, with some on-way connections
between them. Part of my model is:
db.define_table('bookpage',\
Field('content', 'text'),\
Field('image', 'upload'),\
Field('from_book', db.book),\
Field('modified_on', 'datetime', default=request.now))
db.bookpage.content.requires = IS_NOT_EMPTY()
db.bookpage.from_book.requires = IS_NOT_EMPTY()
db.bookpage.modified_on.writable = False
db.define_table('page_link',\
Field('in_page', db.bookpage),\
Field('out_page', db.bookpage),\
Field('text'))
But it is raising the error:
<class 'gluon.contrib.pymysql.err.InternalError'> (1005, u"Can't create
table 'rincon.page_link' (errno: 150)")Traceback
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
Traceback (most recent call last):
File "/srv/www/cub3.net/public_html/web2py/gluon/restricted.py", line 205, in
restricted
exec ccode in environment
File
"/srv/www/cub3.net/public_html/web2py/applications/rincon/models/tables.py"
<https://web2py.cub3.net/admin/default/edit/rincon/models/tables.py>, line 36,
in <module>
Field('text'))
File "/srv/www/cub3.net/public_html/web2py/gluon/dal.py", line 6320, in
define_table
polymodel=polymodel)
File "/srv/www/cub3.net/public_html/web2py/gluon/dal.py", line 719, in
create_table
self.create_sequence_and_triggers(query,table)
File "/srv/www/cub3.net/public_html/web2py/gluon/dal.py", line 1381, in
create_sequence_and_triggers
self.execute(query)
File "/srv/www/cub3.net/public_html/web2py/gluon/dal.py", line 1392, in
execute
return self.log_execute(*a, **b)
File "/srv/www/cub3.net/public_html/web2py/gluon/dal.py", line 1386, in
log_execute
ret = self.cursor.execute(*a, **b)
File "/srv/www/cub3.net/public_html/web2py/gluon/contrib/pymysql/cursors.py",
line 108, in execute
self.errorhandler(self, exc, value)
File
"/srv/www/cub3.net/public_html/web2py/gluon/contrib/pymysql/connections.py",
line 184, in defaulterrorhandler
raise errorclass, errorvalue
InternalError: (1005, u"Can't create table 'rincon.page_link' (errno: 150)")
I am not able to see what is going wrong... any clue?
--