Last active
August 22, 2024 17:37
-
-
Save mike-seger/162564b0e8992ea0055c43c8b121b97b to your computer and use it in GitHub Desktop.
LiquibaseConfiguration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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