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

save should be idempotent #6149

Merged
merged 1 commit into from
Mar 23, 2023
Merged

save should be idempotent #6149

merged 1 commit into from
Mar 23, 2023

Conversation

black-06
Copy link
Contributor

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

Save should be idempotent. #6139 #6134

When call Save twice with the same object, Save should not raise an error.

User Case Description

var company Company
DB.Frist(&company)

DB.Save(&company)
DB.Save(&company) // should not create new record or rasise an error.
DB.Save(&company) // should not create new record or rasise an error.

@monoflash
Copy link

MySQL MariaDB database, same problem.
Save() does not work from version 1.24.6 to latest.
The latest version in which Save() works is v1.24.5.

@jhemmmm
Copy link

jhemmmm commented Jun 17, 2023

I stopped using save as they keep having race data problems. The save should only update the column that has been changed.

@black-06
Copy link
Contributor Author

I stopped using save as they keep having race data problems. The save should only update the column that has been changed.

Not, See Save doc

Save will save all fields when performing the Updating SQL

@jhemmmm
Copy link

jhemmmm commented Jun 19, 2023

I'm aware.

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.

None yet

5 participants