testcontainers-java
testcontainers-java copied to clipboard
Add r2dbc:tc TC_INITSCRIPT
Please add a way to specify a TC_INITSCRIPT
with the R2DBC automagic stuff r2dbc:tc
(like exists on the jdbc:tc
stuff). Thanks!
Friendly note to those who are looking for an alternative: use ResourceDatabasePopulator
@Profile("test")
@Configuration
open class TestContainerPopulationConfig(
private val connectionFactory: ConnectionFactory
) : InitializingBean {
override fun afterPropertiesSet() {
runBlocking {
val databasePopulator = ResourceDatabasePopulator()
databasePopulator.addScripts(
ClassPathResource("db/db-schema.sql"),
)
databasePopulator.populate(connectionFactory).awaitFirstOrNull()
}
}
}
although it would still be nice if TC_INITSCRIPT works for R2DBC anyways 😃