forked from farhoodlabs/paperclip
21a1e97a81
Use GREATEST(counter, MAX(issue_number)) + 1 when incrementing the company issue counter. This self-corrects any desync between the companies.issue_counter column and the actual max issues.issue_number, preventing duplicate key violations on the identifier unique index. Fixes #2705