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

🌱 Omit associations during Create operations #733

Merged
merged 2 commits into from
Jul 26, 2024

Conversation

mansam
Copy link
Collaborator

@mansam mansam commented Jul 18, 2024

When inserting a new record, GORM will also attempt to insert records into tables refered to by many-to-many relationships on the inserted record. This commit attempts to ensure that associations are omitted when inserting records, and then the associations are added to the join tables separately.

Also fixes some spots where the Transaction handler was in the wrong spot in the chain or missing entirely.

Fixes #727

When inserting a new record, GORM will also attempt to
insert records into tables refered to by many-to-many
relationships on the inserted record. This commit
attempts to ensure that associations are omitted
when inserting records, and then the associations
are added to the join tables separately.

Signed-off-by: Sam Lucidi <[email protected]>
@mansam mansam requested a review from jortel July 18, 2024 16:49
@mansam mansam changed the title Omit associations during Create operations 🌱 Omit associations during Create operations Jul 18, 2024
Copy link
Contributor

@jortel jortel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@aufi aufi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Note, we might need test/update export/import CLI (that "nulls" some attributes to avoid circular deps: https://github.com/konveyor/tackle2-hub/blob/main/hack/tool/tackle#L341-L373).

@mansam mansam closed this Jul 26, 2024
@mansam mansam reopened this Jul 26, 2024
@mansam mansam merged commit 65d0910 into konveyor:main Jul 26, 2024
22 of 23 checks passed
jortel added a commit that referenced this pull request Aug 5, 2024
dymurray pushed a commit that referenced this pull request Oct 11, 2024
When inserting a new record, GORM will also attempt to insert records
into tables refered to by many-to-many relationships on the inserted
record. This commit attempts to ensure that associations are omitted
when inserting records, and then the associations are added to the join
tables separately.

Also fixes some spots where the Transaction handler was in the wrong
spot in the chain or missing entirely.

Fixes #727

---------

Signed-off-by: Sam Lucidi <[email protected]>
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.

Application create/update don't update associations consistently.
3 participants