mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-05-06 11:46:03 +02:00
Add PostgreSQL support
This commit is contained in:
@@ -38,6 +38,7 @@ libraryDependencies ++= Seq(
|
||||
"com.novell.ldap" % "jldap" % "2009-10-07",
|
||||
"com.h2database" % "h2" % "1.4.190",
|
||||
"mysql" % "mysql-connector-java" % "5.1.38",
|
||||
"org.postgresql" % "postgresql" % "9.4.1208",
|
||||
"ch.qos.logback" % "logback-classic" % "1.1.1",
|
||||
"com.zaxxer" % "HikariCP" % "2.4.5",
|
||||
"com.typesafe" % "config" % "1.3.0",
|
||||
|
||||
5
src/main/resources/database_postgresql.conf
Normal file
5
src/main/resources/database_postgresql.conf
Normal file
@@ -0,0 +1,5 @@
|
||||
db {
|
||||
url = "jdbc:postgresql://192.168.99.100:32768/gitbucket"
|
||||
user = "test"
|
||||
password = "test"
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import com.typesafe.config.ConfigFactory
|
||||
import java.io.File
|
||||
import Directory._
|
||||
import liquibase.database.AbstractJdbcDatabase
|
||||
import liquibase.database.core.{MySQLDatabase, H2Database}
|
||||
import liquibase.database.core.{PostgresDatabase, MySQLDatabase, H2Database}
|
||||
import org.apache.commons.io.FileUtils
|
||||
|
||||
object DatabaseConfig {
|
||||
@@ -50,6 +50,8 @@ object DatabaseType {
|
||||
H2
|
||||
} else if(url.indexOf("mysql") >= 0){
|
||||
MySQL
|
||||
} else if(url.indexOf("postgresql") >= 0){
|
||||
PostgreSQL
|
||||
} else {
|
||||
throw new IllegalArgumentException(s"${url} is not supported.")
|
||||
}
|
||||
@@ -66,4 +68,10 @@ object DatabaseType {
|
||||
val slickDriver = slick.driver.MySQLDriver
|
||||
val liquiDriver = new MySQLDatabase()
|
||||
}
|
||||
|
||||
object PostgreSQL extends DatabaseType {
|
||||
val jdbcDriver = "org.postgresql.Driver"
|
||||
val slickDriver = slick.driver.PostgresDriver
|
||||
val liquiDriver = new PostgresDatabase()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user