Goodevening, I am trying to migrate from Sqite to MySQL. Unfortunatly when restoring the field in the DB tables i get the following error: <class 'gluon.contrib.pymysql.err.IntegrityError'> (1215, u'Cannot add foreign key constraint') location of issue: Field('Insurance',db.insurance,label=T('Insurance')),
When i look this up in google .... this could be caused by a Field which has the reuirement= Not NULL but has no Default value set. I tested this but not able to get passed the error. *first table with field in db1.py* db.define_table('insurance', Field('Company',requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Company')), Field('Insurance_number','string', requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Insurance Number')), Field('Street_name', requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Street Name')), Field('House_number','string', requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('House Number')), Field('Postal_code','string', requires=IS_NOT_EMPTY(error_message='cannot be empty!'),label=T('Postal Code')), Field('City','string', requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('City')), Field('Region','string', requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Region')), Field('Country','string', requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Country')), Field('Telephone_number','string', requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Telephone Number')), Field('Mobile','string', requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Mobile')), Field('Email','string', requires=IS_EMAIL(error_message='invalid email! Please fill in a correct e-mail address.'), label=T('Email')), auth.signature, format='%(Company)s',fake_migrate=True) *Second table which in a db2.py:* db.define_table('client', Field('Debtor_nr',requires=IS_NOT_EMPTY(error_message='cannot be empty!'), label=T('Debtor number')), Field('Insurance',db.insurance,label=T('Insurance')), --> this is where the first issue takes place Where should i add a default value ? to et this issue fixed Hope you can help me with this Steve -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/8e093bfc-0af8-42de-a260-09447281b183%40googlegroups.com.