0
Answered

reference types

connery 5 years ago updated by Worldwa Sahu 1 month ago 3

The example shows this (right) type of reference, but I can only find how to change 1 side of a reference and the other side will always be the one you see on the left here.
How do you change the other half of a reference?
+1
Under review
I don't quite get what you want to achieve. This reference is one-to-many self-reference. If you want to have a many-to-many reference, you need to add a junction table.

I'm still new to most of this but I was wondering how to get the (0 reference?) from the example, the ----o--  because all other references (also another self reference) becomes a one reference ------|-- .
And there doesn't seem to be anything diferent in the properties of each reference
+1
Answered
OK, I think I know what you mean. This is the difference between mandatory and not mandatory reference.
Take a look:



In this example, a record in the "self_reference_example" MUST have a value in "mandatory_id" column (cannot be NULL), and doesn't have to have "not_mandatory_id" set (can be NULL).
This difference is very important in this case, because it's a self reference. When you insert the very first record - what "mandatory_id" will you set? You don't have any values there so far. The only possibility would be to set the same value as "id". Most commonly this is not the desired structure, that's why Vertabelo shows a warning in case of mandatory self-reference.

I hope this helps.

By the way, I spotted an error in our example model. The column "parent_category_id" should be marked as "nullable". We'll fix it soon.