Creating relations without Id field
See original GitHub issueMy backend doesn’t return the ids of the relations out of the box.
This should work:
color: this.hasOne(Color, 'color'),
It should fetch the relation from the color.id field.
Current behavior is that it’s simply not working.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:13 (2 by maintainers)
Top Results From Across the Web
One-to-many relationship without column that represent "one"
1. If you don't want to add the groupId to the Address table then yes, you can certainly just create a new table...
Read more >Relationship with a table without unique/primary key
I can't create this relationship because SubWorks.subWorkName is not an unique key (or primary key, it just don't appear in phpMyAdmin) and it ......
Read more >How to create relationships on non id fields is not clear #215
Another solution (at least a partial one) is to add a local id field to relation/immutableRelation decorator. See @esbenp's thread here: #219 — ......
Read more >Help with relationships without using Id... - Microsoft Q&A
Please help on how to form a relationship correctly. I have 2 tables with many fields, one contains users, the other a list...
Read more >Relations (Reference) - Prisma
The scalar authorId field, which is referenced by the @relation attribute. This field does exist in the database - it is the foreign...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, it works! I removed the sportsman_id from the schema, but left the sportsman_id as a foreign key in the model. That way, I can get the associated data from the server and then request it from orm as if it were in the schema. Maybe add a few words about this in the documentation? I think it should be closed
I think this should be in the documentation! It was a bit of pain to find it 🥇