Kostas Botsas
In anticipation of further improvements in the joins/many-to-many relations model, the reverse link traversing described in https://feedback.xata.io/feature-requests/p/reverse-link-relations can help simplify querying relations.
This upcoming "backwards link access" method using the
<- table.column
notation enables retrieving multiple users and their posts (records from another table which are linking to the current queried users table) in a single request. This feature is available in the REST API, Typescript SDK and UI support coming soon.Kostas Botsas
planned
Alex Francoeur
From Discord: https://discord.com/channels/996791218879086662/1084580138236264539/1084860672124403743
1:M table relationship support
(one product can have multiple images)
(so that I'd only have to do "product.images" in my select part of the query and it would get all the images that are linked to that product)
Rafael Garcia
I'd love to be able to easily fetch N-relationships in a single request, something like
const users = await xata.db.Users.select(["name", "friends.name"]).getMany();
{
"friends": [
{ "name": "John", id: "a", "xata": { "version": 1 }},
{ "name": "Mary", id: "b", "xata": { "version": 1 }},
]
"id": "myid",
"name": "Keanu Reave",
"xata": { "version": 1 }
}
Jake
This would make things much easier and cleaner to work with. Great suggestion.
Kostas Botsas
For 1 to many relations (1:M) it would be helpful to support array of links.
Kostas Botsas
Add support for action triggers in many-to-many relations to make waterfall operations through a link relation. i.e.: when a post record is deleted, remove its like records. (cascade)
Kostas Botsas
Currently, many-to-many relations can be implemented in a "junction" table with two or more columns of link type. Entries in the junction table act as relation definitions across records in different tables, tying together each side of the many-to-many relation.
Xata should support a native method to create many to many relations.
If you have a preferred way in which you would like to see this area addressed, please leave your comments here!