Hi, I was wondering, if I want to create a referen...
# exposed
y
Hi, I was wondering, if I want to create a reference between one table and multiple other tables. is this possible? For example: Lets say I have an Uploads table and I want Users table to have uploads and Posts table to have uploads as well. Can this be done with exposed? I mean with the
referencedOn
and
referrersOn
functions
t
What kind of relation do you want to setup? Users -> many uploads Posts -> many uploads ?
y
yes
but referencing by just ID is not enough since the two tables ids can collide, so I was thinking of adding a type column but I can’t reference by two columns just one
t
Maybe it's worth to add UserToUploads and PostToUpload tables and link them with
via
? https://github.com/JetBrains/Exposed/wiki/DAO#many-to-many-reference
y
I can do that, but then If I want to add something else that has uploads then I will have to create a connecting table for it
t
The other way is to define something like:
👍 1