You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add onDuplicateKeyUpdate() support to Insert class #7
Feature Request
MySQL/MariaDB supports INSERT ... ON DUPLICATE KEY UPDATE for upsert operations, but Atlas doesn't currently provide a way to generate this syntax.
Proposed API
Add an onDuplicateKeyUpdate() method to the Insert class:
/**
* Add ON DUPLICATE KEY UPDATE clause to INSERT statement
*
* @param array $columns Column names and values to update on duplicate key
* @return static
*/
public function onDuplicateKeyUpdate(array $columns): static
Use Case
This prevents race condition errors when multiple processes might insert the same record simultaneously -- the first succeeds with INSERT, subsequent ones UPDATE instead of throwing duplicate key errors.
Activity