is it possible for a join table to have one of the relations reference a composite key?
i have the following:
1. contacts table
- userId // this references the user's id per clerk (otherwise, this would really be basically a join table)
- contactId // this references the contact's clerk user id
- pk is composite of the aforementioned ids
so if i want all contacts, i can just select from here filtering on userid, and then fill in the contact data later on from clerk
2. transactions table
- id, pk
- payerId // this is the userId, or the person who paid, referencing clerkId and
- whole bunch of other stuff regarding the transaction
3. join table
so that i can grab every contact involved in a transaction, i have a table to join the aforementioned
i think i need relations as follows
contacts -> many transactions
transactions -> many contacts
join table
one -> contact
one -> transaction
the issue i'm running into is that the contact table is using a composite key, and so i don't know what to reference in the join table relation here. it should be the combination of both, but drizzle doesn't seem to let me pass multiple args here and it seems to expect one
does this model of schemas make sense or am i misunderstanding something? or is there some level of docs i'm missing out on
0 Replies