Skip to content

Instantly share code, notes, and snippets.

@mike-seger
Last active August 22, 2024 17:37
Show Gist options
  • Select an option

  • Save mike-seger/162564b0e8992ea0055c43c8b121b97b to your computer and use it in GitHub Desktop.

Select an option

Save mike-seger/162564b0e8992ea0055c43c8b121b97b to your computer and use it in GitHub Desktop.
LiquibaseConfiguration
import liquibase.integration.spring.SpringLiquibase
import liquibase.database.Database
import liquibase.database.DatabaseFactory
import liquibase.database.AbstractJdbcDatabase
import liquibase.resource.ResourceAccessor
import java.sql.Connection
import javax.sql.DataSource
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.beans.factory.annotation.Value
@Configuration
class LiquibaseConfig {
@Value("\${spring.liquibase.change-log}")
private lateinit var changeLog: String
@Bean
fun liquibase(dataSource: DataSource): SpringLiquibase {
return object : SpringLiquibase() {
override fun createDatabase(connection: Connection?, resourceAccessor: ResourceAccessor?): Database {
val database = DatabaseFactory.getInstance()
.findCorrectDatabaseImplementation(JdbcConnection(connection))
if (database is AbstractJdbcDatabase) {
database.isCaseSensitive = false // Set case sensitivity here
}
return database
}
}.apply {
this.dataSource = dataSource
this.changeLog = [email protected]
this.isShouldRun = true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment