Budibase / budibase

Low code platform for building business apps and workflows in minutes. Supports PostgreSQL, MySQL, MariaDB, MSSQL, MongoDB, Rest API, Docker, K8s, and more 🚀
https://budibase.com
Other
22.44k stars 1.55k forks source link

Implicit casts on foreign keys with different column types #6000

Closed mshiner closed 2 years ago

mshiner commented 2 years ago

Describe the feature request When setting up relationships the foreign keys do not resolve if the column types do not match. The specific use case was where the master table had a primamry key of type bigint but in the detail table the linking column was defined as type integer.

In postgreSQL the catalogs handle this and the FKs resolve gracefully with no problem.

As per the comment @melohagan in this discussion it would be great if implicit and/or explicit casts could be handled

Screenshots See discussion for more information.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity.

mshiner commented 2 years ago

Any movement on this ? Its a big issue for to use Budibase against our uzERP database

Martyn

melohagan commented 2 years ago

I've changed this to a bug. As it turns out, the problem is that Knex returns a string for bigint types (probably because the max number size in JavaScript isn't large enough), and returns a number of smallint / int types.

When it comes to the relationship match, because it's a precise equality, it is not picking up the relationship, e.g. 1 !== '1'

I'll get a PR out for the fix.

mshiner commented 2 years ago

Mel

Great stuff - we've been doing some stuff with BB but TBH this was a major block for us. Good news that there may be a fix on the horizon.

Cheers M