(refs #341) Migrate model package.

This commit is contained in:
shimamoto
2014-06-16 01:29:56 +09:00
parent 8ed4075f1e
commit bbe455ac49
17 changed files with 372 additions and 290 deletions

View File

@@ -1,21 +1,26 @@
package model
import scala.slick.driver.H2Driver.simple._
trait IssueCommentComponent extends TemplateComponent { self: Profile =>
import profile.simple._
import self._
object IssueComments extends Table[IssueComment]("ISSUE_COMMENT") with IssueTemplate {
def commentId = column[Int]("COMMENT_ID", O AutoInc)
def action = column[String]("ACTION")
def commentedUserName = column[String]("COMMENTED_USER_NAME")
def content = column[String]("CONTENT")
def registeredDate = column[java.util.Date]("REGISTERED_DATE")
def updatedDate = column[java.util.Date]("UPDATED_DATE")
def * = userName ~ repositoryName ~ issueId ~ commentId ~ action ~ commentedUserName ~ content ~ registeredDate ~ updatedDate <> (IssueComment, IssueComment.unapply _)
lazy val IssueComments = new TableQuery(tag => new IssueComments(tag)){
def autoInc = this returning this.map(_.commentId)
}
def autoInc = userName ~ repositoryName ~ issueId ~ action ~ commentedUserName ~ content ~ registeredDate ~ updatedDate returning commentId
def byPrimaryKey(commentId: Int) = this.commentId is commentId.bind
}
class IssueComments(tag: Tag) extends Table[IssueComment](tag, "ISSUE_COMMENT") with IssueTemplate {
val commentId = column[Int]("COMMENT_ID", O AutoInc)
val action = column[String]("ACTION")
val commentedUserName = column[String]("COMMENTED_USER_NAME")
val content = column[String]("CONTENT")
val registeredDate = column[java.util.Date]("REGISTERED_DATE")
val updatedDate = column[java.util.Date]("UPDATED_DATE")
def * = (userName, repositoryName, issueId, commentId, action, commentedUserName, content, registeredDate, updatedDate) <> (IssueComment.tupled, IssueComment.unapply)
case class IssueComment(
def byPrimaryKey(commentId: Int) = this.commentId is commentId.bind
}
case class IssueComment(
userName: String,
repositoryName: String,
issueId: Int,
@@ -25,4 +30,5 @@ case class IssueComment(
content: String,
registeredDate: java.util.Date,
updatedDate: java.util.Date
)
)
}