Hi there :wave: I recently got the (wild) idea of ...
# room
s
Hi there 👋 I recently got the (wild) idea of using Room (KMP) as an ORM over SQLite on the server with Ktor, since it can be used on any JVM target (as well as native Linux). Are there any particular drawbacks to this? (aside from the maturity of the multiplatform version) It's enjoyable to use on Android, and could probably make dealing with the DB a little easier server-side as well.
In addition, running SQLite reliably on the server requires some configuration changes to SQLite. See: https://kerkour.com/sqlite-for-servers Are these configurable using the current drivers?
One more thing: there's a restriction on references between entity classes that makes sense for mobile use-cases. Could there be an option (in the future) to relax this restriction for server-side uses (assuming that server usage is a thing that's even meant to be supported).
d
re the configuration for SQLite on Server, indeed you can execute those pragmas in the
TL:DR
section of the blog post to configure the database. Interestingly out of them Room already sets
journal_mode
,
synchronous
,
foreign_keys
, and
temp_store
to those values, its the
cache_size
and
busy_timeout
that need to be set. Room does set a
busy_timeout
but its a lower number (
3000
). Additionally, Room's connection pool is also 4 readers and one writer as mentioned in the blog.
As for the entity classes restrictions, can you elaborate on what does restrictions are?
s
That's interesting! Didn't know Room already had optimized SQLite defaults. As for the restriction I talked about, I was referring to this: https://developer.android.com/training/data-storage/room/referencing-data#understand-no-object-references It's logical for mobile devices, but as explained in these docs, it may be useful to have this work on the server. It's just a convenience thing, as Room is already pretty capable as-is and the same can be achieved with a little manual code.