Thanks, I delete database folder, delete and recreate database on mysql and web2py recreate all tables. Now all is ok! Thanks Fabio
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 >> db.py, 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 >> > -- 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/d/optout.