The error is when trying to create the table for the first time or
migrating ?
That 1452 is quite a famous error: when you establish a FK (to the same
table or to another) if there is only one discordant data, the error pops
up.
So, if your table has some records in it, and you're migrating it, please
double check those ids for referential integrity.
On Wednesday, June 20, 2012 4:23:30 PM UTC+2, Fernando J wrote:
>
> I have an error with mysql (about reference):
>
> *"1452, u'Cannot add or update a child row"*
>
> The table is created with
>
> *db.define_table('navbar',
> Field("title", "string"),
> Field("url", "string", requires=IS_EMPTY_OR(IS_URL())),
> Field("c", label="Controller"),
> Field("f", label="Function"),
> Field("args", label="Arguments"),
> Field("sortable", "integer"),
> Field("parent_id","reference navbar"),
> 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),
> Field('registration_key',default='',
> writable=False,readable=False),
> Field('reset_password_key',default='',
> writable=False,readable=False),
> Field('registration_id',default='',
> writable=False,readable=False),
> format='%(title)s',
> migrate=False)*
>
> Any suggestion, please?
>
> Thanks in Advance!
>