Drop PULL_REQUEST column from COMMIT_COMMENT table

This commit is contained in:
Naoki Takezoe
2015-11-10 11:35:59 +09:00
parent f1533cb168
commit d3b21a4e39
4 changed files with 17 additions and 8 deletions

View File

@@ -41,3 +41,15 @@ CREATE OR REPLACE VIEW ISSUE_OUTLINE_VIEW AS
GROUP BY USER_NAME, REPOSITORY_NAME, ISSUE_ID GROUP BY USER_NAME, REPOSITORY_NAME, ISSUE_ID
) C ) C
ON (A.USER_NAME = C.USER_NAME AND A.REPOSITORY_NAME = C.REPOSITORY_NAME AND A.ISSUE_ID = C.ISSUE_ID); ON (A.USER_NAME = C.USER_NAME AND A.REPOSITORY_NAME = C.REPOSITORY_NAME AND A.ISSUE_ID = C.ISSUE_ID);
UPDATE COMMIT_COMMENT C SET (ISSUE_ID) = (
SELECT MAX(P.ISSUE_ID)
FROM PULL_REQUEST P
WHERE
C.USER_NAME = P.USER_NAME AND
C.REPOSITORY_NAME = P.REPOSITORY_NAME AND
C.COMMIT_ID = P.COMMIT_ID_TO
);
ALTER TABLE COMMIT_COMMENT DROP COLUMN PULL_REQUEST;

View File

@@ -55,9 +55,8 @@ trait CommitCommentComponent extends TemplateComponent { self: Profile =>
val newLine = column[Option[Int]]("NEW_LINE_NUMBER") val newLine = column[Option[Int]]("NEW_LINE_NUMBER")
val registeredDate = column[java.util.Date]("REGISTERED_DATE") val registeredDate = column[java.util.Date]("REGISTERED_DATE")
val updatedDate = column[java.util.Date]("UPDATED_DATE") val updatedDate = column[java.util.Date]("UPDATED_DATE")
val pullRequest = column[Boolean]("PULL_REQUEST")
val issueId = column[Option[Int]]("ISSUE_ID") val issueId = column[Option[Int]]("ISSUE_ID")
def * = (userName, repositoryName, commitId, commentId, commentedUserName, content, fileName, oldLine, newLine, registeredDate, updatedDate, pullRequest, issueId) <> (CommitComment.tupled, CommitComment.unapply) def * = (userName, repositoryName, commitId, commentId, commentedUserName, content, fileName, oldLine, newLine, registeredDate, updatedDate, issueId) <> (CommitComment.tupled, CommitComment.unapply)
def byPrimaryKey(commentId: Int) = this.commentId === commentId.bind def byPrimaryKey(commentId: Int) = this.commentId === commentId.bind
} }
@@ -75,6 +74,5 @@ case class CommitComment(
newLine: Option[Int], newLine: Option[Int],
registeredDate: java.util.Date, registeredDate: java.util.Date,
updatedDate: java.util.Date, updatedDate: java.util.Date,
pullRequest: Boolean,
issueId: Option[Int] issueId: Option[Int]
) extends Comment ) extends Comment

View File

@@ -13,9 +13,9 @@ import StringUtil._
trait CommitsService { trait CommitsService {
def getCommitComments(owner: String, repository: String, commitId: String, pullRequest: Boolean)(implicit s: Session) = def getCommitComments(owner: String, repository: String, commitId: String, includePullRequest: Boolean)(implicit s: Session) =
CommitComments filter { CommitComments filter {
t => t.byCommit(owner, repository, commitId) && (t.pullRequest === pullRequest || pullRequest) t => t.byCommit(owner, repository, commitId) && (t.issueId.isEmpty || includePullRequest)
} list } list
def getCommitComment(owner: String, repository: String, commentId: String)(implicit s: Session) = def getCommitComment(owner: String, repository: String, commentId: String)(implicit s: Session) =
@@ -40,7 +40,6 @@ trait CommitsService {
newLine = newLine, newLine = newLine,
registeredDate = currentDate, registeredDate = currentDate,
updatedDate = currentDate, updatedDate = currentDate,
pullRequest = issueId.isDefined,
issueId = issueId) issueId = issueId)
def updateCommitComment(commentId: Int, content: String)(implicit s: Session) = def updateCommitComment(commentId: Int, content: String)(implicit s: Session) =

View File

@@ -15,9 +15,9 @@
@user(comment.commentedUserName, styleClass="username strong") @user(comment.commentedUserName, styleClass="username strong")
<span class="muted"> <span class="muted">
commented commented
@if(comment.pullRequest){ @if(comment.issueId.isDefined){
on this Pull Request on this Pull Request
}else{ } else {
@if(comment.fileName.isDefined){ @if(comment.fileName.isDefined){
on @comment.fileName.get on @comment.fileName.get
} }