What's everyone using for SQL/local databases for ...
# multiplatform
g
What's everyone using for SQL/local databases for multiplatform right now? I've done jvm/desktop plenty of times and always used Exposed, but now I'm branching into iOS and I see that unfortunately Exposed doesn't have kotlin/native support for iOS yet. What does everyone use for desktop/android/ios right now? It seems the leading two options are sqldelight or realm
sqldelight 4
d
For my newly started project, I'm using SQLite. But we're in the early stages of development, so I'm interested in what others are using since there may be something better/easier.
g
If you aren't targeting iOS or web and are staying in the JVM, I'd recommend Exposed it's worked great for me. I'm just now going outside the JVM so I need to find a good replacement.
d
Our project's targeting iOS and Android, while reserving the option of producing a desktop release.
s
I'm currently using Realm for iOS and Android project. I've used SQLDelight also in the past and haven't had any real problem other than personal preference with Realm
d
@Sebastien Leclerc Lavallee How difficult is it to move from SQLDelight to Realm? Was it relatively straightforward?
s
@Darryl Pierce I didn't have any problem as my local storage is just for offline so I put my store to scrap 😅 But it shouldn't be that hard... you can create a migration service that read from SQL and write to Realm. With a check stored in the defaults to make sure the migration does not happens multiple times. I've done it in the past.
👍 1
g
Anyone who's familiar with SQLDelight, how do you handle the database creation? I followed their docs online and ran into the "table already exists" on the second run because the documentation for JVM instructs you to just call the schema create method every time. I guess I was a little surprised its mentioned nowhere in the docs or the library doesn't auto-check this.
Currently I'm just doing a check if the .db file exists and if not, call schema create. But I just started using sqldelight so I'm not sure if this is the best method. What are you guys doing? I assume I'm just missing something super obvious.
s
IIRC, we don't have to worry about DB file creation or something else. The framework does it
j
You might check out my recently-released NoSQL database library, Kotbase, a KMP library for Couchbase Lite. It's a flexible schema, JSON document database, which supports SQL, key/value, and FTS querying. Depending on your use case, it could be a good option.
s
@Garret Yoder you can have a look at KampKit, it uses SQLDelight https://github.com/touchlab/KaMPKit