I've looked around but cannot seem to find how in the world to 'insert if not exists' or 'insert on conflict' using the Exposed SQL framework for Kotlin. I am currently writing raw SQL statements and executing them as is. I don't think I can avoid that for some cases, but I would much rather use the framework if possible. I don't see any options for either DSL or DAO syntaxs.
Edit:
For anyone that may come across this, Tapac's comment worked for me.
Use Table.insertIgnore() for 'insert if not exists', and an example for upsert exists at https://github.com/JetBrains/Exposed/wiki/FAQ#q-is-upsert-supported.
You can try to use Table.insertIgnore for 'insert if not exists' and upsert (github.com/JetBrains/Exposed/wiki/FAQ#q-is-upsert-supported) for 'insert on conflict' .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With