sungkangaw opened a new issue, #8449:
URL: https://github.com/apache/incubator-devlake/issues/8449

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   Set Up: there are multiple projects set up in devlake with "Associate pull 
requests to issue" checked. The projects are on different git repos.
   <!-- Failed to upload "image.png" -->
   
   Collecting data from one project deletes all entries of pull_rquest_issues 
of other projects
   
   
   
   ### What do you expect to happen
   
   Data in pull_request_issues table of another project should not be touched.
   
   ### How to reproduce
   
   1. Set up at least 2 projects in devlake with both jira and github
   2. Check Associate pull requests to issue
   3. Collect data from Project A
   4. Check data in pull_request_issues table -- all fine
   5. Collect data from Project B
   6. Check data in pull_request_issues table -- data for project B is correct 
but data from project A disappear.
   
   ### Anything else
   
   I think the issue is at 
https://github.com/apache/incubator-devlake/blob/v1.0.1/backend/plugins/linker/tasks/link_pr_and_issue.go#L48-L60
   
   `    DELETE FROM pull_request_issues
                WHERE pull_request_id IN (
                        SELECT pr.id
                                FROM pull_requests pr
                                        LEFT JOIN project_mapping pm
                                        ON pm.table = 'repos'
                                                AND pm.row_id = pr.base_repo_id
                                                AND pm.project_name = ?
        )`
   
   It should be join or if left join there should be a where clause to filter 
out a project
   
   ### Version
   
   v1.0.1
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@devlake.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to