ImportIssueRepoCommit imports data to the table `issue_repo_commits` and `issue_commits`
(boardId string, file io.ReadCloser, incremental bool)
| 210 | |
| 211 | // ImportIssueRepoCommit imports data to the table `issue_repo_commits` and `issue_commits` |
| 212 | func (s *Service) ImportIssueRepoCommit(boardId string, file io.ReadCloser, incremental bool) errors.Error { |
| 213 | if !incremental { |
| 214 | // delete old records of the table `issue_repo_commit` and `issue_commit` |
| 215 | err := s.dal.Delete( |
| 216 | &crossdomain.IssueRepoCommit{}, |
| 217 | dal.Where("issue_id IN (SELECT issue_id FROM board_issues WHERE board_id=? AND issue_id NOT IN (SELECT issue_id FROM board_issues WHERE board_id!=?))", boardId, boardId), |
| 218 | ) |
| 219 | if err != nil { |
| 220 | return err |
| 221 | } |
| 222 | err = s.dal.Delete( |
| 223 | &crossdomain.IssueCommit{}, |
| 224 | dal.Where("issue_id IN (SELECT issue_id FROM board_issues WHERE board_id=? AND issue_id NOT IN (SELECT issue_id FROM board_issues WHERE board_id!=?))", boardId, boardId), |
| 225 | ) |
| 226 | if err != nil { |
| 227 | return err |
| 228 | } |
| 229 | } |
| 230 | return s.importCSV(file, boardId, s.issueRepoCommitHandler) |
| 231 | } |
| 232 | |
| 233 | // importCSV extract records from csv file, and save them to DB using recordHandler |
| 234 | // the rawDataParams is used to identify the data source, |