mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 23:15:49 +01:00
Add Scaladoc.
This commit is contained in:
@@ -10,12 +10,22 @@ import org.slf4j.LoggerFactory
|
|||||||
|
|
||||||
object AutoUpdate {
|
object AutoUpdate {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version of GitBucket
|
||||||
|
*
|
||||||
|
* @param majorVersion the major version
|
||||||
|
* @param minorVersion the minor version
|
||||||
|
*/
|
||||||
case class Version(majorVersion: Int, minorVersion: Int){
|
case class Version(majorVersion: Int, minorVersion: Int){
|
||||||
|
|
||||||
val logger = LoggerFactory.getLogger(classOf[Version])
|
val logger = LoggerFactory.getLogger(classOf[Version])
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute update/MAJOR_MINOR.sql to update schema to this version.
|
||||||
|
* If corresponding SQL file does not exist, this method do nothing.
|
||||||
|
*/
|
||||||
def update(conn: Connection): Unit = {
|
def update(conn: Connection): Unit = {
|
||||||
val sqlPath = "update/%d.%d.sq".format(majorVersion, minorVersion)
|
val sqlPath = "update/%d_%d.sq".format(majorVersion, minorVersion)
|
||||||
val in = Thread.currentThread.getContextClassLoader.getResourceAsStream(sqlPath)
|
val in = Thread.currentThread.getContextClassLoader.getResourceAsStream(sqlPath)
|
||||||
if(in != null){
|
if(in != null){
|
||||||
val sql = IOUtils.toString(in)
|
val sql = IOUtils.toString(in)
|
||||||
@@ -29,6 +39,9 @@ object AutoUpdate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MAJOR.MINOR
|
||||||
|
*/
|
||||||
val versionString = "%d.%d".format(majorVersion, minorVersion)
|
val versionString = "%d.%d".format(majorVersion, minorVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user