Deduplicate logic across controllers, auth, and schema fixes
All checks were successful
build-and-deploy / build-deploy (push) Successful in 33s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 33s
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package com.android.trisolarisserver.config
|
||||
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.boot.ApplicationArguments
|
||||
import org.springframework.boot.ApplicationRunner
|
||||
import org.springframework.jdbc.core.JdbcTemplate
|
||||
|
||||
abstract class PostgresSchemaFix(
|
||||
private val jdbcTemplate: JdbcTemplate
|
||||
) : ApplicationRunner {
|
||||
|
||||
protected val logger = LoggerFactory.getLogger(this::class.java)
|
||||
|
||||
override fun run(args: ApplicationArguments) {
|
||||
val version = jdbcTemplate.queryForObject("select version()", String::class.java) ?: return
|
||||
if (!version.contains("PostgreSQL", ignoreCase = true)) {
|
||||
return
|
||||
}
|
||||
runPostgres(jdbcTemplate)
|
||||
}
|
||||
|
||||
protected abstract fun runPostgres(jdbcTemplate: JdbcTemplate)
|
||||
}
|
||||
Reference in New Issue
Block a user