You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ka...@apache.org on 2023/05/18 19:21:38 UTC

[incubator-devlake] branch release-v0.17 updated (55b08c546 -> a97cdf70e)

This is an automated email from the ASF dual-hosted git repository.

ka94 pushed a change to branch release-v0.17
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


    from 55b08c546 fix: gitHub repos' url columns are empty (#5228)
     new 230f7df43 fix: Fix Job.migrate on postgresql (#5194)
     new 0645bf101 fix: Set type of description column to TEXT (#5191)
     new a97cdf70e fix: Make PR.merge_commit_sha optional (#5192)

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../plugins/azuredevops/azuredevops/models.py      | 25 ++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)


[incubator-devlake] 02/03: fix: Set type of description column to TEXT (#5191)

Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ka94 pushed a commit to branch release-v0.17
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 0645bf101ac963abf35cd8a5072f1316113d0cbf
Author: Camille Teruel <ca...@gmail.com>
AuthorDate: Tue May 16 03:19:59 2023 +0200

    fix: Set type of description column to TEXT (#5191)
    
    * fix: Set type of description column to TEXT
    
    * fix: Make PR.merge_commit_sha optional
    
    Abandonned PRs don't have lastMergeCommit property.
    
    ---------
    
    Co-authored-by: Camille Teruel <ca...@meri.co>
---
 backend/python/plugins/azuredevops/azuredevops/models.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/backend/python/plugins/azuredevops/azuredevops/models.py b/backend/python/plugins/azuredevops/azuredevops/models.py
index 7e96e64cc..1fd6e7c89 100644
--- a/backend/python/plugins/azuredevops/azuredevops/models.py
+++ b/backend/python/plugins/azuredevops/azuredevops/models.py
@@ -18,7 +18,7 @@ from enum import Enum
 from typing import Optional
 import re
 
-from sqlmodel import Session
+from sqlmodel import Session, Column, Text
 
 from pydevlake import Field, Connection, TransformationRule
 from pydevlake.model import ToolModel, ToolScope
@@ -52,7 +52,7 @@ class GitPullRequest(ToolModel, table=True):
         Completed = "completed"
 
     pull_request_id: int = Field(primary_key=True)
-    description: Optional[str]
+    description: Optional[str] = Field(sa_column=Column(Text))
     status: Status
     created_by_id: str = Field(source='/createdBy/id')
     created_by_name: str = Field(source='/createdBy/displayName')
@@ -60,7 +60,7 @@ class GitPullRequest(ToolModel, table=True):
     closed_date: Optional[datetime.datetime]
     source_commit_sha: str = Field(source='/lastMergeSourceCommit/commitId')
     target_commit_sha: str = Field(source='/lastMergeTargetCommit/commitId')
-    merge_commit_sha: str = Field(source='/lastMergeCommit/commitId')
+    merge_commit_sha: Optional[str] = Field(source='/lastMergeCommit/commitId')
     url: Optional[str]
     type: Optional[str] = Field(source='/labels/0/name') # TODO: get this off transformation rules regex
     title: Optional[str]
@@ -68,6 +68,14 @@ class GitPullRequest(ToolModel, table=True):
     source_ref_name: Optional[str]
     fork_repo_id: Optional[str] = Field(source='/forkSource/repository/id')
 
+    @classmethod
+    def migrate(self, session: Session):
+        dialect = session.bind.dialect.name
+        if dialect == 'mysql':
+            session.execute(f'ALTER TABLE {self.__tablename__} MODIFY COLUMN description TEXT')
+        elif dialect == 'postgresql':
+            session.execute(f'ALTER TABLE {self.__tablename__} ALTER COLUMN description TYPE TEXT')
+
 
 class GitPullRequestCommit(ToolModel, table=True):
     commit_id: str = Field(primary_key=True)


[incubator-devlake] 01/03: fix: Fix Job.migrate on postgresql (#5194)

Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ka94 pushed a commit to branch release-v0.17
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 230f7df43a6feeba489d8370a743f26f7d4da07d
Author: Camille Teruel <ca...@gmail.com>
AuthorDate: Mon May 15 19:19:30 2023 +0200

    fix: Fix Job.migrate on postgresql (#5194)
    
    MySQL and postgresql don't have the same syntax to remove a primary key constraint.
    
    Co-authored-by: Camille Teruel <ca...@meri.co>
---
 backend/python/plugins/azuredevops/azuredevops/models.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/backend/python/plugins/azuredevops/azuredevops/models.py b/backend/python/plugins/azuredevops/azuredevops/models.py
index 35fc0e614..7e96e64cc 100644
--- a/backend/python/plugins/azuredevops/azuredevops/models.py
+++ b/backend/python/plugins/azuredevops/azuredevops/models.py
@@ -18,6 +18,8 @@ from enum import Enum
 from typing import Optional
 import re
 
+from sqlmodel import Session
+
 from pydevlake import Field, Connection, TransformationRule
 from pydevlake.model import ToolModel, ToolScope
 from pydevlake.pipeline_tasks import RefDiffOptions
@@ -121,3 +123,14 @@ class Job(ToolModel, table=True):
     finishTime: datetime.datetime
     state: State
     result: Result
+
+    @classmethod
+    def migrate(self, session: Session):
+        dialect = session.bind.dialect.name
+        if dialect == 'mysql':
+            session.execute(f'ALTER TABLE {self.__tablename__} DROP PRIMARY KEY')
+        elif dialect == 'postgresql':
+            session.execute(f'ALTER TABLE {self.__tablename__} DROP CONSTRAINT {self.__tablename__}_pkey')
+        else:
+            raise Exception(f'Unsupported dialect {dialect}')
+        session.execute(f'ALTER TABLE {self.__tablename__} ADD PRIMARY KEY (id, build_id)')


[incubator-devlake] 03/03: fix: Make PR.merge_commit_sha optional (#5192)

Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ka94 pushed a commit to branch release-v0.17
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit a97cdf70ef6c27ec912d8b48fe3d56cb7e042e6d
Author: Camille Teruel <ca...@gmail.com>
AuthorDate: Tue May 16 03:20:20 2023 +0200

    fix: Make PR.merge_commit_sha optional (#5192)
    
    Abandonned PRs don't have lastMergeCommit property.
    
    Co-authored-by: Camille Teruel <ca...@meri.co>