Has Many [Sep 01]

:raising_hand_man: Eric asked

trying to setup a conventional one to many relationship between two tables, in the linkToAnotherRecord ui i see only has Many Many To Many options and nothing for One to Many. is there a different way I should define this type of relatinship? In the documentation is see that there is a foreign key value, but it doesn’t seem to appear for my when i create fields.

I saw there had been changes in the most recent versions, and updated to latest (0.92.4) and still don’t see that datatype.

this github issue seems to show the exact design flow, but in all recent tags of the source this datatype is commented out.

:person_tipping_hand: o1lab replied

Has Many is One to Many

:raising_hand_man: Eric replied

well conceptually, but it also bakes in exclusivity from the perspective of the parent.

:raising_hand_man: Eric replied

e.g. if i define one to many in the current interface, if i assign a link value from the parent, it removes that from other peers. so not sure if it’s just a bug/quirk in the current implementation.

:raising_hand_man: Eric replied



:raising_hand_man: Russell replied

A Device can have many current_cal, but a current_cal can only have one Device. In the current_cal table there should be a column for Devices_id which only holds an integer ID. So if you assign “this is a yaml 1” to Device ID 2, it will no longer be assigned to Device ID 1. So it seems like it’s working as expected, or do you want many-to-many, or did you want one-to-many in the opposite direction?

:raising_hand_man: Eric replied

The desire is to have a conventional foreign key, in the context desribed here, yes running in the opposite direction… a foreign key from one table to another would not generally impart or enforce any exclusivity (across) the members of the parent table.

:raising_hand_man: Eric replied

e.g. one should be able to (re) use the foreign keys values; many parent entities having the same foreign key value.

:raising_hand_man: Eric replied

from looking at the docs it appeared that this exists, but maybe rolled into the linked

:raising_hand_man: Eric replied

<@531097245194387457> it looks like we have the same question/need.

Autogenerated from discord

Join NocoDB’s community