I’m considering using SQLDelight in a (multiplatfo...
# squarelibraries
a
I’m considering using SQLDelight in a (multiplatform) project to store some read-only JSON documents. I was planning on implementing `ColumnAdapter`s that use
kotlinx.serialization
to serialize/deserialize an actual class from a String column I’m trying to determine how to handle changes to the JSON document’s schema (which is just a change in the
@Serializable data class
). In most of those cases, I’d be fine with dropping the old data and repopulating it next time I fetch from the server. I could write a
.sqm
file that drops all rows in the tables containing impacted documents, but I’m foreseeing situations where someone updates the data class without writing a migration. Since the sqlite schema would still just have the row as a String, I’m assuming that SQLDelight’s migration verifications would still pass. Is there a way to ignore/drop data that doesn’t deserialize properly in my
ColumnAdapter
? Should I just be making all of my types nullable?
p
Either you can cover it with tests or you handle it in your column adapter and for example catch serialization exceptions and return some default value