mysql2sqlite icon indicating copy to clipboard operation
mysql2sqlite copied to clipboard

Support for conversion from MySQL "INSERT... ON DUPLICATE KEY UPDATE" to new SQLite "INSERT... ON CONFLICT DO UPDATE" (UPSERT)

Open senyszrm opened this issue 6 years ago • 1 comments

I'm working on a project which uses your MySQL to SQLite conversion script as our application currently uses sqlite but we plan on switching to MySQL in the future, so we like having our database cross compatible to handle that future switch. While working on a new feature, I was considering using a "INSERT... ON DUPLICATE KEY UPDATE" query in MySQL to handle a case where we want UPSERT functionality, and the script ran into an error here. I imagine the reason is that the SQLite UPSERT functionality is new since SQLite version 3.24.0 (2018-06-04) and this was never implemented since then.

On the surface, it doesn't seem like too much work to convert this over because the syntax seems pretty similar, but I haven't really looked into the script to figure out how much work adding this functionality would be, or if you were currently thinking about adding it. Here is the link for sqlite describing the new UPSERT functionality:

https://www.sqlite.org/lang_UPSERT.html

senyszrm avatar Feb 20 '19 14:02 senyszrm

@senyszrm you're right, I didn't notice UPSERT was added. Supporting it sounds like a good idea. Unfortunately I can get back to this first in about 2 months. Until then I can help with smaller tasks, but this one would need testing and I can't currently find enough time for that. Feel free to contribute code and I'll take a look :wink:.

dumblob avatar Feb 20 '19 18:02 dumblob