Answer
Answered
What do you mean by "manually"?
In order to create foreign key, just add a reference:
http://support.vertabelo.com/topic/438421-how-to-create-a-reference/
If you want to write some SQL stuff to create a foreign key (without a visual reference) you can use "Additional SQL script" section to do this.
In order to create foreign key, just add a reference:
http://support.vertabelo.com/topic/438421-how-to-create-a-reference/
If you want to write some SQL stuff to create a foreign key (without a visual reference) you can use "Additional SQL script" section to do this.
I seem to be unable to designate an existing column name as the foreign key. I only have luck if I drag the reference line and let Vertabelo create the foreign key column name for me. In my case, I want to capture the way we contacted a customer, be it email, Facebook, twitter etc.
For example table A has the following fields:
• CUSTOMERS
• CONTACT_CODE
• CONTACT_DATE
And table B has the fields:
• CONTACT_CODE
• CONTACT_CODE_DESCRIPTION
I don't seem to be having luck simply trying to edit the reference between the two tables making CONTACT_CODE in table B a foreign key to table A. I keep getting a new field named TABLE_A_CONTACT_CODE_ID.
For example table A has the following fields:
• CUSTOMERS
• CONTACT_CODE
• CONTACT_DATE
And table B has the fields:
• CONTACT_CODE
• CONTACT_CODE_DESCRIPTION
I don't seem to be having luck simply trying to edit the reference between the two tables making CONTACT_CODE in table B a foreign key to table A. I keep getting a new field named TABLE_A_CONTACT_CODE_ID.
Answer
OK, now I understand what's the problem. You can do this in Vertabelo.
Let's say you start from this point:
First, just create a reference from B to A:
Here, we get an autogenerated "B_contact_code" column. Just delete it:
An error is raised because there's no FK column defined in the reference. We just need to fix it. Select a reference and here's what we see:
Just click "X" on the right-hand side to delete this invalid pair of columns:
and then add a valid ones:
Done, we've got what we wanted:
We can also eliminate the need to delete this autogenerated column. It is possible to disable the generation of FK columns. You can do this on "My account" page:
Hope this helps!
Let's say you start from this point:
First, just create a reference from B to A:
Here, we get an autogenerated "B_contact_code" column. Just delete it:
An error is raised because there's no FK column defined in the reference. We just need to fix it. Select a reference and here's what we see:
Just click "X" on the right-hand side to delete this invalid pair of columns:
and then add a valid ones:
Done, we've got what we wanted:
We can also eliminate the need to delete this autogenerated column. It is possible to disable the generation of FK columns. You can do this on "My account" page:
Hope this helps!
Ahh, I was missing the last little step of clicking +Add after selecting my primary and foreign keys from the drop down. I mistakenly thought that would add another row of primary and foreign key. At any rate, that did the trick. Thanks so much!
Customer support service by UserEcho
Let's say you start from this point:
First, just create a reference from B to A:
Here, we get an autogenerated "B_contact_code" column. Just delete it:
An error is raised because there's no FK column defined in the reference. We just need to fix it. Select a reference and here's what we see:
Just click "X" on the right-hand side to delete this invalid pair of columns:
and then add a valid ones:
Done, we've got what we wanted:
We can also eliminate the need to delete this autogenerated column. It is possible to disable the generation of FK columns. You can do this on "My account" page:
Hope this helps!