mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 21:45:50 +01:00
Add the condition function by the primary key.
This commit is contained in:
@@ -5,6 +5,8 @@ import scala.slick.driver.H2Driver.simple._
|
|||||||
object Collaborators extends Table[Collaborator]("COLLABORATOR") with BasicTemplate {
|
object Collaborators extends Table[Collaborator]("COLLABORATOR") with BasicTemplate {
|
||||||
def collaboratorName = column[String]("COLLABORATOR_NAME")
|
def collaboratorName = column[String]("COLLABORATOR_NAME")
|
||||||
def * = userName ~ repositoryName ~ collaboratorName <> (Collaborator, Collaborator.unapply _)
|
def * = userName ~ repositoryName ~ collaboratorName <> (Collaborator, Collaborator.unapply _)
|
||||||
|
|
||||||
|
def byPrimaryKey = byRepository _
|
||||||
}
|
}
|
||||||
|
|
||||||
case class Collaborator(
|
case class Collaborator(
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import scala.slick.driver.H2Driver.simple._
|
|||||||
|
|
||||||
object IssueId extends Table[(String, String, Int)]("ISSUE_ID") with IssueTemplate {
|
object IssueId extends Table[(String, String, Int)]("ISSUE_ID") with IssueTemplate {
|
||||||
def * = userName ~ repositoryName ~ issueId
|
def * = userName ~ repositoryName ~ issueId
|
||||||
|
def byPrimaryKey = byRepository _
|
||||||
}
|
}
|
||||||
|
|
||||||
object Issues extends Table[Issue]("ISSUE") with IssueTemplate with Functions {
|
object Issues extends Table[Issue]("ISSUE") with IssueTemplate with Functions {
|
||||||
@@ -16,6 +17,8 @@ object Issues extends Table[Issue]("ISSUE") with IssueTemplate with Functions {
|
|||||||
def registeredDate = column[java.util.Date]("REGISTERED_DATE")
|
def registeredDate = column[java.util.Date]("REGISTERED_DATE")
|
||||||
def updatedDate = column[java.util.Date]("UPDATED_DATE")
|
def updatedDate = column[java.util.Date]("UPDATED_DATE")
|
||||||
def * = userName ~ repositoryName ~ issueId ~ openedUserName ~ milestoneId.? ~ assignedUserName.? ~ title ~ content.? ~ closed ~ registeredDate ~ updatedDate <> (Issue, Issue.unapply _)
|
def * = userName ~ repositoryName ~ issueId ~ openedUserName ~ milestoneId.? ~ assignedUserName.? ~ title ~ content.? ~ closed ~ registeredDate ~ updatedDate <> (Issue, Issue.unapply _)
|
||||||
|
|
||||||
|
def byPrimaryKey = byIssue _
|
||||||
}
|
}
|
||||||
|
|
||||||
case class Issue(
|
case class Issue(
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ object IssueComments extends Table[IssueComment]("ISSUE_COMMENT") with IssueTemp
|
|||||||
def * = userName ~ repositoryName ~ issueId ~ commentId ~ commentedUserName ~ content ~ registeredDate ~ updatedDate <> (IssueComment, IssueComment.unapply _)
|
def * = userName ~ repositoryName ~ issueId ~ commentId ~ commentedUserName ~ content ~ registeredDate ~ updatedDate <> (IssueComment, IssueComment.unapply _)
|
||||||
|
|
||||||
def autoInc = userName ~ repositoryName ~ issueId ~ commentedUserName ~ content ~ registeredDate ~ updatedDate returning commentId
|
def autoInc = userName ~ repositoryName ~ issueId ~ commentedUserName ~ content ~ registeredDate ~ updatedDate returning commentId
|
||||||
|
def byPrimaryKey(commentId: Int) = this.commentId is commentId.bind
|
||||||
}
|
}
|
||||||
|
|
||||||
case class IssueComment(
|
case class IssueComment(
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import scala.slick.driver.H2Driver.simple._
|
|||||||
|
|
||||||
object IssueLabels extends Table[IssueLabel]("ISSUE_LABEL") with IssueTemplate with LabelTemplate {
|
object IssueLabels extends Table[IssueLabel]("ISSUE_LABEL") with IssueTemplate with LabelTemplate {
|
||||||
def * = userName ~ repositoryName ~ issueId ~ labelId <> (IssueLabel, IssueLabel.unapply _)
|
def * = userName ~ repositoryName ~ issueId ~ labelId <> (IssueLabel, IssueLabel.unapply _)
|
||||||
|
def byPrimaryKey(owner: String, repository: String, issueId: Int, labelId: Int) =
|
||||||
|
byIssue(owner, repository, issueId) && (this.labelId is labelId.bind)
|
||||||
}
|
}
|
||||||
|
|
||||||
case class IssueLabel(
|
case class IssueLabel(
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ object Labels extends Table[Label]("LABEL") with LabelTemplate {
|
|||||||
def * = userName ~ repositoryName ~ labelId ~ labelName ~ color <> (Label, Label.unapply _)
|
def * = userName ~ repositoryName ~ labelId ~ labelName ~ color <> (Label, Label.unapply _)
|
||||||
|
|
||||||
def ins = userName ~ repositoryName ~ labelName ~ color
|
def ins = userName ~ repositoryName ~ labelName ~ color
|
||||||
|
def byPrimaryKey = byLabel _
|
||||||
}
|
}
|
||||||
|
|
||||||
case class Label(
|
case class Label(
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ object Milestones extends Table[Milestone]("MILESTONE") with BasicTemplate with
|
|||||||
def * = userName ~ repositoryName ~ milestoneId ~ title ~ description.? ~ dueDate.? ~ closedDate.? <> (Milestone, Milestone.unapply _)
|
def * = userName ~ repositoryName ~ milestoneId ~ title ~ description.? ~ dueDate.? ~ closedDate.? <> (Milestone, Milestone.unapply _)
|
||||||
|
|
||||||
def autoInc = userName ~ repositoryName ~ title ~ description.? ~ dueDate.? ~ closedDate.? returning milestoneId
|
def autoInc = userName ~ repositoryName ~ title ~ description.? ~ dueDate.? ~ closedDate.? returning milestoneId
|
||||||
|
// TODO create a template?
|
||||||
|
def byPrimaryKey(owner: String, repository: String, milestoneId: Int) =
|
||||||
|
byRepository(owner, repository) && (this.milestoneId is milestoneId.bind)
|
||||||
}
|
}
|
||||||
|
|
||||||
case class Milestone(
|
case class Milestone(
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ object Repositories extends Table[Repository]("REPOSITORY") with BasicTemplate w
|
|||||||
def updatedDate = column[java.util.Date]("UPDATED_DATE")
|
def updatedDate = column[java.util.Date]("UPDATED_DATE")
|
||||||
def lastActivityDate = column[java.util.Date]("LAST_ACTIVITY_DATE")
|
def lastActivityDate = column[java.util.Date]("LAST_ACTIVITY_DATE")
|
||||||
def * = userName ~ repositoryName ~ isPrivate ~ description.? ~ defaultBranch ~ registeredDate ~ updatedDate ~ lastActivityDate <> (Repository, Repository.unapply _)
|
def * = userName ~ repositoryName ~ isPrivate ~ description.? ~ defaultBranch ~ registeredDate ~ updatedDate ~ lastActivityDate <> (Repository, Repository.unapply _)
|
||||||
|
|
||||||
|
def byPrimaryKey = byRepository _
|
||||||
}
|
}
|
||||||
|
|
||||||
case class Repository(
|
case class Repository(
|
||||||
|
|||||||
Reference in New Issue
Block a user