Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

many2many, joinForeignKey, JoinReferences support #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

addshore
Copy link

Before this change, a field that defined both many2many and foreignKey would always be detected as foreignKey incorrectly. This will now be detected correctly.

In cases of a many2many reference joinForeignKey and JoinReferences will now also be used to get the field names rather than inventing them.

Before this change, a field that defined both many2many and foreignKey would always be detected as foreignKey incorrectly.
This will now be detected correctly.

In cases of a many2many reference joinForeignKey and JoinReferences will now also be used to get the field names rather than inventing them.
@addshore addshore mentioned this pull request Aug 24, 2023
@survivorbat
Copy link
Owner

Hey addshore, good stuff! Could you please update the unit-tests as well to verify whether this functionality works and add a few test cases? Afterwards I'll review the changes and merge them to master for v1.0.0 :)

@addshore
Copy link
Author

Started a WIP test, which actually goes slightly further than my usage of the library (the test has custom IDs for relations).

The query its running is

no such column: id
�[0m�[33m[0.052ms] �[34;1m[rows:0]�[0m SELECT * FROM `resource` WHERE id IN (SELECT resource_id_j FROM `middles` WHERE end_id_j IN (SELECT id FROM `end` WHERE `value` = "InfraNL"))

Which is wrong as every reference to just id should be something else.
I'm fairly new to form, so wonder if you can more easily spot my issue?

@survivorbat
Copy link
Owner

Hey addshore! Sorry for the late response, it's a busy month.

I haven't gotten a chance to run it, it seems that the code doesn't respect the custom column name you defined. My implementation is rather primitive of course, perhaps a test specifically for the many2many AND foreignkey would be a good start?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants