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

Not Generating Model Fields for "Belongs To" Relationships #31

Open
lsnow99 opened this issue May 17, 2020 · 0 comments
Open

Not Generating Model Fields for "Belongs To" Relationships #31

lsnow99 opened this issue May 17, 2020 · 0 comments
Assignees

Comments

@lsnow99
Copy link

lsnow99 commented May 17, 2020

I have a schema and relationship defined as follows:

Table chat_event:
id (bigint)

Table message:

id   (bigint)
id_chat_event   (bigint, fk, uq, nn)

So a chat_event Belongs To a message, at least in the way I've defined my schema. When I run Genna, it outputs a struct for message that includes a reference to ChatEvent like so:

IdChatEventRel *ChatEvent `pg:"fk:id_chat_event"`

However, ChatEvent does not have any reference to message.

This is causing a problem, because I am trying to query using go-pg all chat_events in a conversation, and ideally each chat_event would have a *Message field that is populated. However, ChatEvent structs as generated by genna currently do not seem to contain a *Message field.

The command I am using is:
~/go/bin/genna model -c postgresql://localhost/mydb?sslmode=disable -f -g 9 -o model/schema.go

If you need more details, I may be able to provide them over a private channel, or maybe create a generic example.

Thank you for your work, Genna has been very helpful to my projects.

@dizzyfool dizzyfool self-assigned this Jun 3, 2020
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

2 participants