[odb-users] Create a foreign key constrain to a unique column of
b.kountouriotis at gmail.com
Mon Sep 11 04:34:29 EDT 2017
I'm trying to map my tables to odb and can't seem to find out how to
create a foreign key constraint towards a unique column (but not the
primary key) of another table.
For example assume I have a table 'Ticket' with 'AI_PK' as the primary
key (auto increment INT) and a 'TicketID' as a unique CHAR(36). Now,
in my Log table, how can I create a foreign key column LogTicketID
pointing to the Ticket.TicketID?
(I understand that this is not the most efficient, but this is what
we've got currently)
I've set this relationship as:
#pragma db not_null
By default, ODB maps LogTicketID to AI_PK, AI_PK being the primary
key. Is there any way I can instruct it to point to another column
(marked as UNIQUE)?
More information about the odb-users