dg-nvm opened a new issue, #8954:
URL: https://github.com/apache/devlake/issues/8954

   ### 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
   
   Go code defines PrimaryKeys like that:
   
   ```go
   type PullRequestLabel struct {
        PullRequestId string `json:"id" 
gorm:"primaryKey;type:varchar(255);comment:This key is generated based on 
details from the original plugin"` // format: <Plugin>:<Entity>:<PK0>:<PK1>
        LabelName     string `gorm:"primaryKey;type:varchar(255)"`
        common.NoPKModel
   }
   ```
   
   and Python:
   
   ```python
   class PullRequestLabels(NoPKModel, table=True):
       __tablename__ = 'pull_request_labels'
       pull_request_id: str = Field(primary_key=True)
       label_name: str
   ```
   
   
   
   ### What do you expect to happen
   
   they should align
   
   ### How to reproduce
   
   nothing to repro - this is problem in the code itself
   
   ### Anything else
   
   workaround is to use extend_existing to internally in the code expand 
definition:
   
   ```python
   class PullRequestLabels(NoPKModel, table=True):
       """
       Domain model for pull_request_labels table with the correct composite PK.
   
       Patches the vendored pydevlake.domain_layer.code.PullRequestLabels to use
       a composite primary key (pull_request_id, label_name) matching the Go
       DevLake domain layer definition.
       """
   
       __tablename__ = "pull_request_labels"
       __table_args__ = {"extend_existing": True}
   
       pull_request_id: str = Field(primary_key=True)
       label_name: str = Field(primary_key=True)
   ```
   
   ### Version
   
   f2de2dcb19cdb2af5b2613a2b939f50a33bfd209
   
   ### Are you willing to submit PR?
   
   - [x] 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to