Is this expected behaviour or an issue with my usage? Adapter required for every AS Int Column? #5219
paulfrankallan
started this conversation in
General
Replies: 1 comment
-
I found the answer to my question in the migration guide: "Some previously supported types now require an adapter. Adapters for primitive types are available in the app.cash.sqldelight:primitive-adapters:2.0.2 artifact. e.g. The IntColumnAdapter for doing INTEGER As kotlin.Int conversions." This will mean a large amount of boilerplate added for the app I need to migrate; or I guess I can do it in my data mappers... Could this be added to a future release to be handled for the common types? Int, Float, etc? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a large database to migrate from an older version of sqldelight. It is part of a Kotlin Multiplatform app. I have done most of the leg work but it seems as if in the newer 2.0.2 version I have to add adapters by hand for every single table and column that has "AS Int":
E.g
fun getDatabase(
driverFactory: DriverFactory,
dbName: String,
encryptionKey: String
): Database {
val driver = driverFactory.createDriver(dbName, encryptionKey)
return Database(
driver = driver,
FirstEntityAdapter = FirstEntity.Adapter(
aAdapter = IntColumnAdapter,
bAdapter = IntColumnAdapter,
cAdapter = IntColumnAdapter,
eAdapter = IntColumnAdapter,
fAdapter = IntColumnAdapter,
gAdapter = IntColumnAdapter,
hAdapter = IntColumnAdapter,
iAdapter = IntColumnAdapter,
jAdapter = IntColumnAdapter,
kAdapter = IntColumnAdapter,
lAdapter = IntColumnAdapter).... LOTS more adapters each with lots of IntColumnAdapters.
This will mean a LOT of boiler plate. I'm wondering if I'm missing something.
Is this expected or am I using it wrong?
Beta Was this translation helpful? Give feedback.
All reactions