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

Duplication of models when generating code #26

Closed
wborowiecki opened this issue Feb 9, 2023 · 4 comments
Closed

Duplication of models when generating code #26

wborowiecki opened this issue Feb 9, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@wborowiecki
Copy link
Collaborator

In my master table, I have 2 columns that point to the same column, two times 1:1

I defined join as:
{name: RecentPOC, table: NAC_Contacts, joinCardinality: OneToOne, model: Contact, property: RecentPOC, joinTo: NAC_Vendors,
on: [
{name: CN_ContactID, toColumn: VE_RecentPOCID}
]
},
{name: BookingContact, table: NAC_Contacts, joinCardinality: OneToOne, model: Contact, property: BookingContact, joinTo: NAC_Vendors,
on: [
{name: CN_ContactID, toColumn: VE_BookingContactID}
]
}

Model "Contact" will be generated twice and the code will not compile.

@chullybun chullybun added the wontfix This will not be worked on label Feb 9, 2023
@chullybun
Copy link
Collaborator

chullybun commented Feb 9, 2023

Hi @wborowiecki - you will need to have two different models as they are not always guaranteed to be the same, as different columns (with different names) could be selected resulting in different set of properties. From a publishing perspective they will result in same JSON assuming same columns with same names.

Let me know if there are any issues related to the use of the two models.

@wborowiecki
Copy link
Collaborator Author

@chullybun please consider a scenario in which table "Order" has references to table "User" twice: "CreatedById" and "UpdatedById". It would be desired to have a single model for User that is referenced twice.

@chullybun
Copy link
Collaborator

Yeah ok, that makes sense. But developers will need to be cognizant that the definition must be the same. Looking forward to your pull request.

@chullybun chullybun added enhancement New feature or request and removed wontfix This will not be worked on labels Feb 9, 2023
@wborowiecki
Copy link
Collaborator Author

thank you for accepting the pull request, let me close it

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

No branches or pull requests

2 participants