Skip to content

[FEATURE]: Make it possible to include relations based on array column #4988

@mintydev789

Description

@mintydev789

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

It would be a very useful feature if it were possible to include schema relations based on the values of an array column. This would make one-to-many relationships very simple to add, not even requiring a table for the sole purpose of joining. Here's an example of what this could look like with rqbv2:

export const relations = defineRelations({ persons, results }, (r) => ({
  results: {
    persons: r.many.persons({
      from: r.results.personIds, // array of numbers
      to: r.persons.personId, // number field
    }),
  },
}));

I tried using this code, but when I actually try to include this relation in a query, I get this error: No operator matches the given name and argument types. You might need to add explicit type casts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions