dosubot[bot] commented on issue #8331:
URL: 
https://github.com/apache/incubator-devlake/issues/8331#issuecomment-2713074778

   <!-- Answer -->
   I found a similar closed issue related to the "Error 500 on trying to add 
too many projects" in the SonarQube plugin, which was resolved by expanding the 
`project_key` column to `varchar(255)` 
<sup>[[1]](https://github.com/apache/incubator-devlake/issues/4716)</sup>. 
   
   To resolve the "Error 1406 (22001): Data too long for column 'project_key'" 
issue in your case, you need to increase the length of the `project_key` column 
in the `cq_issues` table. The current length is `varchar(100)`, and it should 
be expanded to `varchar(255)` to accommodate longer project keys. This can be 
done by applying a migration script similar to the one used for the SonarQube 
plugin:
   
   ```go
   package migrationscripts
   
   import (
        "github.com/apache/incubator-devlake/core/context"
        "github.com/apache/incubator-devlake/core/errors"
        "github.com/apache/incubator-devlake/helpers/migrationhelper"
   )
   
   type expandProjectKey20230206 struct{}
   
   func (script *expandProjectKey20230206) Up(basicRes context.BasicRes) 
errors.Error {
        // expand `ProjectKey` from varchar(100) to varchar(255)
        err := migrationhelper.TransformTable(
                basicRes,
                script,
                "cq_issues",
                func(s *SonarqubeIssue20230206Before) 
(*SonarqubeIssue20230206After, errors.Error) {
                        dst := (*SonarqubeIssue20230206After)(s)
                        return dst, nil
                },
        )
        if err != nil {
                return err
        }
   
        return nil
   }
   
   func (*expandProjectKey20230206) Version() uint64 {
        return 20230321000003
   }
   
   func (*expandProjectKey20230206) Name() string {
        return "expand project_key"
   }
   ```
   
   This script will modify the `project_key` column in the `cq_issues` table to 
have a maximum length of 255 characters, which should resolve the error 
<sup>[[2]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/sonarqube/models/migrationscripts/20230321_expend_project_key.go)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   
   ---
   <sup>Help Dosu learn! Give it feedback: [Great 
Response](https://app.dosu.dev/response-feedback/ae4ee438-a027-4e8b-8341-d9e27bf9fc66?feedback_type=great_response)
 | [Irrelevant 
Answer](https://app.dosu.dev/response-feedback/ae4ee438-a027-4e8b-8341-d9e27bf9fc66?feedback_type=irrelevant_answer)
 | [Incorrect 
Sources](https://app.dosu.dev/response-feedback/ae4ee438-a027-4e8b-8341-d9e27bf9fc66?feedback_type=incorrect_sources)
 | [Too 
Verbose](https://app.dosu.dev/response-feedback/ae4ee438-a027-4e8b-8341-d9e27bf9fc66?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/ae4ee438-a027-4e8b-8341-d9e27bf9fc66?feedback_type=hallucination)
 | [Bug 
Report](https://app.dosu.dev/response-feedback/ae4ee438-a027-4e8b-8341-d9e27bf9fc66?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/ae4ee438-a027-4e8b-8341-d9e27bf9fc66?feedback_type=other)</sup>
   


-- 
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

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

Reply via email to