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

How to load/associate with composite primary keys #560

Open
jdwyant8 opened this issue May 22, 2020 · 0 comments
Open

How to load/associate with composite primary keys #560

jdwyant8 opened this issue May 22, 2020 · 0 comments

Comments

@jdwyant8
Copy link

jdwyant8 commented May 22, 2020

Hello,

I've seen that fizz handles compound keys, is there any examples of how gobuffalo eager loads through those keys?

For example, I have the following:
Coordinates (lat/lon/{id/order}) - {id/order} being the composite key
-(53.3, -119.6, 0, "aaa", 1)
-(54.3, -120.6, 0, "aaa", 2)
-(52.3, -119.6, 0, "aaa", 3)
-(43.3, -119.6, 0, "aab", 1)
-(42.3, -149.6, 0, "aab", 2)
-(24.3, -119.6, 0, "aab", 3)

Buildings (name/coordinates)
-("weirdly large building", "aaa")
-("freakishly large building", "aab")

I assume when creating coordinates, I have to make the first one and then manually copy the UUID to the subsequent ones, and manually place that ID into buildings?
How does "belongs_to" and "has_one" work with a composite primary key like this?
Will eager loading on buildings work in pulling the coordinates?

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

No branches or pull requests

1 participant