Skip to content

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.

5 participants