Closed AdamVig closed 7 years ago
On insert, the validation should check only against other items with the same barcode.
On update, the validation should compare against items with the same barcode but not the current rental.
The trigger code for calling the insert validation procedure:
call validateRentalNoConflict(new.organizationID, new.barcode, new.startDate, new.endDate)
Instead of using a single stored procedure called by both the BEFORE INSERT and BEFORE UPDATE hooks, I had to write slightly different triggers for each of them.
BEFORE INSERT
BEFORE UPDATE
On insert, the validation should check only against other items with the same barcode.
On update, the validation should compare against items with the same barcode but not the current rental.
The trigger code for calling the insert validation procedure: