Add upsert Method
Description:
Introduce the upsert method to enable updating an existing record or inserting a new one if it does not exist, combining the functionalities of update and insert operations.
Objective:
- Implement the
upsert method that accepts parameters to identify the record and the data to update or insert.
- Ensure the method performs the operation atomically.
- Maintain data integrity during the operation.
Acceptance Criteria:
- Calling
upsert({ where: { id: 1 }, update: { ... }, data: { ... } }) updates the existing record.
- Calling
upsert({ where: { id: 999 }, update: { ... }, data: { ... } }) inserts a new record when no match is found.
- Documentation and usage examples are included.
- Automated tests cover both update and insert scenarios.
Add
upsertMethodDescription:
Introduce the
upsertmethod to enable updating an existing record or inserting a new one if it does not exist, combining the functionalities of update and insert operations.Objective:
upsertmethod that accepts parameters to identify the record and the data to update or insert.Acceptance Criteria:
upsert({ where: { id: 1 }, update: { ... }, data: { ... } })updates the existing record.upsert({ where: { id: 999 }, update: { ... }, data: { ... } })inserts a new record when no match is found.