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

Remove auto-increment primary key when saving as copy #16966

Merged
merged 9 commits into from
Jan 5, 2023
Merged

Conversation

br41nslug
Copy link
Member

@br41nslug br41nslug commented Dec 30, 2022

Description

When saving as copy the code was looking for the is_generated flag in schema which can be false for primary keys. I've updated this check to look for the has_auto_increment flag instead which should always be true for auto-increment IDs.

Fixes #15771
Fixes ENG-179

Type of Change

  • Bugfix
  • Improvement
  • New Feature
  • Refactor / codestyle updates
  • Other, please describe:

Requirements Checklist

  • New / updated tests are included
  • All tests are passing locally
  • Performed a self-review of the submitted code

If adding a new feature:

  • Documentation was added/updated. PR:

@br41nslug br41nslug marked this pull request as draft December 30, 2022 13:02
@br41nslug
Copy link
Member Author

br41nslug commented Dec 30, 2022

I've manually tested this on postgres and mysql against auto-increment IDs, manually entered IDs and Generated UUIDs. Would love to have some unit tests for this too but have not been able to manage that so far.

#15033 is still occurring on mysql.

@br41nslug br41nslug marked this pull request as ready for review January 2, 2023 15:17
Copy link
Contributor

@azrikahar azrikahar left a comment

Choose a reason for hiding this comment

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

I've manually tested this on postgres and mysql against auto-increment IDs, manually entered IDs and Generated UUIDs.

Nice catch to cover uuid special flag as well! 👍

Would love to have some unit tests for this too but have not been able to manage that so far.

Added an attempt for it in a follow up commit. Do feel free to vet the tests as it feels like the structure can still be improved, but it should help catch these scenarios for now. 🤞

app/src/composables/use-item.ts Outdated Show resolved Hide resolved
@br41nslug br41nslug marked this pull request as draft January 3, 2023 11:08
@br41nslug br41nslug marked this pull request as ready for review January 4, 2023 14:34
app/src/components/v-form/v-form.vue Outdated Show resolved Hide resolved
@azrikahar azrikahar merged commit 9f60b0f into main Jan 5, 2023
@azrikahar azrikahar deleted the issue/15771 branch January 5, 2023 11:07
@rijkvanzanten rijkvanzanten added this to the Next Release milestone Jan 11, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Save as copy not working with autoincrement primary key
3 participants