Fix services to use shortcut method for primary key and foreign keys.

This commit is contained in:
takezoe
2013-06-29 13:40:01 +09:00
parent af79f558c3
commit bea6d156ed
8 changed files with 56 additions and 128 deletions

View File

@@ -2,8 +2,7 @@ package model
import scala.slick.driver.H2Driver.simple._
object Milestones extends Table[Milestone]("MILESTONE") with BasicTemplate with Functions {
def milestoneId = column[Int]("MILESTONE_ID", O AutoInc)
object Milestones extends Table[Milestone]("MILESTONE") with MilestoneTemplate with Functions {
def title = column[String]("TITLE")
def description = column[String]("DESCRIPTION")
def dueDate = column[java.util.Date]("DUE_DATE")
@@ -11,9 +10,7 @@ object Milestones extends Table[Milestone]("MILESTONE") with BasicTemplate with
def * = userName ~ repositoryName ~ milestoneId ~ title ~ description.? ~ dueDate.? ~ closedDate.? <> (Milestone, Milestone.unapply _)
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)
def byPrimaryKey = byMilestone _
}
case class Milestone(