-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't save all fields of a model when bumping the update date (#7450)
Currently, there are a lot of places where changing one object requires updating the `updated_date` field on other objects. Usually, the `.save` method is used for this purpose, which results in a generic SQL `UPDATE` query that replaces the values in all columns. Introduce and use a specialized method that only changes the date. This provides the following advantages: * Prevents the date updates from overwriting updates to other fields that may happen at the same time. * Possibly makes the updates more efficient due to fewer columns being updated (I have no data on this, though). * Makes it easier to recognize the purpose of the query when analyzing logs/live statistics. * Makes the purpose of the code more obvious. Additionally, update `__save_job_handler`, where we don't want to save _just_ the date, but we still only need to save two fields.
- Loading branch information
Showing
8 changed files
with
49 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters