Closed csdrane closed 9 years ago
Since your foreign key name is not users_id
you need to add the foreign key name userid
to has-many
statement.
The reason why you're not getting any data is that the primary key of users is not included in entity-fields
of users
. Korma fetches one-to-many relations with a separate query for each main entity result. If the primary key is not included it doesn't return any child entities. There's already an issue about this: #222
Closing as duplicate.
This probably isn't a bug with Korma but I am a new user and am having trouble querying across tables.
Table schema:
Which I represented in Korma as:
I'm currently focusing on trying to do a query between Users and Tracked-Links.
Sample query:
I'm unclear on why I'm getting that error. I observe that if I add the {foreign key} constraint to the
has-many
statement under the definition of the Users entity that this error goes away. But then the tracked-links returns an empty list when there should be data returned.I'm guessing that something is wrong with the way that I've either defined the table schema or Korma's entity relationships or possibly both. I am not sure though what this might be. Any help is appreciated.