prisma / prisma

Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB
https://www.prisma.io
Apache License 2.0
38.91k stars 1.52k forks source link

Support new relation load strategy for MariaDB (`relationJoins` preview feature) #23346

Open janpio opened 6 months ago

janpio commented 6 months ago

In versions 5.7.0 and 5.10.0 we released support for a new relation load strategy for PostgreSQL and MySQL as part of the relationJoins preview feature:

Although they usually overlap, this currently does not include MariaDB via the mysql datasource provider.

Unfortunately MariaDB does not support correlated subqueries, the method we use for this new relation load strategy for MySQL. (It also does not supports lateral joins, the method we use for PostgreSQL.) We would need to implement a completely different approach for MariaDB.

This issue is to track demand and use cases for implementing this new relation load strategy for MariaDB.

⚠️ Please upvote the issue by leaving a πŸ‘ reaction. (Please do not comment with +1 or similar. Only "upvotes" on the issue itself will be taken into account, and comments without actual content will be hidden.)

stouch commented 1 month ago

Really expecting this to be resolved.

Gonna look obvious, but for the moment, as for the issue of "0000-00-00" datetime (null dates in old MariaDB versions), when I need to make JOINs, I create my own queries using $queryRaw :

const myRows = await this.prisma.$queryRaw<{anyColumn: number, otherColumn: string}[]>`
        SELECT anyColumn, otherColumn
          FROM yourTable
          JOIN anotherTable ON anotherTable.columnId = yourTable.someColumnId
          WHERE yourCondition = 'something'
`;

πŸ˜