Hello friends

There are a couple of legacy tables.
I try to create a reference between them.

= 1 ================================== 
db.define_table('m_dsc_cards',
    Field('cardid','string',notnull=True,unique=True),
    primarykey=['cardid'],
)

db.define_table('m_dsc_clients',
    Field('cn','string'),
    Field('cardid','reference m_dsc_cards'),
)

<class 'pyodbc.ProgrammingError'> ('42000', "[42000] [FreeTDS][SQL 
Server]Column 'm_dsc_cards.cardid' is not the same data type as referencing 
column 'm_dsc_clients.cardid' in foreign key 
'm_dsc_clients_cardid__constraint'. (1778) (SQLExecDirectW)")



= 2 ==================================
db.define_table('m_dsc_cards',
    Field('cardid','string',notnull=True,unique=True),
    primarykey=['cardid'],
)

db.define_table('m_dsc_clients',
    Field('cn','string'),
    Field('cardid','reference m_dsc_cards.cardid'),
)

<class 'pyodbc.ProgrammingError'> ('42000', "[42000] [FreeTDS][SQL 
Server]Foreign key 'm_dsc_clients_cardid__constraint' references invalid 
table 'm_dsc_cards.cardid'. (1767) (SQLExecDirectW)")



= 3 ==================================
db.define_table('m_dsc_cards',
    Field('cardid','string',notnull=True,unique=True),
    primarykey=['cardid'],
)

db.define_table('m_dsc_clients',
    Field('cn','string'),
    Field('cardid','reference m_dsc_cards.cardid'),
    primarykey=['cn'],
)

<type 'exceptions.TypeError'> argument of type 'bool' is not iterable


= 4 ================================== 
db.define_table('m_dsc_cards',
    Field('cardid','string',notnull=True,unique=True),
    primarykey=['cardid'],
)

db.define_table('m_dsc_clients',
    Field('cn','string'),
    Field('cardid','reference m_dsc_cards'),
    primarykey=['cn'],
)

Wow! no exception!
But... field has created with wrong type, INT instead of VARCHAR :(


-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to