Hello! im an android dev that has only ever used sqldelight with sqlite. but im trying my hand at ktor to write an api for a side project app. So I want to use sqldelight but with postgres. I have it working (which is cool) but im not really sure of my impl. Can I get a sanity check on the db connection code? I'm mostly just confused on whether or not I should be using this Hikari thing (never heard of it before)
You need to store the database version and conditionally create or migrate the schema
jw
04/10/2024, 9:33 PM
Or rely on an external schema management system
c
Colton Idle
04/10/2024, 9:34 PM
oh cool. I'll look that up then. but the hikari stuff seems good? thats what i was initially worried about, but good call on the create/migrate.
I think Android typically handles that so I don't think ive really thought about that. wonder if theres a standard here to store the db version/migrate
l
leonhardt
04/19/2024, 1:55 PM
@Colton Idle on the server I always recommend Flyway. We use Hikari for managing database connections but that isn't going to manage migrations.
I don't know much about sqldelight in android but on the server for us it looks like:
• Name all the sqm migration files according to the standard Flyway expected scheme
V1__create_some_table.sqm
(note the double underscore)
• configure sqldelight to produce valid sql migrations
• configure flyway to consume/run them
we use the gradle plugin to run the migrations in local development, and containerize them to run as a job for running in deployed cloud environments.
leonhardt
04/19/2024, 1:55 PM
I'm curious, did you find a solution along those lines or something else?
c
Colton Idle
04/24/2024, 2:55 AM
i haven't really looked into it too much after this post. its like #8 on my todo list. so hopefully ill get to it soon!