Thanks, I delete database folder, delete and recreate database on mysql and 
web2py recreate all tables.
Now all is ok!

Il giorno lunedì 10 ottobre 2016 16:36:22 UTC+2, Marlysson Silva ha scritto:
> If your data are tests ,you could delete databases folder or the 
> migrations file , and restart server to forget some references to user 
> table.
> Em segunda-feira, 10 de outubro de 2016 11:13:22 UTC-3, Fabio Ceccarani 
> escreveu:
>> Hi, 
>> I have this problem: a table have a field that is a reference to id of 
>> auth_users.
>> BEFORE it was:
>> db.define_table('courses',
>>     Field('id_user',db.users),
>>     ...
>> NOW is:
>> db.define_table('courses',
>>     Field('id_user',db.auth_user),
>>     ...
>> Now the table 'users' is n more used.
>> The problem is that if I insert new courses record the app faults with 
>> this error:
>> <class 'gluon.contrib.pymysql.err.IntegrityError'> (1452, u'Cannot add or 
>> update a child row: a foreign key constraint fails (`course`.`courses`, 
>> CONSTRAINT `courses_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `users` 
>> (`id`) ON DELETE CASCADE)')
>> In query is present 'users' table that is no more used nowhere (I 
>> searched it in all project file!). If the user is present in users table 
>> the record in courses is created.
>> Auth_user have extra field:
>> auth.settings.extra_fields['auth_user']= [
>>    Field('address'),
>>    Field('city'),
>>    ...
>> I read all post about migrate, fake_migrate, etc, but for me there is a 
>> problem with migration. For example if I delete a table that is declared in 
>>, it is NOT recreated (i tried all combination in the world of 
>> migrate, fake_migrate, etc!!!).
>> It could be a mysql permission/users/other problem?
>> Thanks.
>> Fabio

- (Documentation)
- (Source code)
- (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 
For more options, visit

Reply via email to