What do folks use for a Kotlin type-safe SQL frame...
# spring
What do folks use for a Kotlin type-safe SQL framework w/ Spring Boot and schema migration? I tried using JOOQ but hit issues w/ it not being compatible with Liquibase's YAML files and the Postgres JSONB data type. Thought about using SqlDelight but it doesn't have Liquibase's nice DB schema management for rollbacks. Exposed has an open issue on schema migration and sounds like it's still not quite ready for prime time. I'm using plain old JDBCTemplate which feels a bit retro because it's just a thin layer over prepared statements...though it is nice that it has @Transactional support in Spring 🙂
Flyway and Exposed. No integration between the two so I have to write the migrations manually
How do you keep them from getting out of sync? There's an Exposed issue that mentions this and there didn't seem to be a good answer...
how should that integration with migrations work?
Spring r2dbc + obevo, where we run the obevo schema migration deployment to an embedded postgres server in our repository tests to validate our schemas and code against them. R2dbc is pretty basic, and could be more type safe, but works for the majority of our use cases which aren't too complex. I'm sure you can do something similar with flyway too. We use r2dbc because we use spring webflux
@kenkyee integration tests. In practise it's slightly more work than using a tool that auto generates the migrations, but I've done this for years and never had any operational stability incident
I’m using plain old JDBCTemplate
With the kotlin extensions I find it quite usable, and it’s my preferred approach lately. I use it together with flyway on startuP + @SpringBootTest or +@JdbcTest I haven’t found an ORM mapper that doesn’t bite me in some ways, and I’ve tried Spring Data (JPA and JDBC) jOOQ, Exposed, JDBI
From those, JDBI is the one I like the most as it’s the thinner.