I'm using SQL 2005 and Web2py 1.99.4 

Here's my db.py

db.define_table('customers',
    Field('name', 'string',length=50),
    Field('sapID', 'string', length=10),
    Field('city', 'string',length=50),
    Field('state', 'string', length=2),
    Field('country','string',length=3),
    Field('active','integer'))

db.define_table('contacts',
    Field('customer', 'reference customers'),
    Field('lastname', 'string', length=25),
    Field('firstname', 'string', length=25),
    Field('phone','string',length=15),
    Field('email','string',requires=IS_EMAIL()),
    Field('active','integer'))

I get this message:
<class 'pyodbc.ProgrammingError'> ('42000', "[42000] [Microsoft][ODBC SQL 
Server Driver][SQL Server]Foreign key 'contacts_customer__constraint' 
references invalid table 'customers'. (1767) (SQLExecDirectW); [42000] 
[Microsoft][ODBC SQL Server Driver][SQL Server]Could not create constraint. 
See previous errors. (1750)")

After getting this message, I cannot access the app anymore. I hit 
'refresh' and nothing at all happens. I run a profile on the database, and 
it's not running any queries. The admin side works fine. However, the only 
way to get past this error is to forcibly stop the server and restart it 
again. 

This was on a new database created specifically for web2py and had no data 
or user tables in it at all.

Reply via email to