adonisjs / lucid

AdonisJS SQL ORM. Supports PostgreSQL, MySQL, MSSQL, Redshift, SQLite and many more
https://lucid.adonisjs.com/
MIT License
1.08k stars 195 forks source link

Relationship with different types of column #1043

Closed alexandre-freret closed 4 months ago

alexandre-freret commented 4 months ago

Package version

21.1.0

Describe the bug

Hello,

I have a problem when i used relationship with 2 differents types of columns. The database used is not mine. I recreate 2 tables to explain the problem.

Example : Table teams:

Table users:

Capture d’écran 2024-07-19 à 15 26 19

In the teams table, the id_varchar has a space at the end, and it's the problem, when i preload the relationship with the id_char it's works, but when i preload with id_varchar it's doesn't works. When i execute the query like SELECT * from `teams` where `id_varchar` in ('01', '02') it's works.

Do you have any idea ? There is a repo with my example code, with the sql too : https://github.com/alexandre-freret/adonis-example

Thanks

Reproduction repo

https://github.com/alexandre-freret/adonis-example

thetutlage commented 4 months ago

This is not possible at the Lucid level and we might never support it. Sorry, the datatypes have to be the same