Problem
Currently there is no way to use an insert query with ignore when duplicate key is found.
Proposed resolution
I think the best way to implement it is the following:
- Update the base insert class with a new method to set a boolean that will enable this functionality.
- Update the MySQL insert class to use
INSERT IGNORE
when the boolean is set. - Update the PostgreSQL insert class to use
INSERT ... ON CONFLICT DO NOTHING
when the boolean is set. This brings the requirement of having version 9.5 or newer. Is this a problem? Could add an extra requirement to this specific functionality. - Update the SQLite insert class to use
INSERT OR IGNORE
when the boolean is set.
Remaining tasks
- Discuss the proposed solution
- Write a patch
- Review
I have also some idea's about duplicate key update solutions, but for now lets first handle this ticket.