mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 05:55:51 +01:00
Improve mapping of custom column type.
This commit is contained in:
@@ -2,7 +2,7 @@ package model
|
|||||||
|
|
||||||
import scala.slick.driver.H2Driver.simple._
|
import scala.slick.driver.H2Driver.simple._
|
||||||
|
|
||||||
object Accounts extends Table[Account]("ACCOUNT") with Functions {
|
object Accounts extends Table[Account]("ACCOUNT") {
|
||||||
def userName = column[String]("USER_NAME", O PrimaryKey)
|
def userName = column[String]("USER_NAME", O PrimaryKey)
|
||||||
def mailAddress = column[String]("MAIL_ADDRESS")
|
def mailAddress = column[String]("MAIL_ADDRESS")
|
||||||
def password = column[String]("PASSWORD")
|
def password = column[String]("PASSWORD")
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package model
|
|||||||
|
|
||||||
import scala.slick.driver.H2Driver.simple._
|
import scala.slick.driver.H2Driver.simple._
|
||||||
|
|
||||||
object Activities extends Table[Activity]("ACTIVITY") with BasicTemplate with Functions {
|
object Activities extends Table[Activity]("ACTIVITY") with BasicTemplate {
|
||||||
def activityId = column[Int]("ACTIVITY_ID", O AutoInc)
|
def activityId = column[Int]("ACTIVITY_ID", O AutoInc)
|
||||||
def activityUserName = column[String]("ACTIVITY_USER_NAME")
|
def activityUserName = column[String]("ACTIVITY_USER_NAME")
|
||||||
def activityType = column[String]("ACTIVITY_TYPE")
|
def activityType = column[String]("ACTIVITY_TYPE")
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ object IssueId extends Table[(String, String, Int)]("ISSUE_ID") with IssueTempla
|
|||||||
def byPrimaryKey(owner: String, repository: String) = byRepository(owner, repository)
|
def byPrimaryKey(owner: String, repository: String) = byRepository(owner, repository)
|
||||||
}
|
}
|
||||||
|
|
||||||
object Issues extends Table[Issue]("ISSUE") with IssueTemplate with MilestoneTemplate with Functions {
|
object Issues extends Table[Issue]("ISSUE") with IssueTemplate with MilestoneTemplate {
|
||||||
def openedUserName = column[String]("OPENED_USER_NAME")
|
def openedUserName = column[String]("OPENED_USER_NAME")
|
||||||
def assignedUserName = column[String]("ASSIGNED_USER_NAME")
|
def assignedUserName = column[String]("ASSIGNED_USER_NAME")
|
||||||
def title = column[String]("TITLE")
|
def title = column[String]("TITLE")
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package model
|
|||||||
|
|
||||||
import scala.slick.driver.H2Driver.simple._
|
import scala.slick.driver.H2Driver.simple._
|
||||||
|
|
||||||
object IssueComments extends Table[IssueComment]("ISSUE_COMMENT") with IssueTemplate with Functions {
|
object IssueComments extends Table[IssueComment]("ISSUE_COMMENT") with IssueTemplate {
|
||||||
def commentId = column[Int]("COMMENT_ID", O AutoInc)
|
def commentId = column[Int]("COMMENT_ID", O AutoInc)
|
||||||
def action = column[String]("ACTION")
|
def action = column[String]("ACTION")
|
||||||
def commentedUserName = column[String]("COMMENTED_USER_NAME")
|
def commentedUserName = column[String]("COMMENTED_USER_NAME")
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package model
|
|||||||
|
|
||||||
import scala.slick.driver.H2Driver.simple._
|
import scala.slick.driver.H2Driver.simple._
|
||||||
|
|
||||||
object Milestones extends Table[Milestone]("MILESTONE") with MilestoneTemplate with Functions {
|
object Milestones extends Table[Milestone]("MILESTONE") with MilestoneTemplate {
|
||||||
def title = column[String]("TITLE")
|
def title = column[String]("TITLE")
|
||||||
def description = column[String]("DESCRIPTION")
|
def description = column[String]("DESCRIPTION")
|
||||||
def dueDate = column[java.util.Date]("DUE_DATE")
|
def dueDate = column[java.util.Date]("DUE_DATE")
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package model
|
|||||||
|
|
||||||
import scala.slick.driver.H2Driver.simple._
|
import scala.slick.driver.H2Driver.simple._
|
||||||
|
|
||||||
object Repositories extends Table[Repository]("REPOSITORY") with BasicTemplate with Functions {
|
object Repositories extends Table[Repository]("REPOSITORY") with BasicTemplate {
|
||||||
def isPrivate = column[Boolean]("PRIVATE")
|
def isPrivate = column[Boolean]("PRIVATE")
|
||||||
def description = column[String]("DESCRIPTION")
|
def description = column[String]("DESCRIPTION")
|
||||||
def defaultBranch = column[String]("DEFAULT_BRANCH")
|
def defaultBranch = column[String]("DEFAULT_BRANCH")
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package model
|
package object model {
|
||||||
|
import scala.slick.lifted.MappedTypeMapper
|
||||||
|
|
||||||
import scala.slick.lifted.MappedTypeMapper
|
|
||||||
|
|
||||||
protected[model] trait Functions {
|
|
||||||
// java.util.Date TypeMapper
|
// java.util.Date TypeMapper
|
||||||
implicit val dateTypeMapper = MappedTypeMapper.base[java.util.Date, java.sql.Timestamp](
|
implicit val dateTypeMapper = MappedTypeMapper.base[java.util.Date, java.sql.Timestamp](
|
||||||
d => new java.sql.Timestamp(d.getTime),
|
d => new java.sql.Timestamp(d.getTime),
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import model._
|
import model._
|
||||||
import Accounts._
|
|
||||||
import scala.slick.driver.H2Driver.simple._
|
import scala.slick.driver.H2Driver.simple._
|
||||||
import Database.threadLocalSession
|
import Database.threadLocalSession
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import model._
|
import model._
|
||||||
import Activities._
|
|
||||||
import scala.slick.driver.H2Driver.simple._
|
import scala.slick.driver.H2Driver.simple._
|
||||||
import Database.threadLocalSession
|
import Database.threadLocalSession
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import scala.slick.jdbc.{StaticQuery => Q}
|
|||||||
import Q.interpolation
|
import Q.interpolation
|
||||||
|
|
||||||
import model._
|
import model._
|
||||||
import Issues._
|
|
||||||
import util.Implicits._
|
import util.Implicits._
|
||||||
|
|
||||||
trait IssuesService {
|
trait IssuesService {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import scala.slick.driver.H2Driver.simple._
|
|||||||
import Database.threadLocalSession
|
import Database.threadLocalSession
|
||||||
|
|
||||||
import model._
|
import model._
|
||||||
import Milestones._
|
|
||||||
|
|
||||||
trait MilestonesService {
|
trait MilestonesService {
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import model._
|
import model._
|
||||||
import Repositories._
|
|
||||||
import scala.slick.driver.H2Driver.simple._
|
import scala.slick.driver.H2Driver.simple._
|
||||||
import Database.threadLocalSession
|
import Database.threadLocalSession
|
||||||
import util.JGitUtil
|
import util.JGitUtil
|
||||||
|
|||||||
Reference in New Issue
Block a user