You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by wa...@apache.org on 2022/06/02 00:56:03 UTC

[incubator-devlake] branch main updated (a2f64c31 -> f9d36263)

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

warren pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


    from a2f64c31 replace grafana icon (#2049)
     new 9e7fc6d9 feat(tapd): add story category
     new f9d36263 feat(tapd): add custom fields

The 2 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/github/github.go                           |  54 +++---
 plugins/gitlab/gitlab.go                           |  33 +++-
 plugins/helper/cst_time.go                         |   1 +
 plugins/tapd/api/connection.go                     |   2 +-
 plugins/tapd/models/bug.go                         | 188 +++++++++++++--------
 plugins/tapd/models/bug_changelog.go               |  20 +--
 plugins/tapd/models/bug_commit.go                  |  16 +-
 plugins/tapd/models/bug_custom_field.go            |   6 +-
 plugins/tapd/models/connection.go                  |   2 +-
 plugins/tapd/models/iteration.go                   |  34 ++--
 plugins/tapd/models/iteration_bug.go               |   4 +-
 plugins/tapd/models/iteration_story.go             |   4 +-
 plugins/tapd/models/iteration_task.go              |   4 +-
 .../tapd/models/migrationscripts/archived/bug.go   | 188 +++++++++++++--------
 .../migrationscripts/archived/bug_changelog.go     |  20 +--
 .../models/migrationscripts/archived/bug_commit.go |  16 +-
 .../migrationscripts/archived/bug_custom_field.go  |   6 +-
 .../models/migrationscripts/archived/iteration.go  |  38 ++---
 .../migrationscripts/archived/iteration_bug.go     |   4 +-
 .../migrationscripts/archived/iteration_story.go   |   4 +-
 .../migrationscripts/archived/iteration_task.go    |   4 +-
 .../tapd/models/migrationscripts/archived/story.go | 137 ++++++++++-----
 .../migrationscripts/archived/story_category.go    |  14 +-
 .../migrationscripts/archived/story_changelog.go   |  22 +--
 .../migrationscripts/archived/story_commits.go     |  16 +-
 .../archived/story_custom_field.go                 |   6 +-
 .../tapd/models/migrationscripts/archived/task.go  | 104 +++++++++---
 .../migrationscripts/archived/task_changelog.go    |  24 +--
 .../migrationscripts/archived/task_commits.go      |  16 +-
 .../migrationscripts/archived/task_custom_field.go |   6 +-
 .../models/migrationscripts/archived/worklog.go    |  20 +--
 .../models/migrationscripts/archived/workspace.go  |  26 +--
 .../tapd/models/migrationscripts/init_schema.go    |   4 -
 .../{init_schema.go => update_schemas20220531.go}  |  54 +++++-
 plugins/tapd/models/story.go                       | 137 ++++++++++-----
 plugins/tapd/models/story_category.go              |  14 +-
 plugins/tapd/models/story_changelog.go             |  22 +--
 plugins/tapd/models/story_commits.go               |  16 +-
 plugins/tapd/models/story_custom_field.go          |   6 +-
 plugins/tapd/models/task.go                        | 104 +++++++++---
 plugins/tapd/models/task_changelog.go              |  24 +--
 plugins/tapd/models/task_commits.go                |  16 +-
 plugins/tapd/models/task_custom_field.go           |   6 +-
 plugins/tapd/models/worklog.go                     |  20 +--
 plugins/tapd/models/workspace.go                   |  26 +--
 plugins/tapd/tapd.go                               |  31 +++-
 plugins/tapd/tasks/bug_changelog_collector.go      |   4 +-
 plugins/tapd/tasks/bug_changelog_converter.go      |   2 +-
 plugins/tapd/tasks/bug_changelog_extractor.go      |   8 +-
 plugins/tapd/tasks/bug_collector.go                |   4 +-
 plugins/tapd/tasks/bug_commit_collector.go         |  16 +-
 plugins/tapd/tasks/bug_converter.go                |  19 +--
 plugins/tapd/tasks/bug_custom_fields_extractor.go  |   7 +-
 plugins/tapd/tasks/bug_extractor.go                |  11 +-
 plugins/tapd/tasks/bug_status_extractor.go         |   7 +-
 plugins/tapd/tasks/iteration_collector.go          |   4 +-
 plugins/tapd/tasks/iteration_converter.go          |   6 +-
 plugins/tapd/tasks/iteration_extractor.go          |   8 +-
 plugins/tapd/tasks/story_category_extractor.go     |   8 +-
 plugins/tapd/tasks/story_changelog_collector.go    |   4 +-
 plugins/tapd/tasks/story_changelog_extractor.go    |   8 +-
 plugins/tapd/tasks/story_collector.go              |   4 +-
 plugins/tapd/tasks/story_commit_collector.go       |  17 +-
 plugins/tapd/tasks/story_converter.go              |   6 +-
 .../tapd/tasks/story_custom_fields_extractor.go    |   7 +-
 plugins/tapd/tasks/story_extractor.go              |  15 +-
 plugins/tapd/tasks/story_status_collector.go       |   4 +-
 plugins/tapd/tasks/story_status_extractor.go       |   7 +-
 plugins/tapd/tasks/task_changelog_collector.go     |   4 +-
 plugins/tapd/tasks/task_changelog_extractor.go     |   8 +-
 plugins/tapd/tasks/task_collector.go               |   4 +-
 plugins/tapd/tasks/task_commit_collector.go        |  16 +-
 plugins/tapd/tasks/task_converter.go               |   6 +-
 plugins/tapd/tasks/task_custom_fields_extractor.go |   7 +-
 plugins/tapd/tasks/task_extractor.go               |   8 +-
 plugins/tapd/tasks/user_extractor.go               |   7 +-
 plugins/tapd/tasks/worklog_collector.go            |   4 +-
 plugins/tapd/tasks/worklog_converter.go            |   2 +-
 plugins/tapd/tasks/worklog_extractor.go            |   7 +-
 plugins/tapd/tasks/workspace_collector.go          |   2 +-
 80 files changed, 1077 insertions(+), 693 deletions(-)
 copy plugins/tapd/models/migrationscripts/{init_schema.go => update_schemas20220531.go} (58%)


[incubator-devlake] 02/02: feat(tapd): add custom fields

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

warren pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit f9d36263993767b99720e9107c2de89e2a8cd38b
Author: Yingchu Chen <yi...@merico.dev>
AuthorDate: Fri May 27 13:45:36 2022 +0800

    feat(tapd): add custom fields
---
 plugins/github/github.go                           |  54 +++---
 plugins/gitlab/gitlab.go                           |  33 +++-
 plugins/helper/cst_time.go                         |   1 +
 plugins/tapd/api/connection.go                     |   2 +-
 plugins/tapd/models/bug.go                         | 188 +++++++++++++--------
 plugins/tapd/models/bug_changelog.go               |  20 +--
 plugins/tapd/models/bug_commit.go                  |  16 +-
 plugins/tapd/models/bug_custom_field.go            |   6 +-
 plugins/tapd/models/connection.go                  |   2 +-
 plugins/tapd/models/iteration.go                   |  34 ++--
 plugins/tapd/models/iteration_bug.go               |   4 +-
 plugins/tapd/models/iteration_story.go             |   4 +-
 plugins/tapd/models/iteration_task.go              |   4 +-
 .../tapd/models/migrationscripts/archived/bug.go   | 188 +++++++++++++--------
 .../migrationscripts/archived/bug_changelog.go     |  20 +--
 .../models/migrationscripts/archived/bug_commit.go |  16 +-
 .../migrationscripts/archived/bug_custom_field.go  |   6 +-
 .../models/migrationscripts/archived/iteration.go  |  38 ++---
 .../migrationscripts/archived/iteration_bug.go     |   4 +-
 .../migrationscripts/archived/iteration_story.go   |   4 +-
 .../migrationscripts/archived/iteration_task.go    |   4 +-
 .../tapd/models/migrationscripts/archived/story.go | 137 ++++++++++-----
 .../migrationscripts/archived/story_category.go    |  14 +-
 .../migrationscripts/archived/story_changelog.go   |  22 +--
 .../migrationscripts/archived/story_commits.go     |  16 +-
 .../archived/story_custom_field.go                 |   6 +-
 .../tapd/models/migrationscripts/archived/task.go  | 104 +++++++++---
 .../migrationscripts/archived/task_changelog.go    |  24 +--
 .../migrationscripts/archived/task_commits.go      |  16 +-
 .../migrationscripts/archived/task_custom_field.go |   6 +-
 .../models/migrationscripts/archived/worklog.go    |  20 +--
 .../models/migrationscripts/archived/workspace.go  |  26 +--
 .../tapd/models/migrationscripts/init_schema.go    |   4 -
 .../{init_schema.go => update_schemas20220531.go}  |  54 +++++-
 plugins/tapd/models/story.go                       | 137 ++++++++++-----
 plugins/tapd/models/story_category.go              |  14 +-
 plugins/tapd/models/story_changelog.go             |  22 +--
 plugins/tapd/models/story_commits.go               |  16 +-
 plugins/tapd/models/story_custom_field.go          |   6 +-
 plugins/tapd/models/task.go                        | 104 +++++++++---
 plugins/tapd/models/task_changelog.go              |  24 +--
 plugins/tapd/models/task_commits.go                |  16 +-
 plugins/tapd/models/task_custom_field.go           |   6 +-
 plugins/tapd/models/worklog.go                     |  20 +--
 plugins/tapd/models/workspace.go                   |  26 +--
 plugins/tapd/tapd.go                               |  31 +++-
 plugins/tapd/tasks/bug_changelog_collector.go      |   4 +-
 plugins/tapd/tasks/bug_changelog_converter.go      |   2 +-
 plugins/tapd/tasks/bug_changelog_extractor.go      |   8 +-
 plugins/tapd/tasks/bug_collector.go                |   4 +-
 plugins/tapd/tasks/bug_commit_collector.go         |  16 +-
 plugins/tapd/tasks/bug_converter.go                |  19 +--
 plugins/tapd/tasks/bug_custom_fields_extractor.go  |   7 +-
 plugins/tapd/tasks/bug_extractor.go                |  11 +-
 plugins/tapd/tasks/bug_status_extractor.go         |   7 +-
 plugins/tapd/tasks/iteration_collector.go          |   4 +-
 plugins/tapd/tasks/iteration_converter.go          |   6 +-
 plugins/tapd/tasks/iteration_extractor.go          |   8 +-
 plugins/tapd/tasks/story_category_extractor.go     |   7 +-
 plugins/tapd/tasks/story_changelog_collector.go    |   4 +-
 plugins/tapd/tasks/story_changelog_extractor.go    |   8 +-
 plugins/tapd/tasks/story_collector.go              |   4 +-
 plugins/tapd/tasks/story_commit_collector.go       |  17 +-
 plugins/tapd/tasks/story_converter.go              |   6 +-
 .../tapd/tasks/story_custom_fields_extractor.go    |   7 +-
 plugins/tapd/tasks/story_extractor.go              |  15 +-
 plugins/tapd/tasks/story_status_collector.go       |   4 +-
 plugins/tapd/tasks/story_status_extractor.go       |   7 +-
 plugins/tapd/tasks/task_changelog_collector.go     |   4 +-
 plugins/tapd/tasks/task_changelog_extractor.go     |   8 +-
 plugins/tapd/tasks/task_collector.go               |   4 +-
 plugins/tapd/tasks/task_commit_collector.go        |  16 +-
 plugins/tapd/tasks/task_converter.go               |   6 +-
 plugins/tapd/tasks/task_custom_fields_extractor.go |   7 +-
 plugins/tapd/tasks/task_extractor.go               |   8 +-
 plugins/tapd/tasks/user_extractor.go               |   7 +-
 plugins/tapd/tasks/worklog_collector.go            |   4 +-
 plugins/tapd/tasks/worklog_converter.go            |   2 +-
 plugins/tapd/tasks/worklog_extractor.go            |   7 +-
 plugins/tapd/tasks/workspace_collector.go          |   2 +-
 80 files changed, 1077 insertions(+), 692 deletions(-)

diff --git a/plugins/github/github.go b/plugins/github/github.go
index 765a4d28..4c6bb6fe 100644
--- a/plugins/github/github.go
+++ b/plugins/github/github.go
@@ -52,34 +52,34 @@ func (plugin Github) SubTaskMetas() []core.SubTaskMeta {
 	return []core.SubTaskMeta{
 		tasks.CollectApiRepoMeta,
 		tasks.ExtractApiRepoMeta,
-		tasks.CollectApiIssuesMeta,
+		//tasks.CollectApiIssuesMeta,
 		tasks.ExtractApiIssuesMeta,
-		tasks.CollectApiPullRequestsMeta,
-		tasks.ExtractApiPullRequestsMeta,
-		tasks.CollectApiCommentsMeta,
-		tasks.ExtractApiCommentsMeta,
-		tasks.CollectApiEventsMeta,
-		tasks.ExtractApiEventsMeta,
-		tasks.CollectApiPullRequestCommitsMeta,
-		tasks.ExtractApiPullRequestCommitsMeta,
-		tasks.CollectApiPullRequestReviewsMeta,
-		tasks.ExtractApiPullRequestReviewsMeta,
-		tasks.CollectApiCommitsMeta,
-		tasks.ExtractApiCommitsMeta,
-		tasks.CollectApiCommitStatsMeta,
-		tasks.ExtractApiCommitStatsMeta,
-		tasks.EnrichPullRequestIssuesMeta,
-		tasks.ConvertRepoMeta,
-		tasks.ConvertIssuesMeta,
-		tasks.ConvertCommitsMeta,
-		tasks.ConvertIssueLabelsMeta,
-		tasks.ConvertPullRequestCommitsMeta,
-		tasks.ConvertPullRequestsMeta,
-		tasks.ConvertPullRequestLabelsMeta,
-		tasks.ConvertPullRequestIssuesMeta,
-		tasks.ConvertUsersMeta,
-		tasks.ConvertIssueCommentsMeta,
-		tasks.ConvertPullRequestCommentsMeta,
+		//tasks.CollectApiPullRequestsMeta,
+		//tasks.ExtractApiPullRequestsMeta,
+		//tasks.CollectApiCommentsMeta,
+		//tasks.ExtractApiCommentsMeta,
+		//tasks.CollectApiEventsMeta,
+		//tasks.ExtractApiEventsMeta,
+		//tasks.CollectApiPullRequestCommitsMeta,
+		//tasks.ExtractApiPullRequestCommitsMeta,
+		//tasks.CollectApiPullRequestReviewsMeta,
+		//tasks.ExtractApiPullRequestReviewsMeta,
+		//tasks.CollectApiCommitsMeta,
+		//tasks.ExtractApiCommitsMeta,
+		//tasks.CollectApiCommitStatsMeta,
+		//tasks.ExtractApiCommitStatsMeta,
+		//tasks.EnrichPullRequestIssuesMeta,
+		//tasks.ConvertRepoMeta,
+		//tasks.ConvertIssuesMeta,
+		//tasks.ConvertCommitsMeta,
+		//tasks.ConvertIssueLabelsMeta,
+		//tasks.ConvertPullRequestCommitsMeta,
+		//tasks.ConvertPullRequestsMeta,
+		//tasks.ConvertPullRequestLabelsMeta,
+		//tasks.ConvertPullRequestIssuesMeta,
+		//tasks.ConvertUsersMeta,
+		//tasks.ConvertIssueCommentsMeta,
+		//tasks.ConvertPullRequestCommentsMeta,
 	}
 }
 
diff --git a/plugins/gitlab/gitlab.go b/plugins/gitlab/gitlab.go
index a77a62d6..d6c8a5f2 100644
--- a/plugins/gitlab/gitlab.go
+++ b/plugins/gitlab/gitlab.go
@@ -18,7 +18,10 @@ limitations under the License.
 package main // must be main for plugin entry point
 
 import (
+	"github.com/apache/incubator-devlake/config"
+	"github.com/apache/incubator-devlake/logger"
 	"github.com/apache/incubator-devlake/plugins/gitlab/impl"
+	"github.com/apache/incubator-devlake/plugins/tapd/models"
 	"github.com/apache/incubator-devlake/runner"
 	"github.com/spf13/cobra"
 )
@@ -29,13 +32,29 @@ var PluginEntry impl.Gitlab //nolint
 // standalone mode for debugging
 func main() {
 	gitlabCmd := &cobra.Command{Use: "gitlab"}
-	projectId := gitlabCmd.Flags().IntP("project-id", "p", 0, "gitlab project id")
-
-	_ = gitlabCmd.MarkFlagRequired("project-id")
-	gitlabCmd.Run = func(cmd *cobra.Command, args []string) {
-		runner.DirectRun(cmd, args, PluginEntry, map[string]interface{}{
-			"projectId": *projectId,
-		})
+	gitlabCmd.Run = func(c *cobra.Command, args []string) {
+		cfg := config.GetConfig()
+		log := logger.Global.Nested(gitlabCmd.Use)
+		db, err := runner.NewGormDb(cfg, log)
+		if err != nil {
+			panic(err)
+		}
+		wsList := make([]*models.TapdWorkspace, 0)
+		err = db.Find(&wsList, "parent_id = ?", 59169984).Error
+		projectList := []uint64{63281714,
+			34276182,
+			46319043,
+			50328292,
+			63984859,
+			55805854,
+			38496185,
+		}
+		for _, v := range projectList {
+			runner.DirectRun(gitlabCmd, args, PluginEntry, map[string]interface{}{
+				"projectId": v,
+			})
+		}
 	}
+
 	runner.RunCmd(gitlabCmd)
 }
diff --git a/plugins/helper/cst_time.go b/plugins/helper/cst_time.go
index d4727216..6a93aea8 100644
--- a/plugins/helper/cst_time.go
+++ b/plugins/helper/cst_time.go
@@ -58,6 +58,7 @@ func (jt CSTTime) Value() (driver.Value, error) {
 	}
 	return t, nil
 }
+
 func (jt *CSTTime) Scan(v interface{}) error {
 	value, ok := v.(time.Time)
 	if ok {
diff --git a/plugins/tapd/api/connection.go b/plugins/tapd/api/connection.go
index 1b7ea4d8..5065f096 100644
--- a/plugins/tapd/api/connection.go
+++ b/plugins/tapd/api/connection.go
@@ -163,7 +163,7 @@ func refreshAndSaveTapdConnection(tapdConnection *models.TapdConnection, data ma
 		}
 	}()
 	if tapdConnection.RateLimit == 0 {
-		tapdConnection.RateLimit = 10800
+		tapdConnection.RateLimit = 6480
 	}
 	if tapdConnection.ID > 0 {
 		err = tx.Save(tapdConnection).Error
diff --git a/plugins/tapd/models/bug.go b/plugins/tapd/models/bug.go
index 0ee7b63e..96aa3fbe 100644
--- a/plugins/tapd/models/bug.go
+++ b/plugins/tapd/models/bug.go
@@ -26,87 +26,137 @@ type TapdBug struct {
 	ConnectionId uint64 `gorm:"primaryKey"`
 	ID           uint64 `gorm:"primaryKey;type:BIGINT" json:"id,string"`
 	EpicKey      string
-	Title        string `json:"name" gorm:"type:varchar(255)"`
-	Description  string
-	WorkspaceID  uint64          `json:"workspace_id,string"`
-	Created      *helper.CSTTime `json:"created"`
-	Modified     *helper.CSTTime `json:"modified" gorm:"index"`
-	Status       string          `json:"status"`
-	Cc           string          `json:"cc"`
-	Begin        *helper.CSTTime `json:"begin"`
-	Due          *helper.CSTTime `json:"due"`
-	Priority     string          `json:"priority"`
-	IterationID  uint64          `json:"iteration_id,string"`
-	Source       string          `json:"source"`
-	Module       string          `json:"module"`
-	ReleaseID    uint64          `json:"release_id,string"`
-	CreatedFrom  string          `json:"created_from"`
-	Feature      string          `json:"feature"`
+	Title        string         `json:"name" gorm:"type:varchar(255)"`
+	Description  string         `json:"description"`
+	WorkspaceID  uint64         `json:"workspace_id,string"`
+	Created      helper.CSTTime `json:"created"`
+	Modified     helper.CSTTime `json:"modified" gorm:"index"`
+	Status       string         `json:"status" gorm:"type:varchar(255)"`
+	Cc           string         `json:"cc" gorm:"type:varchar(255)"`
+	Begin        helper.CSTTime `json:"begin"`
+	Due          helper.CSTTime `json:"due"`
+	Priority     string         `json:"priority" gorm:"type:varchar(255)"`
+	IterationID  uint64         `json:"iteration_id,string"`
+	Source       string         `json:"source" gorm:"type:varchar(255)"`
+	Module       string         `json:"module" gorm:"type:varchar(255)"`
+	ReleaseID    uint64         `json:"release_id,string"`
+	CreatedFrom  string         `json:"created_from" gorm:"type:varchar(255)"`
+	Feature      string         `json:"feature" gorm:"type:varchar(255)"`
 	common.NoPKModel
 
-	Severity         string          `json:"severity"`
-	Reporter         string          `json:"reporter"`
-	Resolved         *helper.CSTTime `json:"resolved"`
-	Closed           *helper.CSTTime `json:"closed"`
-	Lastmodify       string          `json:"lastmodify"`
-	Auditer          string          `json:"auditer"`
-	De               string          `json:"De" gorm:"comment:developer;type:varchar(255)"`
-	Fixer            string          `json:"fixer"`
-	VersionTest      string          `json:"version_test"`
-	VersionReport    string          `json:"version_report"`
-	VersionClose     string          `json:"version_close"`
-	VersionFix       string          `json:"version_fix"`
-	BaselineFind     string          `json:"baseline_find"`
-	BaselineJoin     string          `json:"baseline_join"`
-	BaselineClose    string          `json:"baseline_close"`
-	BaselineTest     string          `json:"baseline_test"`
-	Sourcephase      string          `json:"sourcephase"`
-	Te               string          `json:"te"`
-	CurrentOwner     string          `json:"current_owner"`
-	Resolution       string          `json:"resolution"`
-	Originphase      string          `json:"originphase"`
-	Confirmer        string          `json:"confirmer"`
-	Participator     string          `json:"participator"`
-	Closer           string          `json:"closer"`
-	Platform         string          `json:"platform"`
-	Os               string          `json:"os"`
-	Testtype         string          `json:"testtype"`
-	Testphase        string          `json:"testphase"`
-	Frequency        string          `json:"frequency"`
-	RegressionNumber string          `json:"regression_number"`
-	Flows            string          `json:"flows"`
-	Testmode         string          `json:"testmode"`
-	IssueID          uint64          `json:"issue_id,string"`
-	VerifyTime       *helper.CSTTime `json:"verify_time"`
-	RejectTime       *helper.CSTTime `json:"reject_time"`
-	ReopenTime       *helper.CSTTime `json:"reopen_time"`
-	AuditTime        *helper.CSTTime `json:"audit_time"`
-	SuspendTime      *helper.CSTTime `json:"suspend_time"`
-	Deadline         *helper.CSTTime `json:"deadline"`
-	InProgressTime   *helper.CSTTime `json:"in_progress_time"`
-	AssignedTime     *helper.CSTTime `json:"assigned_time"`
-	TemplateID       uint64          `json:"template_id,string"`
-	StoryID          uint64          `json:"story_id,string"`
-	StdStatus        string
-	StdType          string
-	Type             string
-	Url              string
+	Severity         string         `json:"severity" gorm:"type:varchar(255)"`
+	Reporter         string         `json:"reporter" gorm:"type:varchar(255)"`
+	Resolved         helper.CSTTime `json:"resolved"`
+	Closed           helper.CSTTime `json:"closed"`
+	Lastmodify       string         `json:"lastmodify" gorm:"type:varchar(255)"`
+	Auditer          string         `json:"auditer" gorm:"type:varchar(255)"`
+	De               string         `json:"De" gorm:"comment:developer;type:varchar(255)"`
+	Fixer            string         `json:"fixer" gorm:"type:varchar(255)"`
+	VersionTest      string         `json:"version_test" gorm:"type:varchar(255)"`
+	VersionReport    string         `json:"version_report" gorm:"type:varchar(255)"`
+	VersionClose     string         `json:"version_close" gorm:"type:varchar(255)"`
+	VersionFix       string         `json:"version_fix" gorm:"type:varchar(255)"`
+	BaselineFind     string         `json:"baseline_find" gorm:"type:varchar(255)"`
+	BaselineJoin     string         `json:"baseline_join" gorm:"type:varchar(255)"`
+	BaselineClose    string         `json:"baseline_close" gorm:"type:varchar(255)"`
+	BaselineTest     string         `json:"baseline_test" gorm:"type:varchar(255)"`
+	Sourcephase      string         `json:"sourcephase" gorm:"type:varchar(255)"`
+	Te               string         `json:"te" gorm:"type:varchar(255)"`
+	CurrentOwner     string         `json:"current_owner" gorm:"type:varchar(255)"`
+	Resolution       string         `json:"resolution" gorm:"type:varchar(255)"`
+	Originphase      string         `json:"originphase" gorm:"type:varchar(255)"`
+	Confirmer        string         `json:"confirmer" gorm:"type:varchar(255)"`
+	Participator     string         `json:"participator" gorm:"type:varchar(255)"`
+	Closer           string         `json:"closer" gorm:"type:varchar(50)"`
+	Platform         string         `json:"platform" gorm:"type:varchar(50)"`
+	Os               string         `json:"os" gorm:"type:varchar(50)"`
+	Testtype         string         `json:"testtype" gorm:"type:varchar(20)"`
+	Testphase        string         `json:"testphase" gorm:"type:varchar(255)"`
+	Frequency        string         `json:"frequency" gorm:"type:varchar(255)"`
+	RegressionNumber string         `json:"regression_number" gorm:"type:varchar(20)"`
+	Flows            string         `json:"flows" gorm:"type:varchar(255)"`
+	Testmode         string         `json:"testmode" gorm:"type:varchar(50)"`
+	IssueID          uint64         `json:"issue_id,string"`
+	VerifyTime       helper.CSTTime `json:"verify_time"`
+	RejectTime       helper.CSTTime `json:"reject_time"`
+	ReopenTime       helper.CSTTime `json:"reopen_time"`
+	AuditTime        helper.CSTTime `json:"audit_time"`
+	SuspendTime      helper.CSTTime `json:"suspend_time"`
+	Deadline         helper.CSTTime `json:"deadline"`
+	InProgressTime   helper.CSTTime `json:"in_progress_time"`
+	AssignedTime     helper.CSTTime `json:"assigned_time"`
+	TemplateID       uint64         `json:"template_id,string"`
+	StoryID          uint64         `json:"story_id,string"`
+	StdStatus        string         `gorm:"type:varchar(20)"`
+	StdType          string         `gorm:"type:varchar(20)"`
+	Type             string         `gorm:"type:varchar(20)"`
+	Url              string         `gorm:"type:varchar(255)"`
 
 	SupportID       uint64  `json:"support_id,string"`
 	SupportForumID  uint64  `json:"support_forum_id,string"`
 	TicketID        uint64  `json:"ticket_id,string"`
-	Follower        string  `json:"follower"`
-	SyncType        string  `json:"sync_type"`
-	Label           string  `json:"label"`
+	Follower        string  `json:"follower" gorm:"type:varchar(255)"`
+	SyncType        string  `json:"sync_type" gorm:"type:text"`
+	Label           string  `json:"label" gorm:"type:varchar(255)"`
 	Effort          float32 `json:"effort,string"`
 	EffortCompleted float32 `json:"effort_completed,string"`
 	Exceed          float32 `json:"exceed,string"`
 	Remain          float32 `json:"remain,string"`
-	Progress        string  `json:"progress"`
+	Progress        string  `json:"progress" gorm:"type:varchar(255)"`
 	Estimate        float32 `json:"estimate,string"`
-	Bugtype         string  `json:"bugtype"`
+	Bugtype         string  `json:"bugtype" gorm:"type:varchar(20)"`
 
-	Milestone string `json:"milestone" gorm:"type:varchar(255)"`
+	Milestone        string `json:"milestone" gorm:"type:varchar(255)"`
+	CustomFieldOne   string `json:"custom_field_one" gorm:"type:text"`
+	CustomFieldTwo   string `json:"custom_field_two" gorm:"type:text"`
+	CustomFieldThree string `json:"custom_field_three" gorm:"type:text"`
+	CustomFieldFour  string `json:"custom_field_four" gorm:"type:text"`
+	CustomFieldFive  string `json:"custom_field_five" gorm:"type:text"`
+	CustomField6     string `json:"custom_field_6" gorm:"type:text"`
+	CustomField7     string `json:"custom_field_7" gorm:"type:text"`
+	CustomField8     string `json:"custom_field_8" gorm:"type:text"`
+	CustomField9     string `json:"custom_field_9" gorm:"type:text"`
+	CustomField10    string `json:"custom_field_10" gorm:"type:text"`
+	CustomField11    string `json:"custom_field_11" gorm:"type:text"`
+	CustomField12    string `json:"custom_field_12" gorm:"type:text"`
+	CustomField13    string `json:"custom_field_13" gorm:"type:text"`
+	CustomField14    string `json:"custom_field_14" gorm:"type:text"`
+	CustomField15    string `json:"custom_field_15" gorm:"type:text"`
+	CustomField16    string `json:"custom_field_16" gorm:"type:text"`
+	CustomField17    string `json:"custom_field_17" gorm:"type:text"`
+	CustomField18    string `json:"custom_field_18" gorm:"type:text"`
+	CustomField19    string `json:"custom_field_19" gorm:"type:text"`
+	CustomField20    string `json:"custom_field_20" gorm:"type:text"`
+	CustomField21    string `json:"custom_field_21" gorm:"type:text"`
+	CustomField22    string `json:"custom_field_22" gorm:"type:text"`
+	CustomField23    string `json:"custom_field_23" gorm:"type:text"`
+	CustomField24    string `json:"custom_field_24" gorm:"type:text"`
+	CustomField25    string `json:"custom_field_25" gorm:"type:text"`
+	CustomField26    string `json:"custom_field_26" gorm:"type:text"`
+	CustomField27    string `json:"custom_field_27" gorm:"type:text"`
+	CustomField28    string `json:"custom_field_28" gorm:"type:text"`
+	CustomField29    string `json:"custom_field_29" gorm:"type:text"`
+	CustomField30    string `json:"custom_field_30" gorm:"type:text"`
+	CustomField31    string `json:"custom_field_31" gorm:"type:text"`
+	CustomField32    string `json:"custom_field_32" gorm:"type:text"`
+	CustomField33    string `json:"custom_field_33" gorm:"type:text"`
+	CustomField34    string `json:"custom_field_34" gorm:"type:text"`
+	CustomField35    string `json:"custom_field_35" gorm:"type:text"`
+	CustomField36    string `json:"custom_field_36" gorm:"type:text"`
+	CustomField37    string `json:"custom_field_37" gorm:"type:text"`
+	CustomField38    string `json:"custom_field_38" gorm:"type:text"`
+	CustomField39    string `json:"custom_field_39" gorm:"type:text"`
+	CustomField40    string `json:"custom_field_40" gorm:"type:text"`
+	CustomField41    string `json:"custom_field_41" gorm:"type:text"`
+	CustomField42    string `json:"custom_field_42" gorm:"type:text"`
+	CustomField43    string `json:"custom_field_43" gorm:"type:text"`
+	CustomField44    string `json:"custom_field_44" gorm:"type:text"`
+	CustomField45    string `json:"custom_field_45" gorm:"type:text"`
+	CustomField46    string `json:"custom_field_46" gorm:"type:text"`
+	CustomField47    string `json:"custom_field_47" gorm:"type:text"`
+	CustomField48    string `json:"custom_field_48" gorm:"type:text"`
+	CustomField49    string `json:"custom_field_49" gorm:"type:text"`
+	CustomField50    string `json:"custom_field_50" gorm:"type:text"`
 }
 
 func (TapdBug) TableName() string {
diff --git a/plugins/tapd/models/bug_changelog.go b/plugins/tapd/models/bug_changelog.go
index fd32f05d..40fcdc2d 100644
--- a/plugins/tapd/models/bug_changelog.go
+++ b/plugins/tapd/models/bug_changelog.go
@@ -23,16 +23,16 @@ import (
 )
 
 type TapdBugChangelog struct {
-	ConnectionId uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL"`
-	WorkspaceID  uint64          `gorm:"type:BIGINT  NOT NULL"`
-	ID           uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
-	BugID        uint64          `json:"bug_id,string"`
-	Author       string          `json:"author"`
-	Field        string          `gorm:"primaryKey;type:varchar(255)" json:"field"`
-	OldValue     string          `json:"old_value"`
-	NewValue     string          `json:"new_value"`
-	Memo         string          `json:"memo"`
-	Created      *helper.CSTTime `json:"created"`
+	ConnectionId uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL"`
+	WorkspaceID  uint64         `gorm:"type:BIGINT  NOT NULL"`
+	ID           uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
+	BugID        uint64         `json:"bug_id,string"`
+	Author       string         `json:"author" gorm:"type:varchar(255)"`
+	Field        string         `gorm:"primaryKey;type:varchar(255)" json:"field"`
+	OldValue     string         `json:"old_value"`
+	NewValue     string         `json:"new_value"`
+	Memo         string         `json:"memo" gorm:"type:text"`
+	Created      helper.CSTTime `json:"created"`
 	common.NoPKModel
 }
 
diff --git a/plugins/tapd/models/bug_commit.go b/plugins/tapd/models/bug_commit.go
index 1840d556..42e9868c 100644
--- a/plugins/tapd/models/bug_commit.go
+++ b/plugins/tapd/models/bug_commit.go
@@ -29,18 +29,18 @@ type TapdBugCommit struct {
 	UserID          string `json:"user_id" gorm:"type:varchar(255)"`
 	HookUserName    string `json:"hook_user_name" gorm:"type:varchar(255)"`
 	CommitID        string `json:"commit_id" gorm:"type:varchar(255)"`
-	WorkspaceID     uint64 `json:"workspace_id,string" gorm:"type:varchar(255)"`
-	Message         string `json:"message"`
+	WorkspaceID     uint64 `json:"workspace_id,string" gorm:"type:BIGINT"`
+	Message         string `json:"message" gorm:"type:text"`
 	Path            string `json:"path" gorm:"type:varchar(255)"`
 	WebURL          string `json:"web_url" gorm:"type:varchar(255)"`
 	HookProjectName string `json:"hook_project_name" gorm:"type:varchar(255)"`
 
-	Ref        string          `json:"ref" gorm:"type:varchar(255)"`
-	RefStatus  string          `json:"ref_status" gorm:"type:varchar(255)"`
-	GitEnv     string          `json:"git_env" gorm:"type:varchar(255)"`
-	FileCommit string          `json:"file_commit"`
-	CommitTime *helper.CSTTime `json:"commit_time"`
-	Created    *helper.CSTTime `json:"created"`
+	Ref        string         `json:"ref" gorm:"type:varchar(255)"`
+	RefStatus  string         `json:"ref_status" gorm:"type:varchar(255)"`
+	GitEnv     string         `json:"git_env" gorm:"type:varchar(255)"`
+	FileCommit string         `json:"file_commit"`
+	CommitTime helper.CSTTime `json:"commit_time"`
+	Created    helper.CSTTime `json:"created"`
 
 	BugId uint64
 	common.NoPKModel
diff --git a/plugins/tapd/models/bug_custom_field.go b/plugins/tapd/models/bug_custom_field.go
index d8826701..aca33127 100644
--- a/plugins/tapd/models/bug_custom_field.go
+++ b/plugins/tapd/models/bug_custom_field.go
@@ -6,11 +6,11 @@ type TapdBugCustomFields struct {
 	ConnectionId uint64 `gorm:"primaryKey;type:BIGINT  NOT NULL"`
 	ID           uint64 `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
 	WorkspaceID  uint64 `json:"workspace_id,string"`
-	EntryType    string `json:"entry_type" gorm:"type:varchar(255)"`
+	EntryType    string `json:"entry_type" gorm:"type:varchar(20)"`
 	CustomField  string `json:"custom_field" gorm:"type:varchar(255)"`
-	Type         string `json:"type" gorm:"type:varchar(255)"`
+	Type         string `json:"type" gorm:"type:varchar(20)"`
 	Name         string `json:"name" gorm:"type:varchar(255)"`
-	Options      string `json:"options"`
+	Options      string `json:"options" gorm:"type:text"`
 	Enabled      string `json:"enabled" gorm:"type:varchar(255)"`
 	Sort         string `json:"sort" gorm:"type:varchar(255)"`
 	common.NoPKModel
diff --git a/plugins/tapd/models/connection.go b/plugins/tapd/models/connection.go
index 98feb339..5f346463 100644
--- a/plugins/tapd/models/connection.go
+++ b/plugins/tapd/models/connection.go
@@ -24,7 +24,7 @@ import (
 type TestConnectionRequest struct {
 	Endpoint string `json:"endpoint" validate:"required,url"`
 	Auth     string `json:"auth" validate:"required"`
-	Proxy    string `json:"proxy"`
+	Proxy    string `json:"proxy" gorm:"type:varchar(255)"`
 }
 
 type WorkspaceResponse struct {
diff --git a/plugins/tapd/models/iteration.go b/plugins/tapd/models/iteration.go
index dfcb35b2..c0c6e10f 100644
--- a/plugins/tapd/models/iteration.go
+++ b/plugins/tapd/models/iteration.go
@@ -23,23 +23,23 @@ import (
 )
 
 type TapdIteration struct {
-	ConnectionId uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL"`
-	ID           uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
-	Name         string          `gorm:"type:varchar(255)" json:"name"`
-	WorkspaceID  uint64          `json:"workspace_id,string"`
-	Startdate    *helper.CSTTime `json:"startdate"`
-	Enddate      *helper.CSTTime `json:"enddate"`
-	Status       string          `gorm:"type:varchar(255)" json:"status"`
-	ReleaseID    uint64          `gorm:"type:varchar(255)" json:"release_id,string"`
-	Description  string          `json:"description"`
-	Creator      string          `gorm:"type:varchar(255)" json:"creator"`
-	Created      *helper.CSTTime `json:"created"`
-	Modified     *helper.CSTTime `json:"modified"`
-	Completed    *helper.CSTTime `json:"completed"`
-	Releaseowner string          `gorm:"type:varchar(255)" json:"releaseowner"`
-	Launchdate   *helper.CSTTime `json:"launchdate"`
-	Notice       string          `gorm:"type:varchar(255)" json:"notice"`
-	Releasename  string          `gorm:"type:varchar(255)" json:"releasename"`
+	ConnectionId uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL"`
+	ID           uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
+	Name         string         `gorm:"type:varchar(255)" json:"name"`
+	WorkspaceID  uint64         `json:"workspace_id,string"`
+	Startdate    helper.CSTTime `json:"startdate"`
+	Enddate      helper.CSTTime `json:"enddate"`
+	Status       string         `gorm:"type:varchar(255)" json:"status"`
+	ReleaseID    uint64         `gorm:"type:BIGINT" json:"release_id,string"`
+	Description  string         `json:"description"`
+	Creator      string         `gorm:"type:varchar(255)" json:"creator"`
+	Created      helper.CSTTime `json:"created"`
+	Modified     helper.CSTTime `json:"modified"`
+	Completed    helper.CSTTime `json:"completed"`
+	Releaseowner string         `gorm:"type:varchar(255)" json:"releaseowner"`
+	Launchdate   helper.CSTTime `json:"launchdate"`
+	Notice       string         `gorm:"type:varchar(255)" json:"notice"`
+	Releasename  string         `gorm:"type:varchar(255)" json:"releasename"`
 	common.NoPKModel
 }
 
diff --git a/plugins/tapd/models/iteration_bug.go b/plugins/tapd/models/iteration_bug.go
index c6906f76..091d754a 100644
--- a/plugins/tapd/models/iteration_bug.go
+++ b/plugins/tapd/models/iteration_bug.go
@@ -28,8 +28,8 @@ type TapdIterationBug struct {
 	IterationId    uint64 `gorm:"primaryKey"`
 	WorkspaceID    uint64 `gorm:"primaryKey"`
 	BugId          uint64 `gorm:"primaryKey"`
-	ResolutionDate *helper.CSTTime
-	BugCreatedDate *helper.CSTTime
+	ResolutionDate helper.CSTTime
+	BugCreatedDate helper.CSTTime
 }
 
 func (TapdIterationBug) TableName() string {
diff --git a/plugins/tapd/models/iteration_story.go b/plugins/tapd/models/iteration_story.go
index c2b51ce0..bb55fac2 100644
--- a/plugins/tapd/models/iteration_story.go
+++ b/plugins/tapd/models/iteration_story.go
@@ -29,8 +29,8 @@ type TapdIterationStory struct {
 	WorkspaceID  uint64 `gorm:"primaryKey"`
 
 	StoryId          uint64 `gorm:"primaryKey"`
-	ResolutionDate   *helper.CSTTime
-	StoryCreatedDate *helper.CSTTime
+	ResolutionDate   helper.CSTTime
+	StoryCreatedDate helper.CSTTime
 }
 
 func (TapdIterationStory) TableName() string {
diff --git a/plugins/tapd/models/iteration_task.go b/plugins/tapd/models/iteration_task.go
index 6de877b8..3d66f5ba 100644
--- a/plugins/tapd/models/iteration_task.go
+++ b/plugins/tapd/models/iteration_task.go
@@ -29,8 +29,8 @@ type TapdIterationTask struct {
 	WorkspaceID  uint64 `gorm:"primaryKey"`
 
 	TaskId          uint64 `gorm:"primaryKey"`
-	ResolutionDate  *helper.CSTTime
-	TaskCreatedDate *helper.CSTTime
+	ResolutionDate  helper.CSTTime
+	TaskCreatedDate helper.CSTTime
 }
 
 func (TapdIterationTask) TableName() string {
diff --git a/plugins/tapd/models/migrationscripts/archived/bug.go b/plugins/tapd/models/migrationscripts/archived/bug.go
index 979ff469..f4063b7f 100644
--- a/plugins/tapd/models/migrationscripts/archived/bug.go
+++ b/plugins/tapd/models/migrationscripts/archived/bug.go
@@ -26,88 +26,138 @@ type TapdBug struct {
 	ConnectionId uint64 `gorm:"primaryKey"`
 	ID           uint64 `gorm:"primaryKey;type:BIGINT" json:"id,string"`
 	EpicKey      string
-	Title        string `json:"name" gorm:"type:varchar(255)"`
-	Description  string
-	WorkspaceID  uint64          `json:"workspace_id,string"`
-	Created      *helper.CSTTime `json:"created"`
-	Modified     *helper.CSTTime `json:"modified" gorm:"index"`
-	Status       string          `json:"status"`
-	Cc           string          `json:"cc"`
-	Begin        *helper.CSTTime `json:"begin"`
-	Due          *helper.CSTTime `json:"due"`
-	Priority     string          `json:"priority"`
-	IterationID  uint64          `json:"iteration_id,string"`
-	Source       string          `json:"source"`
-	Module       string          `json:"module"`
-	ReleaseID    uint64          `json:"release_id,string"`
-	CreatedFrom  string          `json:"created_from"`
-	Feature      string          `json:"feature"`
+	Title        string         `json:"name" gorm:"type:varchar(255)"`
+	Description  string         `json:"description"`
+	WorkspaceID  uint64         `json:"workspace_id,string"`
+	Created      helper.CSTTime `json:"created"`
+	Modified     helper.CSTTime `json:"modified" gorm:"index"`
+	Status       string         `json:"status" gorm:"type:varchar(255)"`
+	Cc           string         `json:"cc" gorm:"type:varchar(255)"`
+	Begin        helper.CSTTime `json:"begin"`
+	Due          helper.CSTTime `json:"due"`
+	Priority     string         `json:"priority" gorm:"type:varchar(255)"`
+	IterationID  uint64         `json:"iteration_id,string"`
+	Source       string         `json:"source" gorm:"type:varchar(255)"`
+	Module       string         `json:"module" gorm:"type:varchar(255)"`
+	ReleaseID    uint64         `json:"release_id,string"`
+	CreatedFrom  string         `json:"created_from" gorm:"type:varchar(255)"`
+	Feature      string         `json:"feature" gorm:"type:varchar(255)"`
 	common.NoPKModel
 
-	Severity         string          `json:"severity"`
-	Reporter         string          `json:"reporter"`
-	Resolved         *helper.CSTTime `json:"resolved"`
-	Closed           *helper.CSTTime `json:"closed"`
-	Lastmodify       string          `json:"lastmodify"`
-	Auditer          string          `json:"auditer"`
-	De               string          `json:"De" gorm:"comment:developer"`
-	Fixer            string          `json:"fixer"`
-	VersionTest      string          `json:"version_test"`
-	VersionReport    string          `json:"version_report"`
-	VersionClose     string          `json:"version_close"`
-	VersionFix       string          `json:"version_fix"`
-	BaselineFind     string          `json:"baseline_find"`
-	BaselineJoin     string          `json:"baseline_join"`
-	BaselineClose    string          `json:"baseline_close"`
-	BaselineTest     string          `json:"baseline_test"`
-	Sourcephase      string          `json:"sourcephase"`
-	Te               string          `json:"te"`
-	CurrentOwner     string          `json:"current_owner"`
-	Resolution       string          `json:"resolution"`
-	Originphase      string          `json:"originphase"`
-	Confirmer        string          `json:"confirmer"`
-	Participator     string          `json:"participator"`
-	Closer           string          `json:"closer"`
-	Platform         string          `json:"platform"`
-	Os               string          `json:"os"`
-	Testtype         string          `json:"testtype"`
-	Testphase        string          `json:"testphase"`
-	Frequency        string          `json:"frequency"`
-	RegressionNumber string          `json:"regression_number"`
-	Flows            string          `json:"flows"`
-	Testmode         string          `json:"testmode"`
-	IssueID          uint64          `json:"issue_id,string"`
-	VerifyTime       *helper.CSTTime `json:"verify_time"`
-	RejectTime       *helper.CSTTime `json:"reject_time"`
-	ReopenTime       *helper.CSTTime `json:"reopen_time"`
-	AuditTime        *helper.CSTTime `json:"audit_time"`
-	SuspendTime      *helper.CSTTime `json:"suspend_time"`
-	Deadline         *helper.CSTTime `json:"deadline"`
-	InProgressTime   *helper.CSTTime `json:"in_progress_time"`
-	AssignedTime     *helper.CSTTime `json:"assigned_time"`
-	TemplateID       uint64          `json:"template_id,string"`
-	StoryID          uint64          `json:"story_id,string"`
-	StdStatus        string
-	StdType          string
-	Type             string
-	Url              string
+	Severity         string         `json:"severity" gorm:"type:varchar(255)"`
+	Reporter         string         `json:"reporter" gorm:"type:varchar(255)"`
+	Resolved         helper.CSTTime `json:"resolved"`
+	Closed           helper.CSTTime `json:"closed"`
+	Lastmodify       string         `json:"lastmodify" gorm:"type:varchar(255)"`
+	Auditer          string         `json:"auditer" gorm:"type:varchar(255)"`
+	De               string         `json:"De" gorm:"comment:developer"`
+	Fixer            string         `json:"fixer" gorm:"type:varchar(255)"`
+	VersionTest      string         `json:"version_test" gorm:"type:varchar(255)"`
+	VersionReport    string         `json:"version_report" gorm:"type:varchar(255)"`
+	VersionClose     string         `json:"version_close" gorm:"type:varchar(255)"`
+	VersionFix       string         `json:"version_fix" gorm:"type:varchar(255)"`
+	BaselineFind     string         `json:"baseline_find" gorm:"type:varchar(255)"`
+	BaselineJoin     string         `json:"baseline_join" gorm:"type:varchar(255)"`
+	BaselineClose    string         `json:"baseline_close" gorm:"type:varchar(255)"`
+	BaselineTest     string         `json:"baseline_test" gorm:"type:varchar(255)"`
+	Sourcephase      string         `json:"sourcephase" gorm:"type:varchar(255)"`
+	Te               string         `json:"te" gorm:"type:varchar(255)"`
+	CurrentOwner     string         `json:"current_owner" gorm:"type:varchar(255)"`
+	Resolution       string         `json:"resolution" gorm:"type:varchar(255)"`
+	Originphase      string         `json:"originphase" gorm:"type:varchar(255)"`
+	Confirmer        string         `json:"confirmer" gorm:"type:varchar(255)"`
+	Participator     string         `json:"participator" gorm:"type:varchar(255)"`
+	Closer           string         `json:"closer" gorm:"type:varchar(50)"`
+	Platform         string         `json:"platform" gorm:"type:varchar(50)"`
+	Os               string         `json:"os" gorm:"type:varchar(50)"`
+	Testtype         string         `json:"testtype" gorm:"type:varchar(20)"`
+	Testphase        string         `json:"testphase" gorm:"type:varchar(255)"`
+	Frequency        string         `json:"frequency" gorm:"type:varchar(255)"`
+	RegressionNumber string         `json:"regression_number" gorm:"type:varchar(20)"`
+	Flows            string         `json:"flows" gorm:"type:varchar(255)"`
+	Testmode         string         `json:"testmode" gorm:"type:varchar(50)"`
+	IssueID          uint64         `json:"issue_id,string"`
+	VerifyTime       helper.CSTTime `json:"verify_time"`
+	RejectTime       helper.CSTTime `json:"reject_time"`
+	ReopenTime       helper.CSTTime `json:"reopen_time"`
+	AuditTime        helper.CSTTime `json:"audit_time"`
+	SuspendTime      helper.CSTTime `json:"suspend_time"`
+	Deadline         helper.CSTTime `json:"deadline"`
+	InProgressTime   helper.CSTTime `json:"in_progress_time"`
+	AssignedTime     helper.CSTTime `json:"assigned_time"`
+	TemplateID       uint64         `json:"template_id,string"`
+	StoryID          uint64         `json:"story_id,string"`
+	StdStatus        string         `gorm:"type:varchar(20)"`
+	StdType          string         `gorm:"type:varchar(20)"`
+	Type             string         `gorm:"type:varchar(20)"`
+	Url              string         `gorm:"type:varchar(255)"`
 
 	SupportID       uint64  `json:"support_id,string"`
 	SupportForumID  uint64  `json:"support_forum_id,string"`
 	TicketID        uint64  `json:"ticket_id,string"`
-	Follower        string  `json:"follower"`
-	SyncType        string  `json:"sync_type"`
-	Label           string  `json:"label"`
+	Follower        string  `json:"follower" gorm:"type:varchar(255)"`
+	SyncType        string  `json:"sync_type" gorm:"type:text"`
+	Label           string  `json:"label" gorm:"type:varchar(255)"`
 	Effort          float32 `json:"effort,string"`
 	EffortCompleted float32 `json:"effort_completed,string"`
 	Exceed          float32 `json:"exceed,string"`
 	Remain          float32 `json:"remain,string"`
-	Progress        string  `json:"progress"`
+	Progress        string  `json:"progress" gorm:"type:varchar(255)"`
 	Estimate        float32 `json:"estimate,string"`
 
-	Bugtype string `json:"bugtype" gorm:"type:varchar(255)"`
+	Bugtype string `json:"bugtype" gorm:"type:varchar(20)"`
 
-	Milestone string `json:"milestone" gorm:"type:varchar(255)"`
+	Milestone        string `json:"milestone" gorm:"type:varchar(255)"`
+	CustomFieldOne   string `json:"custom_field_one" gorm:"type:text"`
+	CustomFieldTwo   string `json:"custom_field_two" gorm:"type:text"`
+	CustomFieldThree string `json:"custom_field_three" gorm:"type:text"`
+	CustomFieldFour  string `json:"custom_field_four" gorm:"type:text"`
+	CustomFieldFive  string `json:"custom_field_five" gorm:"type:text"`
+	CustomField6     string `json:"custom_field_6" gorm:"type:text"`
+	CustomField7     string `json:"custom_field_7" gorm:"type:text"`
+	CustomField8     string `json:"custom_field_8" gorm:"type:text"`
+	CustomField9     string `json:"custom_field_9" gorm:"type:text"`
+	CustomField10    string `json:"custom_field_10" gorm:"type:text"`
+	CustomField11    string `json:"custom_field_11" gorm:"type:text"`
+	CustomField12    string `json:"custom_field_12" gorm:"type:text"`
+	CustomField13    string `json:"custom_field_13" gorm:"type:text"`
+	CustomField14    string `json:"custom_field_14" gorm:"type:text"`
+	CustomField15    string `json:"custom_field_15" gorm:"type:text"`
+	CustomField16    string `json:"custom_field_16" gorm:"type:text"`
+	CustomField17    string `json:"custom_field_17" gorm:"type:text"`
+	CustomField18    string `json:"custom_field_18" gorm:"type:text"`
+	CustomField19    string `json:"custom_field_19" gorm:"type:text"`
+	CustomField20    string `json:"custom_field_20" gorm:"type:text"`
+	CustomField21    string `json:"custom_field_21" gorm:"type:text"`
+	CustomField22    string `json:"custom_field_22" gorm:"type:text"`
+	CustomField23    string `json:"custom_field_23" gorm:"type:text"`
+	CustomField24    string `json:"custom_field_24" gorm:"type:text"`
+	CustomField25    string `json:"custom_field_25" gorm:"type:text"`
+	CustomField26    string `json:"custom_field_26" gorm:"type:text"`
+	CustomField27    string `json:"custom_field_27" gorm:"type:text"`
+	CustomField28    string `json:"custom_field_28" gorm:"type:text"`
+	CustomField29    string `json:"custom_field_29" gorm:"type:text"`
+	CustomField30    string `json:"custom_field_30" gorm:"type:text"`
+	CustomField31    string `json:"custom_field_31" gorm:"type:text"`
+	CustomField32    string `json:"custom_field_32" gorm:"type:text"`
+	CustomField33    string `json:"custom_field_33" gorm:"type:text"`
+	CustomField34    string `json:"custom_field_34" gorm:"type:text"`
+	CustomField35    string `json:"custom_field_35" gorm:"type:text"`
+	CustomField36    string `json:"custom_field_36" gorm:"type:text"`
+	CustomField37    string `json:"custom_field_37" gorm:"type:text"`
+	CustomField38    string `json:"custom_field_38" gorm:"type:text"`
+	CustomField39    string `json:"custom_field_39" gorm:"type:text"`
+	CustomField40    string `json:"custom_field_40" gorm:"type:text"`
+	CustomField41    string `json:"custom_field_41" gorm:"type:text"`
+	CustomField42    string `json:"custom_field_42" gorm:"type:text"`
+	CustomField43    string `json:"custom_field_43" gorm:"type:text"`
+	CustomField44    string `json:"custom_field_44" gorm:"type:text"`
+	CustomField45    string `json:"custom_field_45" gorm:"type:text"`
+	CustomField46    string `json:"custom_field_46" gorm:"type:text"`
+	CustomField47    string `json:"custom_field_47" gorm:"type:text"`
+	CustomField48    string `json:"custom_field_48" gorm:"type:text"`
+	CustomField49    string `json:"custom_field_49" gorm:"type:text"`
+	CustomField50    string `json:"custom_field_50" gorm:"type:text"`
 }
 
 func (TapdBug) TableName() string {
diff --git a/plugins/tapd/models/migrationscripts/archived/bug_changelog.go b/plugins/tapd/models/migrationscripts/archived/bug_changelog.go
index 928f6d30..da3617db 100644
--- a/plugins/tapd/models/migrationscripts/archived/bug_changelog.go
+++ b/plugins/tapd/models/migrationscripts/archived/bug_changelog.go
@@ -23,16 +23,16 @@ import (
 )
 
 type TapdBugChangelog struct {
-	ConnectionId uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL"`
-	WorkspaceID  uint64          `gorm:"type:BIGINT  NOT NULL"`
-	ID           uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
-	BugID        uint64          `json:"bug_id,string"`
-	Author       string          `json:"author"`
-	Field        string          `gorm:"primaryKey;type:varchar(255)" json:"field"`
-	OldValue     string          `json:"old_value"`
-	NewValue     string          `json:"new_value"`
-	Memo         string          `json:"memo"`
-	Created      *helper.CSTTime `json:"created"`
+	ConnectionId uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL"`
+	WorkspaceID  uint64         `gorm:"type:BIGINT  NOT NULL"`
+	ID           uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
+	BugID        uint64         `json:"bug_id,string"`
+	Author       string         `json:"author" gorm:"type:varchar(255)"`
+	Field        string         `gorm:"primaryKey;type:varchar(255)" json:"field"`
+	OldValue     string         `json:"old_value"`
+	NewValue     string         `json:"new_value"`
+	Memo         string         `json:"memo" gorm:"type:text"`
+	Created      helper.CSTTime `json:"created"`
 	common.NoPKModel
 }
 
diff --git a/plugins/tapd/models/migrationscripts/archived/bug_commit.go b/plugins/tapd/models/migrationscripts/archived/bug_commit.go
index 5ad23a43..f47080b3 100644
--- a/plugins/tapd/models/migrationscripts/archived/bug_commit.go
+++ b/plugins/tapd/models/migrationscripts/archived/bug_commit.go
@@ -29,18 +29,18 @@ type TapdBugCommit struct {
 	UserID          string `json:"user_id" gorm:"type:varchar(255)"`
 	HookUserName    string `json:"hook_user_name" gorm:"type:varchar(255)"`
 	CommitID        string `json:"commit_id" gorm:"type:varchar(255)"`
-	WorkspaceID     uint64 `json:"workspace_id,string" gorm:"type:varchar(255)"`
-	Message         string `json:"message"`
+	WorkspaceID     uint64 `json:"workspace_id,string" gorm:"type:BIGINT"`
+	Message         string `json:"message" gorm:"type:text"`
 	Path            string `json:"path" gorm:"type:varchar(255)"`
 	WebURL          string `json:"web_url" gorm:"type:varchar(255)"`
 	HookProjectName string `json:"hook_project_name" gorm:"type:varchar(255)"`
 
-	Ref        string          `json:"ref" gorm:"type:varchar(255)"`
-	RefStatus  string          `json:"ref_status" gorm:"type:varchar(255)"`
-	GitEnv     string          `json:"git_env" gorm:"type:varchar(255)"`
-	FileCommit string          `json:"file_commit"`
-	CommitTime *helper.CSTTime `json:"commit_time"`
-	Created    *helper.CSTTime `json:"created"`
+	Ref        string         `json:"ref" gorm:"type:varchar(255)"`
+	RefStatus  string         `json:"ref_status" gorm:"type:varchar(255)"`
+	GitEnv     string         `json:"git_env" gorm:"type:varchar(255)"`
+	FileCommit string         `json:"file_commit"`
+	CommitTime helper.CSTTime `json:"commit_time"`
+	Created    helper.CSTTime `json:"created"`
 
 	BugId uint64
 	common.NoPKModel
diff --git a/plugins/tapd/models/migrationscripts/archived/bug_custom_field.go b/plugins/tapd/models/migrationscripts/archived/bug_custom_field.go
index 36a06c35..2dbb8677 100644
--- a/plugins/tapd/models/migrationscripts/archived/bug_custom_field.go
+++ b/plugins/tapd/models/migrationscripts/archived/bug_custom_field.go
@@ -6,11 +6,11 @@ type TapdBugCustomFields struct {
 	ConnectionId uint64 `gorm:"primaryKey;type:BIGINT  NOT NULL"`
 	ID           uint64 `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
 	WorkspaceID  uint64 `json:"workspace_id,string"`
-	EntryType    string `json:"entry_type" gorm:"type:varchar(255)"`
+	EntryType    string `json:"entry_type" gorm:"type:varchar(20)"`
 	CustomField  string `json:"custom_field" gorm:"type:varchar(255)"`
-	Type         string `json:"type" gorm:"type:varchar(255)"`
+	Type         string `json:"type" gorm:"type:varchar(20)"`
 	Name         string `json:"name" gorm:"type:varchar(255)"`
-	Options      string `json:"options"`
+	Options      string `json:"options" gorm:"type:text"`
 	Enabled      string `json:"enabled" gorm:"type:varchar(255)"`
 	Sort         string `json:"sort" gorm:"type:varchar(255)"`
 	common.NoPKModel
diff --git a/plugins/tapd/models/migrationscripts/archived/iteration.go b/plugins/tapd/models/migrationscripts/archived/iteration.go
index 0b90e693..396f45ab 100644
--- a/plugins/tapd/models/migrationscripts/archived/iteration.go
+++ b/plugins/tapd/models/migrationscripts/archived/iteration.go
@@ -23,23 +23,23 @@ import (
 )
 
 type TapdIteration struct {
-	ConnectionId uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL"`
-	ID           uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
-	Name         string          `gorm:"type:varchar(255)" json:"name"`
-	WorkspaceID  uint64          `json:"workspace_id,string"`
-	Startdate    *helper.CSTTime `json:"startdate"`
-	Enddate      *helper.CSTTime `json:"enddate"`
-	Status       string          `gorm:"type:varchar(255)" json:"status"`
-	ReleaseID    uint64          `gorm:"type:varchar(255)" json:"release_id,string"`
-	Description  string          `json:"description"`
-	Creator      string          `gorm:"type:varchar(255)" json:"creator"`
-	Created      *helper.CSTTime `json:"created"`
-	Modified     *helper.CSTTime `json:"modified"`
-	Completed    *helper.CSTTime `json:"completed"`
-	Releaseowner string          `gorm:"type:varchar(255)" json:"releaseowner"`
-	Launchdate   *helper.CSTTime `json:"launchdate"`
-	Notice       string          `gorm:"type:varchar(255)" json:"notice"`
-	Releasename  string          `gorm:"type:varchar(255)" json:"releasename"`
+	ConnectionId uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL"`
+	ID           uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
+	Name         string         `gorm:"type:varchar(255)" json:"name"`
+	WorkspaceID  uint64         `json:"workspace_id,string"`
+	Startdate    helper.CSTTime `json:"startdate"`
+	Enddate      helper.CSTTime `json:"enddate"`
+	Status       string         `gorm:"type:varchar(255)" json:"status"`
+	ReleaseID    uint64         `gorm:"type:BIGINT" json:"release_id,string"`
+	Description  string         `json:"description"`
+	Creator      string         `gorm:"type:varchar(255)" json:"creator"`
+	Created      helper.CSTTime `json:"created"`
+	Modified     helper.CSTTime `json:"modified"`
+	Completed    helper.CSTTime `json:"completed"`
+	Releaseowner string         `gorm:"type:varchar(255)" json:"releaseowner"`
+	Launchdate   helper.CSTTime `json:"launchdate"`
+	Notice       string         `gorm:"type:varchar(255)" json:"notice"`
+	Releasename  string         `gorm:"type:varchar(255)" json:"releasename"`
 	common.NoPKModel
 }
 
@@ -55,8 +55,8 @@ type TapdIterationIssue struct {
 	ConnectionId     uint64 `gorm:"primaryKey"`
 	IterationId      uint64 `gorm:"primaryKey"`
 	IssueId          uint64 `gorm:"primaryKey"`
-	ResolutionDate   *helper.CSTTime
-	IssueCreatedDate *helper.CSTTime
+	ResolutionDate   helper.CSTTime
+	IssueCreatedDate helper.CSTTime
 }
 
 func (TapdIteration) TableName() string {
diff --git a/plugins/tapd/models/migrationscripts/archived/iteration_bug.go b/plugins/tapd/models/migrationscripts/archived/iteration_bug.go
index 93e718fa..ca447090 100644
--- a/plugins/tapd/models/migrationscripts/archived/iteration_bug.go
+++ b/plugins/tapd/models/migrationscripts/archived/iteration_bug.go
@@ -28,8 +28,8 @@ type TapdIterationBug struct {
 	IterationId    uint64 `gorm:"primaryKey"`
 	WorkspaceID    uint64 `gorm:"primaryKey"`
 	BugId          uint64 `gorm:"primaryKey"`
-	ResolutionDate *helper.CSTTime
-	BugCreatedDate *helper.CSTTime
+	ResolutionDate helper.CSTTime
+	BugCreatedDate helper.CSTTime
 }
 
 func (TapdIterationBug) TableName() string {
diff --git a/plugins/tapd/models/migrationscripts/archived/iteration_story.go b/plugins/tapd/models/migrationscripts/archived/iteration_story.go
index 7743e871..5ffc720f 100644
--- a/plugins/tapd/models/migrationscripts/archived/iteration_story.go
+++ b/plugins/tapd/models/migrationscripts/archived/iteration_story.go
@@ -28,8 +28,8 @@ type TapdIterationStory struct {
 	IterationId      uint64 `gorm:"primaryKey"`
 	WorkspaceID      uint64 `gorm:"primaryKey"`
 	StoryId          uint64 `gorm:"primaryKey"`
-	ResolutionDate   *helper.CSTTime
-	StoryCreatedDate *helper.CSTTime
+	ResolutionDate   helper.CSTTime
+	StoryCreatedDate helper.CSTTime
 }
 
 func (TapdIterationStory) TableName() string {
diff --git a/plugins/tapd/models/migrationscripts/archived/iteration_task.go b/plugins/tapd/models/migrationscripts/archived/iteration_task.go
index 86ab3f01..e01a3cf7 100644
--- a/plugins/tapd/models/migrationscripts/archived/iteration_task.go
+++ b/plugins/tapd/models/migrationscripts/archived/iteration_task.go
@@ -28,8 +28,8 @@ type TapdIterationTask struct {
 	IterationId     uint64 `gorm:"primaryKey"`
 	TaskId          uint64 `gorm:"primaryKey"`
 	WorkspaceID     uint64 `gorm:"primaryKey"`
-	ResolutionDate  *helper.CSTTime
-	TaskCreatedDate *helper.CSTTime
+	ResolutionDate  helper.CSTTime
+	TaskCreatedDate helper.CSTTime
 }
 
 func (TapdIterationTask) TableName() string {
diff --git a/plugins/tapd/models/migrationscripts/archived/story.go b/plugins/tapd/models/migrationscripts/archived/story.go
index 43a8093f..728a99ab 100644
--- a/plugins/tapd/models/migrationscripts/archived/story.go
+++ b/plugins/tapd/models/migrationscripts/archived/story.go
@@ -23,60 +23,111 @@ import (
 )
 
 type TapdStory struct {
-	ConnectionId    uint64          `gorm:"primaryKey"`
-	ID              uint64          `gorm:"primaryKey;type:BIGINT" json:"id,string"`
-	WorkitemTypeID  uint64          `json:"workitem_type_id,string"`
-	Name            string          `gorm:"type:varchar(255)" json:"name"`
-	Description     string          `json:"description"`
-	WorkspaceID     uint64          `json:"workspace_id,string"`
-	Creator         string          `gorm:"type:varchar(255)"`
-	Created         *helper.CSTTime `json:"created"`
-	Modified        *helper.CSTTime `json:"modified" gorm:"index"`
-	Status          string          `json:"status" gorm:"type:varchar(255)"`
-	Owner           string          `json:"owner" gorm:"type:varchar(255)"`
-	Cc              string          `json:"cc" gorm:"type:varchar(255)"`
-	Begin           *helper.CSTTime `json:"begin"`
-	Due             *helper.CSTTime `json:"due"`
-	Size            int16           `json:"size,string"`
-	Priority        string          `gorm:"type:varchar(255)" json:"priority"`
-	Developer       string          `gorm:"type:varchar(255)" json:"developer"`
-	IterationID     uint64          `json:"iteration_id,string"`
-	TestFocus       string          `json:"test_focus" gorm:"type:varchar(255)"`
-	Type            string          `json:"type" gorm:"type:varchar(255)"`
-	Source          string          `json:"source" gorm:"type:varchar(255)"`
-	Module          string          `json:"module" gorm:"type:varchar(255)"`
-	Version         string          `json:"version" gorm:"type:varchar(255)"`
-	Completed       *helper.CSTTime `json:"completed"`
-	CategoryID      uint64          `json:"category_id,string"`
-	Path            string          `gorm:"type:varchar(255)" json:"path"`
-	ParentID        uint64          `json:"parent_id,string"`
-	ChildrenID      string          `gorm:"type:varchar(255)" json:"children_id"`
-	AncestorID      uint64          `json:"ancestor_id,string"`
-	BusinessValue   string          `gorm:"type:varchar(255)" json:"business_value"`
-	Effort          float32         `json:"effort,string"`
-	EffortCompleted float32         `json:"effort_completed,string"`
-	Exceed          float32         `json:"exceed,string"`
-	Remain          float32         `json:"remain,string"`
-	ReleaseID       uint64          `json:"release_id,string"`
-	Confidential    string          `gorm:"type:varchar(255)" json:"confidential"`
-	TemplatedID     uint64          `json:"templated_id,string"`
-	CreatedFrom     string          `gorm:"type:varchar(255)" json:"created_from"`
-	Feature         string          `gorm:"type:varchar(255)" json:"feature"`
-	StdStatus       string
-	StdType         string
-	Url             string
+	ConnectionId    uint64         `gorm:"primaryKey"`
+	ID              uint64         `gorm:"primaryKey;type:BIGINT" json:"id,string"`
+	WorkitemTypeID  uint64         `json:"workitem_type_id,string"`
+	Name            string         `gorm:"type:varchar(255)" json:"name"`
+	Description     string         `json:"description"`
+	WorkspaceID     uint64         `json:"workspace_id,string"`
+	Creator         string         `gorm:"type:varchar(255)"`
+	Created         helper.CSTTime `json:"created"`
+	Modified        helper.CSTTime `json:"modified" gorm:"index"`
+	Status          string         `json:"status" gorm:"type:varchar(255)"`
+	Owner           string         `json:"owner" gorm:"type:varchar(255)"`
+	Cc              string         `json:"cc" gorm:"type:varchar(255)"`
+	Begin           helper.CSTTime `json:"begin"`
+	Due             helper.CSTTime `json:"due"`
+	Size            int16          `json:"size,string"`
+	Priority        string         `gorm:"type:varchar(255)" json:"priority"`
+	Developer       string         `gorm:"type:varchar(255)" json:"developer"`
+	IterationID     uint64         `json:"iteration_id,string"`
+	TestFocus       string         `json:"test_focus" gorm:"type:varchar(255)"`
+	Type            string         `json:"type" gorm:"type:varchar(20)"`
+	Source          string         `json:"source" gorm:"type:varchar(255)"`
+	Module          string         `json:"module" gorm:"type:varchar(255)"`
+	Version         string         `json:"version" gorm:"type:varchar(255)"`
+	Completed       helper.CSTTime `json:"completed"`
+	CategoryID      int64          `json:"category_id,string"`
+	Path            string         `gorm:"type:varchar(255)" json:"path"`
+	ParentID        uint64         `json:"parent_id,string"`
+	ChildrenID      string         `gorm:"type:text" json:"children_id"`
+	AncestorID      uint64         `json:"ancestor_id,string"`
+	BusinessValue   string         `gorm:"type:varchar(255)" json:"business_value"`
+	Effort          float32        `json:"effort,string"`
+	EffortCompleted float32        `json:"effort_completed,string"`
+	Exceed          float32        `json:"exceed,string"`
+	Remain          float32        `json:"remain,string"`
+	ReleaseID       uint64         `json:"release_id,string"`
+	Confidential    string         `gorm:"type:varchar(255)" json:"confidential"`
+	TemplatedID     uint64         `json:"templated_id,string"`
+	CreatedFrom     string         `gorm:"type:varchar(255)" json:"created_from"`
+	Feature         string         `gorm:"type:varchar(255)" json:"feature"`
+	StdStatus       string         `gorm:"type:varchar(20)"`
+	StdType         string         `gorm:"type:varchar(20)"`
+	Url             string         `gorm:"type:varchar(255)"`
 
 	AttachmentCount  int16  `json:"attachment_count,string"`
 	HasAttachment    string `json:"has_attachment" gorm:"type:varchar(255)"`
 	BugID            uint64 `json:"bug_id,string"`
 	Follower         string `json:"follower" gorm:"type:varchar(255)"`
-	SyncType         string `json:"sync_type" gorm:"type:varchar(255)"`
+	SyncType         string `json:"sync_type" gorm:"type:text"`
 	PredecessorCount int16  `json:"predecessor_count,string"`
 	IsArchived       string `json:"is_archived" gorm:"type:varchar(255)"`
 	Modifier         string `json:"modifier" gorm:"type:varchar(255)"`
 	ProgressManual   string `json:"progress_manual" gorm:"type:varchar(255)"`
 	SuccessorCount   int16  `json:"successor_count,string"`
 	Label            string `json:"label" gorm:"type:varchar(255)"`
+	CustomFieldOne   string `json:"custom_field_one" gorm:"type:text"`
+	CustomFieldTwo   string `json:"custom_field_two" gorm:"type:text"`
+	CustomFieldThree string `json:"custom_field_three" gorm:"type:text"`
+	CustomFieldFour  string `json:"custom_field_four" gorm:"type:text"`
+	CustomFieldFive  string `json:"custom_field_five" gorm:"type:text"`
+	CustomField6     string `json:"custom_field_6" gorm:"type:text"`
+	CustomField7     string `json:"custom_field_7" gorm:"type:text"`
+	CustomField8     string `json:"custom_field_8" gorm:"type:text"`
+	CustomField9     string `json:"custom_field_9" gorm:"type:text"`
+	CustomField10    string `json:"custom_field_10" gorm:"type:text"`
+	CustomField11    string `json:"custom_field_11" gorm:"type:text"`
+	CustomField12    string `json:"custom_field_12" gorm:"type:text"`
+	CustomField13    string `json:"custom_field_13" gorm:"type:text"`
+	CustomField14    string `json:"custom_field_14" gorm:"type:text"`
+	CustomField15    string `json:"custom_field_15" gorm:"type:text"`
+	CustomField16    string `json:"custom_field_16" gorm:"type:text"`
+	CustomField17    string `json:"custom_field_17" gorm:"type:text"`
+	CustomField18    string `json:"custom_field_18" gorm:"type:text"`
+	CustomField19    string `json:"custom_field_19" gorm:"type:text"`
+	CustomField20    string `json:"custom_field_20" gorm:"type:text"`
+	CustomField21    string `json:"custom_field_21" gorm:"type:text"`
+	CustomField22    string `json:"custom_field_22" gorm:"type:text"`
+	CustomField23    string `json:"custom_field_23" gorm:"type:text"`
+	CustomField24    string `json:"custom_field_24" gorm:"type:text"`
+	CustomField25    string `json:"custom_field_25" gorm:"type:text"`
+	CustomField26    string `json:"custom_field_26" gorm:"type:text"`
+	CustomField27    string `json:"custom_field_27" gorm:"type:text"`
+	CustomField28    string `json:"custom_field_28" gorm:"type:text"`
+	CustomField29    string `json:"custom_field_29" gorm:"type:text"`
+	CustomField30    string `json:"custom_field_30" gorm:"type:text"`
+	CustomField31    string `json:"custom_field_31" gorm:"type:text"`
+	CustomField32    string `json:"custom_field_32" gorm:"type:text"`
+	CustomField33    string `json:"custom_field_33" gorm:"type:text"`
+	CustomField34    string `json:"custom_field_34" gorm:"type:text"`
+	CustomField35    string `json:"custom_field_35" gorm:"type:text"`
+	CustomField36    string `json:"custom_field_36" gorm:"type:text"`
+	CustomField37    string `json:"custom_field_37" gorm:"type:text"`
+	CustomField38    string `json:"custom_field_38" gorm:"type:text"`
+	CustomField39    string `json:"custom_field_39" gorm:"type:text"`
+	CustomField40    string `json:"custom_field_40" gorm:"type:text"`
+	CustomField41    string `json:"custom_field_41" gorm:"type:text"`
+	CustomField42    string `json:"custom_field_42" gorm:"type:text"`
+	CustomField43    string `json:"custom_field_43" gorm:"type:text"`
+	CustomField44    string `json:"custom_field_44" gorm:"type:text"`
+	CustomField45    string `json:"custom_field_45" gorm:"type:text"`
+	CustomField46    string `json:"custom_field_46" gorm:"type:text"`
+	CustomField47    string `json:"custom_field_47" gorm:"type:text"`
+	CustomField48    string `json:"custom_field_48" gorm:"type:text"`
+	CustomField49    string `json:"custom_field_49" gorm:"type:text"`
+	CustomField50    string `json:"custom_field_50" gorm:"type:text"`
+
 	common.NoPKModel
 }
 
diff --git a/plugins/tapd/models/migrationscripts/archived/story_category.go b/plugins/tapd/models/migrationscripts/archived/story_category.go
index b9267fac..d85519e8 100644
--- a/plugins/tapd/models/migrationscripts/archived/story_category.go
+++ b/plugins/tapd/models/migrationscripts/archived/story_category.go
@@ -6,13 +6,13 @@ import (
 )
 
 type TapdStoryCategory struct {
-	ConnectionId uint64          `gorm:"primaryKey"`
-	ID           uint64          `gorm:"primaryKey;type:BIGINT" json:"id,string"`
-	Name         string          `json:"name" gorm:"type:varchar(255)"`
-	Description  string          `json:"description"`
-	ParentID     uint64          `json:"parent_id,string"`
-	Created      *helper.CSTTime `json:"created"`
-	Modified     *helper.CSTTime `json:"modified"`
+	ConnectionId uint64         `gorm:"primaryKey"`
+	ID           uint64         `gorm:"primaryKey;type:BIGINT" json:"id,string"`
+	Name         string         `json:"name" gorm:"type:varchar(255)"`
+	Description  string         `json:"description"`
+	ParentID     uint64         `json:"parent_id,string"`
+	Created      helper.CSTTime `json:"created"`
+	Modified     helper.CSTTime `json:"modified"`
 	common.NoPKModel
 }
 
diff --git a/plugins/tapd/models/migrationscripts/archived/story_changelog.go b/plugins/tapd/models/migrationscripts/archived/story_changelog.go
index 8321c7bc..21bd23f6 100644
--- a/plugins/tapd/models/migrationscripts/archived/story_changelog.go
+++ b/plugins/tapd/models/migrationscripts/archived/story_changelog.go
@@ -23,17 +23,17 @@ import (
 )
 
 type TapdStoryChangelog struct {
-	ConnectionId   uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL"`
-	ID             uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
-	WorkspaceID    uint64          `json:"workspace_id,string"`
-	WorkitemTypeID uint64          `json:"workitem_type_id,string"`
-	Creator        string          `json:"creator"`
-	Created        *helper.CSTTime `json:"created"`
-	ChangeSummary  string          `json:"change_summary"`
-	Comment        string          `json:"comment"`
-	EntityType     string          `json:"entity_type"`
-	ChangeType     string          `json:"change_type"`
-	StoryID        uint64          `json:"story_id,string"`
+	ConnectionId   uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL"`
+	ID             uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
+	WorkspaceID    uint64         `json:"workspace_id,string"`
+	WorkitemTypeID uint64         `json:"workitem_type_id,string"`
+	Creator        string         `json:"creator" gorm:"type:varchar(255)"`
+	Created        helper.CSTTime `json:"created"`
+	ChangeSummary  string         `json:"change_summary" gorm:"type:varchar(255)"`
+	Comment        string         `json:"comment"`
+	EntityType     string         `json:"entity_type" gorm:"type:varchar(255)"`
+	ChangeType     string         `json:"change_type" gorm:"type:varchar(255)"`
+	StoryID        uint64         `json:"story_id,string"`
 	common.NoPKModel
 	FieldChanges []TapdStoryChangelogItem `json:"field_changes" gorm:"-"`
 }
diff --git a/plugins/tapd/models/migrationscripts/archived/story_commits.go b/plugins/tapd/models/migrationscripts/archived/story_commits.go
index e8b7d481..438508bd 100644
--- a/plugins/tapd/models/migrationscripts/archived/story_commits.go
+++ b/plugins/tapd/models/migrationscripts/archived/story_commits.go
@@ -29,18 +29,18 @@ type TapdStoryCommit struct {
 	UserID          string `json:"user_id" gorm:"type:varchar(255)"`
 	HookUserName    string `json:"hook_user_name" gorm:"type:varchar(255)"`
 	CommitID        string `json:"commit_id" gorm:"type:varchar(255)"`
-	WorkspaceID     uint64 `json:"workspace_id,string" gorm:"type:varchar(255)"`
-	Message         string `json:"message"`
+	WorkspaceID     uint64 `json:"workspace_id,string" gorm:"type:BIGINT"`
+	Message         string `json:"message" gorm:"type:text"`
 	Path            string `json:"path" gorm:"type:varchar(255)"`
 	WebURL          string `json:"web_url" gorm:"type:varchar(255)"`
 	HookProjectName string `json:"hook_project_name" gorm:"type:varchar(255)"`
 
-	Ref        string          `json:"ref" gorm:"type:varchar(255)"`
-	RefStatus  string          `json:"ref_status" gorm:"type:varchar(255)"`
-	GitEnv     string          `json:"git_env" gorm:"type:varchar(255)"`
-	FileCommit string          `json:"file_commit"`
-	CommitTime *helper.CSTTime `json:"commit_time"`
-	Created    *helper.CSTTime `json:"created"`
+	Ref        string         `json:"ref" gorm:"type:varchar(255)"`
+	RefStatus  string         `json:"ref_status" gorm:"type:varchar(255)"`
+	GitEnv     string         `json:"git_env" gorm:"type:varchar(255)"`
+	FileCommit string         `json:"file_commit"`
+	CommitTime helper.CSTTime `json:"commit_time"`
+	Created    helper.CSTTime `json:"created"`
 
 	StoryId uint64
 	common.NoPKModel
diff --git a/plugins/tapd/models/migrationscripts/archived/story_custom_field.go b/plugins/tapd/models/migrationscripts/archived/story_custom_field.go
index 312f87ce..0c951804 100644
--- a/plugins/tapd/models/migrationscripts/archived/story_custom_field.go
+++ b/plugins/tapd/models/migrationscripts/archived/story_custom_field.go
@@ -6,11 +6,11 @@ type TapdStoryCustomFields struct {
 	ConnectionId uint64 `gorm:"primaryKey;type:BIGINT  NOT NULL"`
 	ID           uint64 `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
 	WorkspaceID  uint64 `json:"workspace_id,string"`
-	EntryType    string `json:"entry_type" gorm:"type:varchar(255)"`
+	EntryType    string `json:"entry_type" gorm:"type:varchar(20)"`
 	CustomField  string `json:"custom_field" gorm:"type:varchar(255)"`
-	Type         string `json:"type" gorm:"type:varchar(255)"`
+	Type         string `json:"type" gorm:"type:varchar(20)"`
 	Name         string `json:"name" gorm:"type:varchar(255)"`
-	Options      string `json:"options"`
+	Options      string `json:"options" gorm:"type:text"`
 	Enabled      string `json:"enabled" gorm:"type:varchar(255)"`
 	Sort         string `json:"sort" gorm:"type:varchar(255)"`
 	common.NoPKModel
diff --git a/plugins/tapd/models/migrationscripts/archived/task.go b/plugins/tapd/models/migrationscripts/archived/task.go
index 09d6ca81..81398c4a 100644
--- a/plugins/tapd/models/migrationscripts/archived/task.go
+++ b/plugins/tapd/models/migrationscripts/archived/task.go
@@ -23,33 +23,33 @@ import (
 )
 
 type TapdTask struct {
-	ConnectionId    uint64          `gorm:"primaryKey"`
-	ID              uint64          `gorm:"primaryKey;type:BIGINT" json:"id,string"`
-	Name            string          `gorm:"type:varchar(255)" json:"name"`
-	Description     string          `json:"description"`
-	WorkspaceID     uint64          `json:"workspace_id,string"`
-	Creator         string          `gorm:"type:varchar(255)" json:"creator"`
-	Created         *helper.CSTTime `json:"created"`
-	Modified        *helper.CSTTime `json:"modified" gorm:"index"`
-	Status          string          `json:"status" gorm:"type:varchar(255)"`
-	Owner           string          `json:"owner" gorm:"type:varchar(255)"`
-	Cc              string          `json:"cc" gorm:"type:varchar(255)"`
-	Begin           *helper.CSTTime `json:"begin"`
-	Due             *helper.CSTTime `json:"due"`
-	Priority        string          `gorm:"type:varchar(255)" json:"priority"`
-	IterationID     uint64          `json:"iteration_id,string"`
-	Completed       *helper.CSTTime `json:"completed"`
-	Effort          float32         `json:"effort,string"`
-	EffortCompleted float32         `json:"effort_completed,string"`
-	Exceed          float32         `json:"exceed,string"`
-	Remain          float32         `json:"remain,string"`
-	StdStatus       string
-	StdType         string
-	Type            string
-	StoryID         uint64 `json:"story_id,string"`
-	Progress        int16  `json:"progress,string"`
-	HasAttachment   string `gorm:"type:varchar(255)"`
-	Url             string
+	ConnectionId    uint64         `gorm:"primaryKey"`
+	ID              uint64         `gorm:"primaryKey;type:BIGINT" json:"id,string"`
+	Name            string         `gorm:"type:varchar(255)" json:"name"`
+	Description     string         `json:"description"`
+	WorkspaceID     uint64         `json:"workspace_id,string"`
+	Creator         string         `gorm:"type:varchar(255)" json:"creator"`
+	Created         helper.CSTTime `json:"created"`
+	Modified        helper.CSTTime `json:"modified" gorm:"index"`
+	Status          string         `json:"status" gorm:"type:varchar(255)"`
+	Owner           string         `json:"owner" gorm:"type:varchar(255)"`
+	Cc              string         `json:"cc" gorm:"type:varchar(255)"`
+	Begin           helper.CSTTime `json:"begin"`
+	Due             helper.CSTTime `json:"due"`
+	Priority        string         `gorm:"type:varchar(255)" json:"priority"`
+	IterationID     uint64         `json:"iteration_id,string"`
+	Completed       helper.CSTTime `json:"completed"`
+	Effort          float32        `json:"effort,string"`
+	EffortCompleted float32        `json:"effort_completed,string"`
+	Exceed          float32        `json:"exceed,string"`
+	Remain          float32        `json:"remain,string"`
+	StdStatus       string         `gorm:"type:varchar(20)"`
+	StdType         string         `gorm:"type:varchar(20)"`
+	Type            string         `gorm:"type:varchar(20)"`
+	StoryID         uint64         `json:"story_id,string"`
+	Progress        int16          `json:"progress,string"`
+	HasAttachment   string         `gorm:"type:varchar(255)"`
+	Url             string         `gorm:"type:varchar(255)"`
 
 	AttachmentCount  int16  `json:"attachment_count,string"`
 	Follower         string `json:"follower" gorm:"type:varchar(255)"`
@@ -59,6 +59,56 @@ type TapdTask struct {
 	ReleaseId        uint64 `json:"release_id,string"`
 	Label            string `json:"label" gorm:"type:varchar(255)"`
 	NewStoryId       uint64 `json:"new_story_id,string"`
+	CustomFieldOne   string `json:"custom_field_one" gorm:"type:text"`
+	CustomFieldTwo   string `json:"custom_field_two" gorm:"type:text"`
+	CustomFieldThree string `json:"custom_field_three" gorm:"type:text"`
+	CustomFieldFour  string `json:"custom_field_four" gorm:"type:text"`
+	CustomFieldFive  string `json:"custom_field_five" gorm:"type:text"`
+	CustomField6     string `json:"custom_field_6" gorm:"type:text"`
+	CustomField7     string `json:"custom_field_7" gorm:"type:text"`
+	CustomField8     string `json:"custom_field_8" gorm:"type:text"`
+	CustomField9     string `json:"custom_field_9" gorm:"type:text"`
+	CustomField10    string `json:"custom_field_10" gorm:"type:text"`
+	CustomField11    string `json:"custom_field_11" gorm:"type:text"`
+	CustomField12    string `json:"custom_field_12" gorm:"type:text"`
+	CustomField13    string `json:"custom_field_13" gorm:"type:text"`
+	CustomField14    string `json:"custom_field_14" gorm:"type:text"`
+	CustomField15    string `json:"custom_field_15" gorm:"type:text"`
+	CustomField16    string `json:"custom_field_16" gorm:"type:text"`
+	CustomField17    string `json:"custom_field_17" gorm:"type:text"`
+	CustomField18    string `json:"custom_field_18" gorm:"type:text"`
+	CustomField19    string `json:"custom_field_19" gorm:"type:text"`
+	CustomField20    string `json:"custom_field_20" gorm:"type:text"`
+	CustomField21    string `json:"custom_field_21" gorm:"type:text"`
+	CustomField22    string `json:"custom_field_22" gorm:"type:text"`
+	CustomField23    string `json:"custom_field_23" gorm:"type:text"`
+	CustomField24    string `json:"custom_field_24" gorm:"type:text"`
+	CustomField25    string `json:"custom_field_25" gorm:"type:text"`
+	CustomField26    string `json:"custom_field_26" gorm:"type:text"`
+	CustomField27    string `json:"custom_field_27" gorm:"type:text"`
+	CustomField28    string `json:"custom_field_28" gorm:"type:text"`
+	CustomField29    string `json:"custom_field_29" gorm:"type:text"`
+	CustomField30    string `json:"custom_field_30" gorm:"type:text"`
+	CustomField31    string `json:"custom_field_31" gorm:"type:text"`
+	CustomField32    string `json:"custom_field_32" gorm:"type:text"`
+	CustomField33    string `json:"custom_field_33" gorm:"type:text"`
+	CustomField34    string `json:"custom_field_34" gorm:"type:text"`
+	CustomField35    string `json:"custom_field_35" gorm:"type:text"`
+	CustomField36    string `json:"custom_field_36" gorm:"type:text"`
+	CustomField37    string `json:"custom_field_37" gorm:"type:text"`
+	CustomField38    string `json:"custom_field_38" gorm:"type:text"`
+	CustomField39    string `json:"custom_field_39" gorm:"type:text"`
+	CustomField40    string `json:"custom_field_40" gorm:"type:text"`
+	CustomField41    string `json:"custom_field_41" gorm:"type:text"`
+	CustomField42    string `json:"custom_field_42" gorm:"type:text"`
+	CustomField43    string `json:"custom_field_43" gorm:"type:text"`
+	CustomField44    string `json:"custom_field_44" gorm:"type:text"`
+	CustomField45    string `json:"custom_field_45" gorm:"type:text"`
+	CustomField46    string `json:"custom_field_46" gorm:"type:text"`
+	CustomField47    string `json:"custom_field_47" gorm:"type:text"`
+	CustomField48    string `json:"custom_field_48" gorm:"type:text"`
+	CustomField49    string `json:"custom_field_49" gorm:"type:text"`
+	CustomField50    string `json:"custom_field_50" gorm:"type:text"`
 	common.NoPKModel
 }
 
diff --git a/plugins/tapd/models/migrationscripts/archived/task_changelog.go b/plugins/tapd/models/migrationscripts/archived/task_changelog.go
index 52ea2d9e..41559a2a 100644
--- a/plugins/tapd/models/migrationscripts/archived/task_changelog.go
+++ b/plugins/tapd/models/migrationscripts/archived/task_changelog.go
@@ -23,18 +23,18 @@ import (
 )
 
 type TapdTaskChangelog struct {
-	ConnectionId   uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL"`
-	ID             uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
-	WorkspaceID    uint64          `json:"workspace_id,string"`
-	WorkitemTypeID uint64          `json:"workitem_type_id,string"`
-	Creator        string          `json:"creator"`
-	Created        *helper.CSTTime `json:"created"`
-	ChangeSummary  string          `json:"change_summary"`
-	Comment        string          `json:"comment"`
-	EntityType     string          `json:"entity_type"`
-	ChangeType     string          `json:"change_type"`
-	ChangeTypeText string          `json:"change_type_text"`
-	TaskID         uint64          `json:"task_id,string"`
+	ConnectionId   uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL"`
+	ID             uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
+	WorkspaceID    uint64         `json:"workspace_id,string"`
+	WorkitemTypeID uint64         `json:"workitem_type_id,string"`
+	Creator        string         `json:"creator" gorm:"type:varchar(255)"`
+	Created        helper.CSTTime `json:"created"`
+	ChangeSummary  string         `json:"change_summary" gorm:"type:varchar(255)"`
+	Comment        string         `json:"comment"`
+	EntityType     string         `json:"entity_type" gorm:"type:varchar(255)"`
+	ChangeType     string         `json:"change_type" gorm:"type:varchar(255)"`
+	ChangeTypeText string         `json:"change_type_text" gorm:"type:varchar(255)"`
+	TaskID         uint64         `json:"task_id,string"`
 	common.NoPKModel
 	FieldChanges []TapdTaskChangelogItem `json:"field_changes" gorm:"-"`
 }
diff --git a/plugins/tapd/models/migrationscripts/archived/task_commits.go b/plugins/tapd/models/migrationscripts/archived/task_commits.go
index 79e81b0e..91d6dc8d 100644
--- a/plugins/tapd/models/migrationscripts/archived/task_commits.go
+++ b/plugins/tapd/models/migrationscripts/archived/task_commits.go
@@ -29,18 +29,18 @@ type TapdTaskCommit struct {
 	UserID          string `json:"user_id" gorm:"type:varchar(255)"`
 	HookUserName    string `json:"hook_user_name" gorm:"type:varchar(255)"`
 	CommitID        string `json:"commit_id" gorm:"type:varchar(255)"`
-	WorkspaceID     uint64 `json:"workspace_id,string" gorm:"type:varchar(255)"`
-	Message         string `json:"message"`
+	WorkspaceID     uint64 `json:"workspace_id,string" gorm:"type:BIGINT"`
+	Message         string `json:"message" gorm:"type:text"`
 	Path            string `json:"path" gorm:"type:varchar(255)"`
 	WebURL          string `json:"web_url" gorm:"type:varchar(255)"`
 	HookProjectName string `json:"hook_project_name" gorm:"type:varchar(255)"`
 
-	Ref        string          `json:"ref" gorm:"type:varchar(255)"`
-	RefStatus  string          `json:"ref_status" gorm:"type:varchar(255)"`
-	GitEnv     string          `json:"git_env" gorm:"type:varchar(255)"`
-	FileCommit string          `json:"file_commit"`
-	CommitTime *helper.CSTTime `json:"commit_time"`
-	Created    *helper.CSTTime `json:"created"`
+	Ref        string         `json:"ref" gorm:"type:varchar(255)"`
+	RefStatus  string         `json:"ref_status" gorm:"type:varchar(255)"`
+	GitEnv     string         `json:"git_env" gorm:"type:varchar(255)"`
+	FileCommit string         `json:"file_commit"`
+	CommitTime helper.CSTTime `json:"commit_time"`
+	Created    helper.CSTTime `json:"created"`
 
 	TaskId uint64
 	common.NoPKModel
diff --git a/plugins/tapd/models/migrationscripts/archived/task_custom_field.go b/plugins/tapd/models/migrationscripts/archived/task_custom_field.go
index b069c8fa..dfd906db 100644
--- a/plugins/tapd/models/migrationscripts/archived/task_custom_field.go
+++ b/plugins/tapd/models/migrationscripts/archived/task_custom_field.go
@@ -6,11 +6,11 @@ type TapdTaskCustomFields struct {
 	ConnectionId uint64 `gorm:"primaryKey;type:BIGINT  NOT NULL"`
 	ID           uint64 `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
 	WorkspaceID  uint64 `json:"workspace_id,string"`
-	EntryType    string `json:"entry_type" gorm:"type:varchar(255)"`
+	EntryType    string `json:"entry_type" gorm:"type:varchar(20)"`
 	CustomField  string `json:"custom_field" gorm:"type:varchar(255)"`
-	Type         string `json:"type" gorm:"type:varchar(255)"`
+	Type         string `json:"type" gorm:"type:varchar(20)"`
 	Name         string `json:"name" gorm:"type:varchar(255)"`
-	Options      string `json:"options"`
+	Options      string `json:"options" gorm:"type:text"`
 	Enabled      string `json:"enabled" gorm:"type:varchar(255)"`
 	Sort         string `json:"sort" gorm:"type:varchar(255)"`
 	common.NoPKModel
diff --git a/plugins/tapd/models/migrationscripts/archived/worklog.go b/plugins/tapd/models/migrationscripts/archived/worklog.go
index 3b0a268b..f553b510 100644
--- a/plugins/tapd/models/migrationscripts/archived/worklog.go
+++ b/plugins/tapd/models/migrationscripts/archived/worklog.go
@@ -23,16 +23,16 @@ import (
 )
 
 type TapdWorklog struct {
-	ConnectionId uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL"`
-	ID           uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
-	WorkspaceID  uint64          `json:"workspace_id,string"`
-	EntityType   string          `gorm:"type:varchar(255)" json:"entity_type"`
-	EntityID     uint64          `json:"entity_id,string"`
-	Timespent    float32         `json:"timespent,string"`
-	Spentdate    *helper.CSTTime `json:"spentdate"`
-	Owner        string          `gorm:"type:varchar(255)" json:"owner"`
-	Created      *helper.CSTTime `json:"created"`
-	Memo         string          `gorm:"type:varchar(255)" json:"memo"`
+	ConnectionId uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL"`
+	ID           uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
+	WorkspaceID  uint64         `json:"workspace_id,string"`
+	EntityType   string         `gorm:"type:varchar(255)" json:"entity_type"`
+	EntityID     uint64         `json:"entity_id,string"`
+	Timespent    float32        `json:"timespent,string"`
+	Spentdate    helper.CSTTime `json:"spentdate"`
+	Owner        string         `gorm:"type:varchar(255)" json:"owner"`
+	Created      helper.CSTTime `json:"created"`
+	Memo         string         `json:"memo" gorm:"type:text"`
 	common.NoPKModel
 }
 
diff --git a/plugins/tapd/models/migrationscripts/archived/workspace.go b/plugins/tapd/models/migrationscripts/archived/workspace.go
index 2c5cb918..8d0a81c1 100644
--- a/plugins/tapd/models/migrationscripts/archived/workspace.go
+++ b/plugins/tapd/models/migrationscripts/archived/workspace.go
@@ -23,19 +23,19 @@ import (
 )
 
 type TapdWorkspace struct {
-	ConnectionId uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL"`
-	ID           uint64          `gorm:"primaryKey;type:BIGINT" json:"id,string"`
-	Name         string          `gorm:"type:varchar(255)" json:"name"`
-	PrettyName   string          `gorm:"type:varchar(255)" json:"pretty_name"`
-	Category     string          `gorm:"type:varchar(255)" json:"category"`
-	Status       string          `gorm:"type:varchar(255)" json:"status"`
-	Description  string          `json:"description"`
-	BeginDate    *helper.CSTTime `json:"begin_date"`
-	EndDate      *helper.CSTTime `json:"end_date"`
-	ExternalOn   string          `gorm:"type:varchar(255)" json:"external_on"`
-	ParentId     uint64          `gorm:"type:BIGINT" json:"parent_id,string"`
-	Creator      string          `gorm:"type:varchar(255)" json:"creator"`
-	Created      *helper.CSTTime `json:"created"`
+	ConnectionId uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL"`
+	ID           uint64         `gorm:"primaryKey;type:BIGINT" json:"id,string"`
+	Name         string         `gorm:"type:varchar(255)" json:"name"`
+	PrettyName   string         `gorm:"type:varchar(255)" json:"pretty_name"`
+	Category     string         `gorm:"type:varchar(255)" json:"category"`
+	Status       string         `gorm:"type:varchar(255)" json:"status"`
+	Description  string         `json:"description"`
+	BeginDate    helper.CSTTime `json:"begin_date"`
+	EndDate      helper.CSTTime `json:"end_date"`
+	ExternalOn   string         `gorm:"type:varchar(255)" json:"external_on"`
+	ParentId     uint64         `gorm:"type:BIGINT" json:"parent_id,string"`
+	Creator      string         `gorm:"type:varchar(255)" json:"creator"`
+	Created      helper.CSTTime `json:"created"`
 	common.NoPKModel
 }
 
diff --git a/plugins/tapd/models/migrationscripts/init_schema.go b/plugins/tapd/models/migrationscripts/init_schema.go
index 7a33a2fc..543ffdef 100644
--- a/plugins/tapd/models/migrationscripts/init_schema.go
+++ b/plugins/tapd/models/migrationscripts/init_schema.go
@@ -57,10 +57,6 @@ func (*InitSchemas) Up(ctx context.Context, db *gorm.DB) error {
 		&archived.TapdIterationBug{},
 		&archived.TapdIterationStory{},
 		&archived.TapdIterationTask{},
-		&archived.TapdStoryCustomFields{},
-		&archived.TapdBugCustomFields{},
-		&archived.TapdTaskCustomFields{},
-		&archived.TapdStoryCategory{},
 	)
 }
 
diff --git a/plugins/tapd/models/migrationscripts/init_schema.go b/plugins/tapd/models/migrationscripts/update_schemas20220531.go
similarity index 58%
copy from plugins/tapd/models/migrationscripts/init_schema.go
copy to plugins/tapd/models/migrationscripts/update_schemas20220531.go
index 7a33a2fc..917691a8 100644
--- a/plugins/tapd/models/migrationscripts/init_schema.go
+++ b/plugins/tapd/models/migrationscripts/update_schemas20220531.go
@@ -23,10 +23,45 @@ import (
 	"gorm.io/gorm"
 )
 
-type InitSchemas struct{}
+type UpdateSchemas20220531 struct{}
 
-func (*InitSchemas) Up(ctx context.Context, db *gorm.DB) error {
-	return db.Migrator().AutoMigrate(
+func (*UpdateSchemas20220531) Up(ctx context.Context, db *gorm.DB) error {
+	//err := db.Migrator().DropTable(
+	//	&archived.TapdWorkspace{},
+	//	&archived.TapdWorklog{},
+	//	&archived.TapdWorkspaceIteration{},
+	//	&archived.TapdUser{},
+	//	&archived.TapdBugChangelog{},
+	//	&archived.TapdBugChangelogItem{},
+	//	&archived.TapdStoryChangelog{},
+	//	&archived.TapdStoryChangelogItem{},
+	//	&archived.TapdTaskChangelog{},
+	//	&archived.TapdTaskChangelogItem{},
+	//	&archived.TapdIssue{},
+	//	&archived.TapdIteration{},
+	//	&archived.TapdConnection{},
+	//	&archived.TapdBug{},
+	//	&archived.TapdStory{},
+	//	&archived.TapdTask{},
+	//	&archived.TapdTaskLabel{},
+	//	&archived.TapdBugLabel{},
+	//	&archived.TapdStoryLabel{},
+	//	&archived.TapdBugStatus{},
+	//	&archived.TapdStoryStatus{},
+	//	&archived.TapdBugCommit{},
+	//	&archived.TapdStoryCommit{},
+	//	&archived.TapdTaskCommit{},
+	//	&archived.TapdWorkSpaceBug{},
+	//	&archived.TapdWorkSpaceStory{},
+	//	&archived.TapdWorkSpaceTask{},
+	//	&archived.TapdIterationBug{},
+	//	&archived.TapdIterationStory{},
+	//	&archived.TapdIterationTask{},
+	//)
+	//if err != nil {
+	//	return err
+	//}
+	err := db.Migrator().AutoMigrate(
 		&archived.TapdWorkspace{},
 		&archived.TapdWorklog{},
 		&archived.TapdWorkspaceIteration{},
@@ -62,12 +97,17 @@ func (*InitSchemas) Up(ctx context.Context, db *gorm.DB) error {
 		&archived.TapdTaskCustomFields{},
 		&archived.TapdStoryCategory{},
 	)
+	return err
 }
 
-func (*InitSchemas) Version() uint64 {
-	return 20220420231138
+func (*UpdateSchemas20220531) Version() uint64 {
+	return 20220531132510
 }
 
-func (*InitSchemas) Name() string {
-	return "Tapd init schemas"
+func (*UpdateSchemas20220531) Name() string {
+	return "rebuild tapd tables"
 }
+
+func (*UpdateSchemas20220531) Owner() string {
+	return "tapd"
+}
\ No newline at end of file
diff --git a/plugins/tapd/models/story.go b/plugins/tapd/models/story.go
index bd37a825..60de3ecd 100644
--- a/plugins/tapd/models/story.go
+++ b/plugins/tapd/models/story.go
@@ -23,60 +23,111 @@ import (
 )
 
 type TapdStory struct {
-	ConnectionId    uint64          `gorm:"primaryKey"`
-	ID              uint64          `gorm:"primaryKey;type:BIGINT" json:"id,string"`
-	WorkitemTypeID  uint64          `json:"workitem_type_id,string"`
-	Name            string          `gorm:"type:varchar(255)" json:"name"`
-	Description     string          `json:"description"`
-	WorkspaceID     uint64          `json:"workspace_id,string"`
-	Creator         string          `gorm:"type:varchar(255)"`
-	Created         *helper.CSTTime `json:"created"`
-	Modified        *helper.CSTTime `json:"modified" gorm:"index"`
-	Status          string          `json:"status" gorm:"type:varchar(255)"`
-	Owner           string          `json:"owner" gorm:"type:varchar(255)"`
-	Cc              string          `json:"cc" gorm:"type:varchar(255)"`
-	Begin           *helper.CSTTime `json:"begin"`
-	Due             *helper.CSTTime `json:"due"`
-	Size            int16           `json:"size,string"`
-	Priority        string          `gorm:"type:varchar(255)" json:"priority"`
-	Developer       string          `gorm:"type:varchar(255)" json:"developer"`
-	IterationID     uint64          `json:"iteration_id,string"`
-	TestFocus       string          `json:"test_focus" gorm:"type:varchar(255)"`
-	Type            string          `json:"type" gorm:"type:varchar(255)"`
-	Source          string          `json:"source" gorm:"type:varchar(255)"`
-	Module          string          `json:"module" gorm:"type:varchar(255)"`
-	Version         string          `json:"version" gorm:"type:varchar(255)"`
-	Completed       *helper.CSTTime `json:"completed"`
-	CategoryID      uint64          `json:"category_id,string"`
-	Path            string          `gorm:"type:varchar(255)" json:"path"`
-	ParentID        uint64          `json:"parent_id,string"`
-	ChildrenID      string          `gorm:"type:varchar(255)" json:"children_id"`
-	AncestorID      uint64          `json:"ancestor_id,string"`
-	BusinessValue   string          `gorm:"type:varchar(255)" json:"business_value"`
-	Effort          float32         `json:"effort,string"`
-	EffortCompleted float32         `json:"effort_completed,string"`
-	Exceed          float32         `json:"exceed,string"`
-	Remain          float32         `json:"remain,string"`
-	ReleaseID       uint64          `json:"release_id,string"`
-	Confidential    string          `gorm:"type:varchar(255)" json:"confidential"`
-	TemplatedID     uint64          `json:"templated_id,string"`
-	CreatedFrom     string          `gorm:"type:varchar(255)" json:"created_from"`
-	Feature         string          `gorm:"type:varchar(255)" json:"feature"`
-	StdStatus       string
-	StdType         string
-	Url             string
+	ConnectionId    uint64         `gorm:"primaryKey"`
+	ID              uint64         `gorm:"primaryKey;type:BIGINT" json:"id,string"`
+	WorkitemTypeID  uint64         `json:"workitem_type_id,string"`
+	Name            string         `gorm:"type:varchar(255)" json:"name"`
+	Description     string         `json:"description"`
+	WorkspaceID     uint64         `json:"workspace_id,string"`
+	Creator         string         `gorm:"type:varchar(255)"`
+	Created         helper.CSTTime `json:"created"`
+	Modified        helper.CSTTime `json:"modified" gorm:"index"`
+	Status          string         `json:"status" gorm:"type:varchar(255)"`
+	Owner           string         `json:"owner" gorm:"type:varchar(255)"`
+	Cc              string         `json:"cc" gorm:"type:varchar(255)"`
+	Begin           helper.CSTTime `json:"begin"`
+	Due             helper.CSTTime `json:"due"`
+	Size            int16          `json:"size,string"`
+	Priority        string         `gorm:"type:varchar(255)" json:"priority"`
+	Developer       string         `gorm:"type:varchar(255)" json:"developer"`
+	IterationID     uint64         `json:"iteration_id,string"`
+	TestFocus       string         `json:"test_focus" gorm:"type:varchar(255)"`
+	Type            string         `json:"type" gorm:"type:varchar(20)"`
+	Source          string         `json:"source" gorm:"type:varchar(255)"`
+	Module          string         `json:"module" gorm:"type:varchar(255)"`
+	Version         string         `json:"version" gorm:"type:varchar(255)"`
+	Completed       helper.CSTTime `json:"completed"`
+	CategoryID      int64          `json:"category_id,string"`
+	Path            string         `gorm:"type:varchar(255)" json:"path"`
+	ParentID        uint64         `json:"parent_id,string"`
+	ChildrenID      string         `gorm:"type:text" json:"children_id"`
+	AncestorID      uint64         `json:"ancestor_id,string"`
+	BusinessValue   string         `gorm:"type:varchar(255)" json:"business_value"`
+	Effort          float32        `json:"effort,string"`
+	EffortCompleted float32        `json:"effort_completed,string"`
+	Exceed          float32        `json:"exceed,string"`
+	Remain          float32        `json:"remain,string"`
+	ReleaseID       uint64         `json:"release_id,string"`
+	Confidential    string         `gorm:"type:varchar(255)" json:"confidential"`
+	TemplatedID     uint64         `json:"templated_id,string"`
+	CreatedFrom     string         `gorm:"type:varchar(255)" json:"created_from"`
+	Feature         string         `gorm:"type:varchar(255)" json:"feature"`
+	StdStatus       string         `gorm:"type:varchar(20)"`
+	StdType         string         `gorm:"type:varchar(20)"`
+	Url             string         `gorm:"type:varchar(255)"`
 
 	AttachmentCount  int16  `json:"attachment_count,string"`
 	HasAttachment    string `json:"has_attachment" gorm:"type:varchar(255)"`
 	BugID            uint64 `json:"bug_id,string"`
 	Follower         string `json:"follower" gorm:"type:varchar(255)"`
-	SyncType         string `json:"sync_type" gorm:"type:varchar(255)"`
+	SyncType         string `json:"sync_type" gorm:"type:text"`
 	PredecessorCount int16  `json:"predecessor_count,string"`
 	IsArchived       string `json:"is_archived" gorm:"type:varchar(255)"`
 	Modifier         string `json:"modifier" gorm:"type:varchar(255)"`
 	ProgressManual   string `json:"progress_manual" gorm:"type:varchar(255)"`
 	SuccessorCount   int16  `json:"successor_count,string"`
 	Label            string `json:"label" gorm:"type:varchar(255)"`
+	CustomFieldOne   string `json:"custom_field_one" gorm:"type:text"`
+	CustomFieldTwo   string `json:"custom_field_two" gorm:"type:text"`
+	CustomFieldThree string `json:"custom_field_three" gorm:"type:text"`
+	CustomFieldFour  string `json:"custom_field_four" gorm:"type:text"`
+	CustomFieldFive  string `json:"custom_field_five" gorm:"type:text"`
+	CustomField6     string `json:"custom_field_6" gorm:"type:text"`
+	CustomField7     string `json:"custom_field_7" gorm:"type:text"`
+	CustomField8     string `json:"custom_field_8" gorm:"type:text"`
+	CustomField9     string `json:"custom_field_9" gorm:"type:text"`
+	CustomField10    string `json:"custom_field_10" gorm:"type:text"`
+	CustomField11    string `json:"custom_field_11" gorm:"type:text"`
+	CustomField12    string `json:"custom_field_12" gorm:"type:text"`
+	CustomField13    string `json:"custom_field_13" gorm:"type:text"`
+	CustomField14    string `json:"custom_field_14" gorm:"type:text"`
+	CustomField15    string `json:"custom_field_15" gorm:"type:text"`
+	CustomField16    string `json:"custom_field_16" gorm:"type:text"`
+	CustomField17    string `json:"custom_field_17" gorm:"type:text"`
+	CustomField18    string `json:"custom_field_18" gorm:"type:text"`
+	CustomField19    string `json:"custom_field_19" gorm:"type:text"`
+	CustomField20    string `json:"custom_field_20" gorm:"type:text"`
+	CustomField21    string `json:"custom_field_21" gorm:"type:text"`
+	CustomField22    string `json:"custom_field_22" gorm:"type:text"`
+	CustomField23    string `json:"custom_field_23" gorm:"type:text"`
+	CustomField24    string `json:"custom_field_24" gorm:"type:text"`
+	CustomField25    string `json:"custom_field_25" gorm:"type:text"`
+	CustomField26    string `json:"custom_field_26" gorm:"type:text"`
+	CustomField27    string `json:"custom_field_27" gorm:"type:text"`
+	CustomField28    string `json:"custom_field_28" gorm:"type:text"`
+	CustomField29    string `json:"custom_field_29" gorm:"type:text"`
+	CustomField30    string `json:"custom_field_30" gorm:"type:text"`
+	CustomField31    string `json:"custom_field_31" gorm:"type:text"`
+	CustomField32    string `json:"custom_field_32" gorm:"type:text"`
+	CustomField33    string `json:"custom_field_33" gorm:"type:text"`
+	CustomField34    string `json:"custom_field_34" gorm:"type:text"`
+	CustomField35    string `json:"custom_field_35" gorm:"type:text"`
+	CustomField36    string `json:"custom_field_36" gorm:"type:text"`
+	CustomField37    string `json:"custom_field_37" gorm:"type:text"`
+	CustomField38    string `json:"custom_field_38" gorm:"type:text"`
+	CustomField39    string `json:"custom_field_39" gorm:"type:text"`
+	CustomField40    string `json:"custom_field_40" gorm:"type:text"`
+	CustomField41    string `json:"custom_field_41" gorm:"type:text"`
+	CustomField42    string `json:"custom_field_42" gorm:"type:text"`
+	CustomField43    string `json:"custom_field_43" gorm:"type:text"`
+	CustomField44    string `json:"custom_field_44" gorm:"type:text"`
+	CustomField45    string `json:"custom_field_45" gorm:"type:text"`
+	CustomField46    string `json:"custom_field_46" gorm:"type:text"`
+	CustomField47    string `json:"custom_field_47" gorm:"type:text"`
+	CustomField48    string `json:"custom_field_48" gorm:"type:text"`
+	CustomField49    string `json:"custom_field_49" gorm:"type:text"`
+	CustomField50    string `json:"custom_field_50" gorm:"type:text"`
+
 	common.NoPKModel
 }
 
diff --git a/plugins/tapd/models/story_category.go b/plugins/tapd/models/story_category.go
index 5f5cd5c7..3c9ba2a1 100644
--- a/plugins/tapd/models/story_category.go
+++ b/plugins/tapd/models/story_category.go
@@ -6,13 +6,13 @@ import (
 )
 
 type TapdStoryCategory struct {
-	ConnectionId uint64          `gorm:"primaryKey"`
-	ID           uint64          `gorm:"primaryKey;type:BIGINT" json:"id,string"`
-	Name         string          `json:"name" gorm:"type:varchar(255)"`
-	Description  string          `json:"description"`
-	ParentID     uint64          `json:"parent_id,string"`
-	Created      *helper.CSTTime `json:"created"`
-	Modified     *helper.CSTTime `json:"modified"`
+	ConnectionId uint64         `gorm:"primaryKey"`
+	ID           uint64         `gorm:"primaryKey;type:BIGINT" json:"id,string"`
+	Name         string         `json:"name" gorm:"type:varchar(255)"`
+	Description  string         `json:"description"`
+	ParentID     uint64         `json:"parent_id,string"`
+	Created      helper.CSTTime `json:"created"`
+	Modified     helper.CSTTime `json:"modified"`
 	common.NoPKModel
 }
 
diff --git a/plugins/tapd/models/story_changelog.go b/plugins/tapd/models/story_changelog.go
index 0896c158..9649c783 100644
--- a/plugins/tapd/models/story_changelog.go
+++ b/plugins/tapd/models/story_changelog.go
@@ -24,17 +24,17 @@ import (
 )
 
 type TapdStoryChangelog struct {
-	ConnectionId   uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL"`
-	ID             uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
-	WorkspaceID    uint64          `json:"workspace_id,string"`
-	WorkitemTypeID uint64          `json:"workitem_type_id,string"`
-	Creator        string          `json:"creator"`
-	Created        *helper.CSTTime `json:"created"`
-	ChangeSummary  string          `json:"change_summary"`
-	Comment        string          `json:"comment"`
-	EntityType     string          `json:"entity_type"`
-	ChangeType     string          `json:"change_type"`
-	StoryID        uint64          `json:"story_id,string"`
+	ConnectionId   uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL"`
+	ID             uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
+	WorkspaceID    uint64         `json:"workspace_id,string"`
+	WorkitemTypeID uint64         `json:"workitem_type_id,string"`
+	Creator        string         `json:"creator" gorm:"type:varchar(255)"`
+	Created        helper.CSTTime `json:"created"`
+	ChangeSummary  string         `json:"change_summary" gorm:"type:varchar(255)"`
+	Comment        string         `json:"comment"`
+	EntityType     string         `json:"entity_type" gorm:"type:varchar(255)"`
+	ChangeType     string         `json:"change_type" gorm:"type:varchar(255)"`
+	StoryID        uint64         `json:"story_id,string"`
 	common.NoPKModel
 	FieldChanges []TapdStoryChangelogItemRes `json:"field_changes" gorm:"-"`
 }
diff --git a/plugins/tapd/models/story_commits.go b/plugins/tapd/models/story_commits.go
index e37f673c..1e72d4f8 100644
--- a/plugins/tapd/models/story_commits.go
+++ b/plugins/tapd/models/story_commits.go
@@ -29,18 +29,18 @@ type TapdStoryCommit struct {
 	UserID          string `json:"user_id" gorm:"type:varchar(255)"`
 	HookUserName    string `json:"hook_user_name" gorm:"type:varchar(255)"`
 	CommitID        string `json:"commit_id" gorm:"type:varchar(255)"`
-	WorkspaceID     uint64 `json:"workspace_id,string" gorm:"type:varchar(255)"`
-	Message         string `json:"message"`
+	WorkspaceID     uint64 `json:"workspace_id,string" gorm:"type:BIGINT"`
+	Message         string `json:"message" gorm:"type:text"`
 	Path            string `json:"path" gorm:"type:varchar(255)"`
 	WebURL          string `json:"web_url" gorm:"type:varchar(255)"`
 	HookProjectName string `json:"hook_project_name" gorm:"type:varchar(255)"`
 
-	Ref        string          `json:"ref" gorm:"type:varchar(255)"`
-	RefStatus  string          `json:"ref_status" gorm:"type:varchar(255)"`
-	GitEnv     string          `json:"git_env" gorm:"type:varchar(255)"`
-	FileCommit string          `json:"file_commit"`
-	CommitTime *helper.CSTTime `json:"commit_time"`
-	Created    *helper.CSTTime `json:"created"`
+	Ref        string         `json:"ref" gorm:"type:varchar(255)"`
+	RefStatus  string         `json:"ref_status" gorm:"type:varchar(255)"`
+	GitEnv     string         `json:"git_env" gorm:"type:varchar(255)"`
+	FileCommit string         `json:"file_commit"`
+	CommitTime helper.CSTTime `json:"commit_time"`
+	Created    helper.CSTTime `json:"created"`
 
 	StoryId uint64
 	common.NoPKModel
diff --git a/plugins/tapd/models/story_custom_field.go b/plugins/tapd/models/story_custom_field.go
index e6b05082..4fd66834 100644
--- a/plugins/tapd/models/story_custom_field.go
+++ b/plugins/tapd/models/story_custom_field.go
@@ -6,11 +6,11 @@ type TapdStoryCustomFields struct {
 	ConnectionId uint64 `gorm:"primaryKey;type:BIGINT  NOT NULL"`
 	ID           uint64 `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
 	WorkspaceID  uint64 `json:"workspace_id,string"`
-	EntryType    string `json:"entry_type" gorm:"type:varchar(255)"`
+	EntryType    string `json:"entry_type" gorm:"type:varchar(20)"`
 	CustomField  string `json:"custom_field" gorm:"type:varchar(255)"`
-	Type         string `json:"type" gorm:"type:varchar(255)"`
+	Type         string `json:"type" gorm:"type:varchar(20)"`
 	Name         string `json:"name" gorm:"type:varchar(255)"`
-	Options      string `json:"options"`
+	Options      string `json:"options" gorm:"type:text"`
 	Enabled      string `json:"enabled" gorm:"type:varchar(255)"`
 	Sort         string `json:"sort" gorm:"type:varchar(255)"`
 	common.NoPKModel
diff --git a/plugins/tapd/models/task.go b/plugins/tapd/models/task.go
index df053400..00fc9d62 100644
--- a/plugins/tapd/models/task.go
+++ b/plugins/tapd/models/task.go
@@ -23,33 +23,33 @@ import (
 )
 
 type TapdTask struct {
-	ConnectionId    uint64          `gorm:"primaryKey"`
-	ID              uint64          `gorm:"primaryKey;type:BIGINT" json:"id,string"`
-	Name            string          `gorm:"type:varchar(255)" json:"name"`
-	Description     string          `json:"description"`
-	WorkspaceID     uint64          `json:"workspace_id,string"`
-	Creator         string          `gorm:"type:varchar(255)" json:"creator"`
-	Created         *helper.CSTTime `json:"created"`
-	Modified        *helper.CSTTime `json:"modified" gorm:"index"`
-	Status          string          `json:"status" gorm:"type:varchar(255)"`
-	Owner           string          `json:"owner" gorm:"type:varchar(255)"`
-	Cc              string          `json:"cc" gorm:"type:varchar(255)"`
-	Begin           *helper.CSTTime `json:"begin"`
-	Due             *helper.CSTTime `json:"due"`
-	Priority        string          `gorm:"type:varchar(255)" json:"priority"`
-	IterationID     uint64          `json:"iteration_id,string"`
-	Completed       *helper.CSTTime `json:"completed"`
-	Effort          float32         `json:"effort,string"`
-	EffortCompleted float32         `json:"effort_completed,string"`
-	Exceed          float32         `json:"exceed,string"`
-	Remain          float32         `json:"remain,string"`
-	StdStatus       string
-	StdType         string
-	Type            string
-	StoryID         uint64 `json:"story_id,string"`
-	Progress        int16  `json:"progress,string"`
-	HasAttachment   string `gorm:"type:varchar(255)"`
-	Url             string
+	ConnectionId    uint64         `gorm:"primaryKey"`
+	ID              uint64         `gorm:"primaryKey;type:BIGINT" json:"id,string"`
+	Name            string         `gorm:"type:varchar(255)" json:"name"`
+	Description     string         `json:"description"`
+	WorkspaceID     uint64         `json:"workspace_id,string"`
+	Creator         string         `gorm:"type:varchar(255)" json:"creator"`
+	Created         helper.CSTTime `json:"created"`
+	Modified        helper.CSTTime `json:"modified" gorm:"index"`
+	Status          string         `json:"status" gorm:"type:varchar(255)"`
+	Owner           string         `json:"owner" gorm:"type:varchar(255)"`
+	Cc              string         `json:"cc" gorm:"type:varchar(255)"`
+	Begin           helper.CSTTime `json:"begin"`
+	Due             helper.CSTTime `json:"due"`
+	Priority        string         `gorm:"type:varchar(255)" json:"priority"`
+	IterationID     uint64         `json:"iteration_id,string"`
+	Completed       helper.CSTTime `json:"completed"`
+	Effort          float32        `json:"effort,string"`
+	EffortCompleted float32        `json:"effort_completed,string"`
+	Exceed          float32        `json:"exceed,string"`
+	Remain          float32        `json:"remain,string"`
+	StdStatus       string         `gorm:"type:varchar(20)"`
+	StdType         string         `gorm:"type:varchar(20)"`
+	Type            string         `gorm:"type:varchar(20)"`
+	StoryID         uint64         `json:"story_id,string"`
+	Progress        int16          `json:"progress,string"`
+	HasAttachment   string         `gorm:"type:varchar(255)"`
+	Url             string         `gorm:"type:varchar(255)"`
 
 	AttachmentCount  int16  `json:"attachment_count,string"`
 	Follower         string `json:"follower" gorm:"type:varchar(255)"`
@@ -59,6 +59,56 @@ type TapdTask struct {
 	ReleaseId        uint64 `json:"release_id,string"`
 	Label            string `json:"label" gorm:"type:varchar(255)"`
 	NewStoryId       uint64 `json:"new_story_id,string"`
+	CustomFieldOne   string `json:"custom_field_one" gorm:"type:text"`
+	CustomFieldTwo   string `json:"custom_field_two" gorm:"type:text"`
+	CustomFieldThree string `json:"custom_field_three" gorm:"type:text"`
+	CustomFieldFour  string `json:"custom_field_four" gorm:"type:text"`
+	CustomFieldFive  string `json:"custom_field_five" gorm:"type:text"`
+	CustomField6     string `json:"custom_field_6" gorm:"type:text"`
+	CustomField7     string `json:"custom_field_7" gorm:"type:text"`
+	CustomField8     string `json:"custom_field_8" gorm:"type:text"`
+	CustomField9     string `json:"custom_field_9" gorm:"type:text"`
+	CustomField10    string `json:"custom_field_10" gorm:"type:text"`
+	CustomField11    string `json:"custom_field_11" gorm:"type:text"`
+	CustomField12    string `json:"custom_field_12" gorm:"type:text"`
+	CustomField13    string `json:"custom_field_13" gorm:"type:text"`
+	CustomField14    string `json:"custom_field_14" gorm:"type:text"`
+	CustomField15    string `json:"custom_field_15" gorm:"type:text"`
+	CustomField16    string `json:"custom_field_16" gorm:"type:text"`
+	CustomField17    string `json:"custom_field_17" gorm:"type:text"`
+	CustomField18    string `json:"custom_field_18" gorm:"type:text"`
+	CustomField19    string `json:"custom_field_19" gorm:"type:text"`
+	CustomField20    string `json:"custom_field_20" gorm:"type:text"`
+	CustomField21    string `json:"custom_field_21" gorm:"type:text"`
+	CustomField22    string `json:"custom_field_22" gorm:"type:text"`
+	CustomField23    string `json:"custom_field_23" gorm:"type:text"`
+	CustomField24    string `json:"custom_field_24" gorm:"type:text"`
+	CustomField25    string `json:"custom_field_25" gorm:"type:text"`
+	CustomField26    string `json:"custom_field_26" gorm:"type:text"`
+	CustomField27    string `json:"custom_field_27" gorm:"type:text"`
+	CustomField28    string `json:"custom_field_28" gorm:"type:text"`
+	CustomField29    string `json:"custom_field_29" gorm:"type:text"`
+	CustomField30    string `json:"custom_field_30" gorm:"type:text"`
+	CustomField31    string `json:"custom_field_31" gorm:"type:text"`
+	CustomField32    string `json:"custom_field_32" gorm:"type:text"`
+	CustomField33    string `json:"custom_field_33" gorm:"type:text"`
+	CustomField34    string `json:"custom_field_34" gorm:"type:text"`
+	CustomField35    string `json:"custom_field_35" gorm:"type:text"`
+	CustomField36    string `json:"custom_field_36" gorm:"type:text"`
+	CustomField37    string `json:"custom_field_37" gorm:"type:text"`
+	CustomField38    string `json:"custom_field_38" gorm:"type:text"`
+	CustomField39    string `json:"custom_field_39" gorm:"type:text"`
+	CustomField40    string `json:"custom_field_40" gorm:"type:text"`
+	CustomField41    string `json:"custom_field_41" gorm:"type:text"`
+	CustomField42    string `json:"custom_field_42" gorm:"type:text"`
+	CustomField43    string `json:"custom_field_43" gorm:"type:text"`
+	CustomField44    string `json:"custom_field_44" gorm:"type:text"`
+	CustomField45    string `json:"custom_field_45" gorm:"type:text"`
+	CustomField46    string `json:"custom_field_46" gorm:"type:text"`
+	CustomField47    string `json:"custom_field_47" gorm:"type:text"`
+	CustomField48    string `json:"custom_field_48" gorm:"type:text"`
+	CustomField49    string `json:"custom_field_49" gorm:"type:text"`
+	CustomField50    string `json:"custom_field_50" gorm:"type:text"`
 	common.NoPKModel
 }
 
diff --git a/plugins/tapd/models/task_changelog.go b/plugins/tapd/models/task_changelog.go
index 4b0c88fb..50510b99 100644
--- a/plugins/tapd/models/task_changelog.go
+++ b/plugins/tapd/models/task_changelog.go
@@ -25,18 +25,18 @@ import (
 )
 
 type TapdTaskChangelog struct {
-	ConnectionId   uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL"`
-	ID             uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
-	WorkspaceID    uint64          `json:"workspace_id,string"`
-	WorkitemTypeID uint64          `json:"workitem_type_id,string"`
-	Creator        string          `json:"creator"`
-	Created        *helper.CSTTime `json:"created"`
-	ChangeSummary  string          `json:"change_summary"`
-	Comment        string          `json:"comment"`
-	EntityType     string          `json:"entity_type"`
-	ChangeType     string          `json:"change_type"`
-	ChangeTypeText string          `json:"change_type_text"`
-	TaskID         uint64          `json:"task_id,string"`
+	ConnectionId   uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL"`
+	ID             uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
+	WorkspaceID    uint64         `json:"workspace_id,string"`
+	WorkitemTypeID uint64         `json:"workitem_type_id,string"`
+	Creator        string         `json:"creator" gorm:"type:varchar(255)"`
+	Created        helper.CSTTime `json:"created"`
+	ChangeSummary  string         `json:"change_summary" gorm:"type:varchar(255)"`
+	Comment        string         `json:"comment"`
+	EntityType     string         `json:"entity_type" gorm:"type:varchar(255)"`
+	ChangeType     string         `json:"change_type" gorm:"type:varchar(255)"`
+	ChangeTypeText string         `json:"change_type_text" gorm:"type:varchar(255)"`
+	TaskID         uint64         `json:"task_id,string"`
 	common.NoPKModel
 	FieldChanges []TapdTaskChangelogItemRes `json:"field_changes" gorm:"-"`
 }
diff --git a/plugins/tapd/models/task_commits.go b/plugins/tapd/models/task_commits.go
index 4563454c..c7c882d5 100644
--- a/plugins/tapd/models/task_commits.go
+++ b/plugins/tapd/models/task_commits.go
@@ -29,18 +29,18 @@ type TapdTaskCommit struct {
 	UserID          string `json:"user_id" gorm:"type:varchar(255)"`
 	HookUserName    string `json:"hook_user_name" gorm:"type:varchar(255)"`
 	CommitID        string `json:"commit_id" gorm:"type:varchar(255)"`
-	WorkspaceID     uint64 `json:"workspace_id,string" gorm:"type:varchar(255)"`
-	Message         string `json:"message"`
+	WorkspaceID     uint64 `json:"workspace_id,string" gorm:"type:BIGINT"`
+	Message         string `json:"message" gorm:"type:text"`
 	Path            string `json:"path" gorm:"type:varchar(255)"`
 	WebURL          string `json:"web_url" gorm:"type:varchar(255)"`
 	HookProjectName string `json:"hook_project_name" gorm:"type:varchar(255)"`
 
-	Ref        string          `json:"ref" gorm:"type:varchar(255)"`
-	RefStatus  string          `json:"ref_status" gorm:"type:varchar(255)"`
-	GitEnv     string          `json:"git_env" gorm:"type:varchar(255)"`
-	FileCommit string          `json:"file_commit"`
-	CommitTime *helper.CSTTime `json:"commit_time"`
-	Created    *helper.CSTTime `json:"created"`
+	Ref        string         `json:"ref" gorm:"type:varchar(255)"`
+	RefStatus  string         `json:"ref_status" gorm:"type:varchar(255)"`
+	GitEnv     string         `json:"git_env" gorm:"type:varchar(255)"`
+	FileCommit string         `json:"file_commit"`
+	CommitTime helper.CSTTime `json:"commit_time"`
+	Created    helper.CSTTime `json:"created"`
 
 	TaskId uint64
 	common.NoPKModel
diff --git a/plugins/tapd/models/task_custom_field.go b/plugins/tapd/models/task_custom_field.go
index 326f3ec5..b5008565 100644
--- a/plugins/tapd/models/task_custom_field.go
+++ b/plugins/tapd/models/task_custom_field.go
@@ -6,11 +6,11 @@ type TapdTaskCustomFields struct {
 	ConnectionId uint64 `gorm:"primaryKey;type:BIGINT  NOT NULL"`
 	ID           uint64 `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
 	WorkspaceID  uint64 `json:"workspace_id,string"`
-	EntryType    string `json:"entry_type" gorm:"type:varchar(255)"`
+	EntryType    string `json:"entry_type" gorm:"type:varchar(20)"`
 	CustomField  string `json:"custom_field" gorm:"type:varchar(255)"`
-	Type         string `json:"type" gorm:"type:varchar(255)"`
+	Type         string `json:"type" gorm:"type:varchar(20)"`
 	Name         string `json:"name" gorm:"type:varchar(255)"`
-	Options      string `json:"options"`
+	Options      string `json:"options" gorm:"type:text"`
 	Enabled      string `json:"enabled" gorm:"type:varchar(255)"`
 	Sort         string `json:"sort" gorm:"type:varchar(255)"`
 	common.NoPKModel
diff --git a/plugins/tapd/models/worklog.go b/plugins/tapd/models/worklog.go
index 9d1260fe..d6d54e11 100644
--- a/plugins/tapd/models/worklog.go
+++ b/plugins/tapd/models/worklog.go
@@ -23,16 +23,16 @@ import (
 )
 
 type TapdWorklog struct {
-	ConnectionId uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL"`
-	ID           uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
-	WorkspaceID  uint64          `json:"workspace_id,string"`
-	EntityType   string          `gorm:"type:varchar(255)" json:"entity_type"`
-	EntityID     uint64          `json:"entity_id,string"`
-	Timespent    float32         `json:"timespent,string"`
-	Spentdate    *helper.CSTTime `json:"spentdate"`
-	Owner        string          `gorm:"type:varchar(255)" json:"owner"`
-	Created      *helper.CSTTime `json:"created"`
-	Memo         string          `gorm:"type:varchar(255)" json:"memo"`
+	ConnectionId uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL"`
+	ID           uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id,string"`
+	WorkspaceID  uint64         `json:"workspace_id,string"`
+	EntityType   string         `gorm:"type:varchar(255)" json:"entity_type"`
+	EntityID     uint64         `json:"entity_id,string"`
+	Timespent    float32        `json:"timespent,string"`
+	Spentdate    helper.CSTTime `json:"spentdate"`
+	Owner        string         `gorm:"type:varchar(255)" json:"owner"`
+	Created      helper.CSTTime `json:"created"`
+	Memo         string         `json:"memo" gorm:"type:text"`
 	common.NoPKModel
 }
 
diff --git a/plugins/tapd/models/workspace.go b/plugins/tapd/models/workspace.go
index 64665c9e..8d35b347 100644
--- a/plugins/tapd/models/workspace.go
+++ b/plugins/tapd/models/workspace.go
@@ -23,19 +23,19 @@ import (
 )
 
 type TapdWorkspace struct {
-	ConnectionId uint64          `gorm:"primaryKey;type:BIGINT  NOT NULL"`
-	ID           uint64          `gorm:"primaryKey;type:BIGINT" json:"id,string"`
-	Name         string          `gorm:"type:varchar(255)" json:"name"`
-	PrettyName   string          `gorm:"type:varchar(255)" json:"pretty_name"`
-	Category     string          `gorm:"type:varchar(255)" json:"category"`
-	Status       string          `gorm:"type:varchar(255)" json:"status"`
-	Description  string          `json:"description"`
-	BeginDate    *helper.CSTTime `json:"begin_date"`
-	EndDate      *helper.CSTTime `json:"end_date"`
-	ExternalOn   string          `gorm:"type:varchar(255)" json:"external_on"`
-	ParentId     uint64          `gorm:"type:BIGINT" json:"parent_id,string"`
-	Creator      string          `gorm:"type:varchar(255)" json:"creator"`
-	Created      *helper.CSTTime `json:"created"`
+	ConnectionId uint64         `gorm:"primaryKey;type:BIGINT  NOT NULL"`
+	ID           uint64         `gorm:"primaryKey;type:BIGINT" json:"id,string"`
+	Name         string         `gorm:"type:varchar(255)" json:"name"`
+	PrettyName   string         `gorm:"type:varchar(255)" json:"pretty_name"`
+	Category     string         `gorm:"type:varchar(255)" json:"category"`
+	Status       string         `gorm:"type:varchar(255)" json:"status"`
+	Description  string         `json:"description"`
+	BeginDate    helper.CSTTime `json:"begin_date"`
+	EndDate      helper.CSTTime `json:"end_date"`
+	ExternalOn   string         `gorm:"type:varchar(255)" json:"external_on"`
+	ParentId     uint64         `gorm:"type:BIGINT" json:"parent_id,string"`
+	Creator      string         `gorm:"type:varchar(255)" json:"creator"`
+	Created      helper.CSTTime `json:"created"`
 	common.NoPKModel
 }
 
diff --git a/plugins/tapd/tapd.go b/plugins/tapd/tapd.go
index 81b28806..e20194be 100644
--- a/plugins/tapd/tapd.go
+++ b/plugins/tapd/tapd.go
@@ -19,6 +19,8 @@ package main
 
 import (
 	"fmt"
+	"github.com/apache/incubator-devlake/config"
+	"github.com/apache/incubator-devlake/logger"
 	"time"
 
 	"github.com/apache/incubator-devlake/migration"
@@ -66,6 +68,8 @@ func (plugin Tapd) SubTaskMetas() []core.SubTaskMeta {
 		tasks.ExtractBugCustomFieldsMeta,
 		tasks.CollectStoryCategoriesMeta,
 		tasks.ExtractStoryCategoriesMeta,
+		tasks.CollectStoryStatusMeta,
+		tasks.ExtractStoryStatusMeta,
 		tasks.CollectBugStatusMeta,
 		tasks.ExtractBugStatusMeta,
 		tasks.CollectUserMeta,
@@ -201,12 +205,29 @@ func main() {
 	if err != nil {
 		panic(err)
 	}
+
 	cmd.Run = func(c *cobra.Command, args []string) {
-		runner.DirectRun(c, args, PluginEntry, map[string]interface{}{
-			"connectionId": *connectionId,
-			"workspaceId":  *workspaceId,
-			"companyId":    *companyId,
-		})
+		//runner.DirectRun(c, args, PluginEntry, map[string]interface{}{
+		//	"connectionId": *connectionId,
+		//	"workspaceId":  *workspaceId,
+		//	"companyId":    *companyId,
+		//})
+		cfg := config.GetConfig()
+		log := logger.Global.Nested(cmd.Use)
+		db, err := runner.NewGormDb(cfg, log)
+		if err != nil {
+			panic(err)
+		}
+		wsList := make([]*models.TapdWorkspace, 0)
+		err = db.Find(&wsList, "parent_id = ?", 59169984).Error
+		for _, v := range wsList {
+			*workspaceId = v.ID
+			runner.DirectRun(c, args, PluginEntry, map[string]interface{}{
+				"connectionId": *connectionId,
+				"workspaceId":  *workspaceId,
+				"companyId":    *companyId,
+			})
+		}
 	}
 	runner.RunCmd(cmd)
 }
diff --git a/plugins/tapd/tasks/bug_changelog_collector.go b/plugins/tapd/tasks/bug_changelog_collector.go
index 928f2107..6c04011d 100644
--- a/plugins/tapd/tasks/bug_changelog_collector.go
+++ b/plugins/tapd/tasks/bug_changelog_collector.go
@@ -42,12 +42,12 @@ func CollectBugChangelogs(taskCtx core.SubTaskContext) error {
 	if since == nil {
 		// user didn't specify a time range to sync, try load from database
 		var latestUpdated models.TapdBugChangelog
-		err := db.Where("connection_id = ?", data.Connection.ID).Order("created DESC").Limit(1).Find(&latestUpdated).Error
+		err := db.Where("connection_id = ? and workspace_id = ?", data.Connection.ID, data.Options.WorkspaceID).Order("created DESC").Limit(1).Find(&latestUpdated).Error
 		if err != nil {
 			return fmt.Errorf("failed to get latest tapd changelog record: %w", err)
 		}
 		if latestUpdated.ID > 0 {
-			since = (*time.Time)(latestUpdated.Created)
+			since = (*time.Time)(&latestUpdated.Created)
 			incremental = true
 		}
 	}
diff --git a/plugins/tapd/tasks/bug_changelog_converter.go b/plugins/tapd/tasks/bug_changelog_converter.go
index 930887f4..87cd5fd8 100644
--- a/plugins/tapd/tasks/bug_changelog_converter.go
+++ b/plugins/tapd/tasks/bug_changelog_converter.go
@@ -34,7 +34,7 @@ type BugChangelogItemResult struct {
 	WorkspaceID       uint64    `gorm:"primaryKey;type:BIGINT  NOT NULL"`
 	ID                uint64    `gorm:"primaryKey;type:BIGINT  NOT NULL" json:"id"`
 	BugID             uint64    `json:"bug_id"`
-	Author            string    `json:"author"`
+	Author            string    `json:"author" gorm:"type:varchar(255)"`
 	Field             string    `json:"field"`
 	OldValue          string    `json:"old_value"`
 	NewValue          string    `json:"new_value"`
diff --git a/plugins/tapd/tasks/bug_changelog_extractor.go b/plugins/tapd/tasks/bug_changelog_extractor.go
index 3616eede..71ec8004 100644
--- a/plugins/tapd/tasks/bug_changelog_extractor.go
+++ b/plugins/tapd/tasks/bug_changelog_extractor.go
@@ -33,10 +33,6 @@ var ExtractBugChangelogMeta = core.SubTaskMeta{
 	Description:      "Extract raw workspace data into tool layer table _tool_tapd_bug_changelogs",
 }
 
-var bugChangelogBody struct {
-	BugChange models.TapdBugChangelog
-}
-
 func ExtractBugChangelog(taskCtx core.SubTaskContext) error {
 	data := taskCtx.GetData().(*TapdTaskData)
 	extractor, err := helper.NewApiExtractor(helper.ApiExtractorArgs{
@@ -51,7 +47,9 @@ func ExtractBugChangelog(taskCtx core.SubTaskContext) error {
 		},
 		Extract: func(row *helper.RawData) ([]interface{}, error) {
 			results := make([]interface{}, 0, 2)
-
+			var bugChangelogBody struct {
+				BugChange models.TapdBugChangelog
+			}
 			err := json.Unmarshal(row.Data, &bugChangelogBody)
 			if err != nil {
 				return nil, err
diff --git a/plugins/tapd/tasks/bug_collector.go b/plugins/tapd/tasks/bug_collector.go
index c23c2fdf..779b1f2d 100644
--- a/plugins/tapd/tasks/bug_collector.go
+++ b/plugins/tapd/tasks/bug_collector.go
@@ -43,12 +43,12 @@ func CollectBugs(taskCtx core.SubTaskContext) error {
 	if since == nil {
 		// user didn't specify a time range to sync, try load from database
 		var latestUpdated models.TapdBug
-		err := db.Where("connection_id = ?", data.Connection.ID).Order("modified DESC").Limit(1).Find(&latestUpdated).Error
+		err := db.Where("connection_id = ? and workspace_id = ?", data.Connection.ID, data.Options.WorkspaceID).Order("modified DESC").Limit(1).Find(&latestUpdated).Error
 		if err != nil {
 			return fmt.Errorf("failed to get latest tapd changelog record: %w", err)
 		}
 		if latestUpdated.ID > 0 {
-			since = (*time.Time)(latestUpdated.Modified)
+			since = (*time.Time)(&latestUpdated.Modified)
 			incremental = true
 		}
 	}
diff --git a/plugins/tapd/tasks/bug_commit_collector.go b/plugins/tapd/tasks/bug_commit_collector.go
index f4ffcf4c..f6c92d10 100644
--- a/plugins/tapd/tasks/bug_commit_collector.go
+++ b/plugins/tapd/tasks/bug_commit_collector.go
@@ -42,25 +42,27 @@ func CollectBugCommits(taskCtx core.SubTaskContext) error {
 	db := taskCtx.GetDb()
 	logger := taskCtx.GetLogger()
 	logger.Info("collect issueCommits")
-
+	num := 0
 	since := data.Since
 	incremental := false
 	if since == nil {
 		// user didn't specify a time range to sync, try load from database
 		var latestUpdated models.TapdBugCommit
-		err := db.Where("connection_id = ?", data.Connection.ID).Order("created DESC").Limit(1).Find(&latestUpdated).Error
+		err := db.Where("connection_id = ? and workspace_id = ?", data.Connection.ID, data.Options.WorkspaceID).Order("created DESC").Limit(1).Find(&latestUpdated).Error
 		if err != nil {
 			return fmt.Errorf("failed to get latest tapd changelog record: %w", err)
 		}
 		if latestUpdated.ID > 0 {
-			since = (*time.Time)(latestUpdated.Created)
+			since = (*time.Time)(&latestUpdated.Created)
 			incremental = true
 		}
 	}
 
 	tx := db.Model(&models.TapdBug{})
+	tx = tx.Where("connection_id = ? and workspace_id = ?", data.Options.ConnectionId, data.Options.WorkspaceID)
+
 	if since != nil {
-		tx = tx.Where("modified > ? and connection_id = ? and workspace_id = ?", since, data.Options.ConnectionId, data.Options.WorkspaceID)
+		tx = tx.Where("modified > ?", since)
 	}
 	cursor, err := tx.Select("id").Rows()
 	if err != nil {
@@ -98,6 +100,12 @@ func CollectBugCommits(taskCtx core.SubTaskContext) error {
 			var data struct {
 				Stories []json.RawMessage `json:"data"`
 			}
+			if len(data.Stories) > 0 {
+				fmt.Println(len(data.Stories))
+				num += len(data.Stories)
+				fmt.Printf("num is %d", num)
+
+			}
 			err := helper.UnmarshalResponse(res, &data)
 			return data.Stories, err
 		},
diff --git a/plugins/tapd/tasks/bug_converter.go b/plugins/tapd/tasks/bug_converter.go
index ba8c5d06..a1fee8c2 100644
--- a/plugins/tapd/tasks/bug_converter.go
+++ b/plugins/tapd/tasks/bug_converter.go
@@ -25,7 +25,6 @@ import (
 	"github.com/apache/incubator-devlake/plugins/tapd/models"
 	"reflect"
 	"strconv"
-	"time"
 )
 
 func ConvertBug(taskCtx core.SubTaskContext) error {
@@ -57,15 +56,15 @@ func ConvertBug(taskCtx core.SubTaskContext) error {
 				DomainEntity: domainlayer.DomainEntity{
 					Id: IssueIdGen.Generate(toolL.ConnectionId, toolL.ID),
 				},
-				Url:            toolL.Url,
-				Number:         strconv.FormatUint(toolL.ID, 10),
-				Title:          toolL.Title,
-				EpicKey:        toolL.EpicKey,
-				Type:           "BUG",
-				Status:         toolL.StdStatus,
-				ResolutionDate: (*time.Time)(toolL.Resolved),
-				CreatedDate:    (*time.Time)(toolL.Created),
-				UpdatedDate:    (*time.Time)(toolL.Modified),
+				Url:     toolL.Url,
+				Number:  strconv.FormatUint(toolL.ID, 10),
+				Title:   toolL.Title,
+				EpicKey: toolL.EpicKey,
+				Type:    "BUG",
+				Status:  toolL.StdStatus,
+				//ResolutionDate: (*time.Time)(&toolL.Resolved),
+				//CreatedDate:    (*time.Time)(&toolL.Created),
+				//UpdatedDate:    (*time.Time)(&toolL.Modified),
 				ParentIssueId:  IssueIdGen.Generate(toolL.ConnectionId, toolL.IssueID),
 				Priority:       toolL.Priority,
 				CreatorId:      UserIdGen.Generate(data.Connection.ID, toolL.WorkspaceID, toolL.Reporter),
diff --git a/plugins/tapd/tasks/bug_custom_fields_extractor.go b/plugins/tapd/tasks/bug_custom_fields_extractor.go
index b85891e2..0e8d112b 100644
--- a/plugins/tapd/tasks/bug_custom_fields_extractor.go
+++ b/plugins/tapd/tasks/bug_custom_fields_extractor.go
@@ -33,10 +33,6 @@ var ExtractBugCustomFieldsMeta = core.SubTaskMeta{
 	Description:      "Extract raw company data into tool layer table _tool_tapd_bug_custom_fields",
 }
 
-var bugCustomFields struct {
-	CustomFieldConfig models.TapdBugCustomFields
-}
-
 func ExtractBugCustomFields(taskCtx core.SubTaskContext) error {
 	data := taskCtx.GetData().(*TapdTaskData)
 	extractor, err := helper.NewApiExtractor(helper.ApiExtractorArgs{
@@ -49,6 +45,9 @@ func ExtractBugCustomFields(taskCtx core.SubTaskContext) error {
 			Table: RAW_BUG_CUSTOM_FIELDS_TABLE,
 		},
 		Extract: func(row *helper.RawData) ([]interface{}, error) {
+			var bugCustomFields struct {
+				CustomFieldConfig models.TapdBugCustomFields
+			}
 			err := json.Unmarshal(row.Data, &bugCustomFields)
 			if err != nil {
 				return nil, err
diff --git a/plugins/tapd/tasks/bug_extractor.go b/plugins/tapd/tasks/bug_extractor.go
index 976af630..59438476 100644
--- a/plugins/tapd/tasks/bug_extractor.go
+++ b/plugins/tapd/tasks/bug_extractor.go
@@ -36,10 +36,6 @@ var ExtractBugMeta = core.SubTaskMeta{
 	Description:      "Extract raw workspace data into tool layer table _tool_tapd_iterations",
 }
 
-var bugBody struct {
-	Bug models.TapdBug
-}
-
 func ExtractBugs(taskCtx core.SubTaskContext) error {
 	data := taskCtx.GetData().(*TapdTaskData)
 	db := taskCtx.GetDb()
@@ -76,9 +72,12 @@ func ExtractBugs(taskCtx core.SubTaskContext) error {
 			},
 			Table: RAW_BUG_TABLE,
 		},
+		BatchSize: 100,
 		Extract: func(row *helper.RawData) ([]interface{}, error) {
-
-			err := json.Unmarshal(row.Data, &bugBody)
+			var bugBody struct {
+				Bug models.TapdBug
+			}
+			err = json.Unmarshal(row.Data, &bugBody)
 			if err != nil {
 				return nil, err
 			}
diff --git a/plugins/tapd/tasks/bug_status_extractor.go b/plugins/tapd/tasks/bug_status_extractor.go
index 7ae11fa1..599bef55 100644
--- a/plugins/tapd/tasks/bug_status_extractor.go
+++ b/plugins/tapd/tasks/bug_status_extractor.go
@@ -33,10 +33,6 @@ var ExtractBugStatusMeta = core.SubTaskMeta{
 	Description:      "Extract raw workspace data into tool layer table _tool_tapd_bugStatus",
 }
 
-var statusRes struct {
-	Data map[string]string
-}
-
 func ExtractBugStatus(taskCtx core.SubTaskContext) error {
 	data := taskCtx.GetData().(*TapdTaskData)
 	extractor, err := helper.NewApiExtractor(helper.ApiExtractorArgs{
@@ -50,6 +46,9 @@ func ExtractBugStatus(taskCtx core.SubTaskContext) error {
 			Table: RAW_BUG_STATUS_TABLE,
 		},
 		Extract: func(row *helper.RawData) ([]interface{}, error) {
+			var statusRes struct {
+				Data map[string]string
+			}
 			err := json.Unmarshal(row.Data, &statusRes)
 			if err != nil {
 				return nil, err
diff --git a/plugins/tapd/tasks/iteration_collector.go b/plugins/tapd/tasks/iteration_collector.go
index a860dd45..08c25173 100644
--- a/plugins/tapd/tasks/iteration_collector.go
+++ b/plugins/tapd/tasks/iteration_collector.go
@@ -42,12 +42,12 @@ func CollectIterations(taskCtx core.SubTaskContext) error {
 	if since == nil {
 		// user didn't specify a time range to sync, try load from database
 		var latestUpdated models.TapdIteration
-		err := db.Where("connection_id = ?", data.Connection.ID).Order("modified DESC").Limit(1).Find(&latestUpdated).Error
+		err := db.Where("connection_id = ? and workspace_id = ?", data.Connection.ID, data.Options.WorkspaceID).Order("modified DESC").Limit(1).Find(&latestUpdated).Error
 		if err != nil {
 			return fmt.Errorf("failed to get latest tapd changelog record: %w", err)
 		}
 		if latestUpdated.ID > 0 {
-			since = (*time.Time)(latestUpdated.Modified)
+			since = (*time.Time)(&latestUpdated.Modified)
 			incremental = true
 		}
 	}
diff --git a/plugins/tapd/tasks/iteration_converter.go b/plugins/tapd/tasks/iteration_converter.go
index e165a9c8..ee9dbe79 100644
--- a/plugins/tapd/tasks/iteration_converter.go
+++ b/plugins/tapd/tasks/iteration_converter.go
@@ -60,10 +60,10 @@ func ConvertIteration(taskCtx core.SubTaskContext) error {
 				Url:             fmt.Sprintf("https://www.tapd.cn/%d/prong/iterations/view/%d", iter.WorkspaceID, iter.ID),
 				Status:          strings.ToUpper(iter.Status),
 				Name:            iter.Name,
-				StartedDate:     (*time.Time)(iter.Startdate),
-				EndedDate:       (*time.Time)(iter.Enddate),
+				StartedDate:     (*time.Time)(&iter.Startdate),
+				EndedDate:       (*time.Time)(&iter.Enddate),
 				OriginalBoardID: WorkspaceIdGen.Generate(iter.ConnectionId, iter.WorkspaceID),
-				CompletedDate:   (*time.Time)(iter.Completed),
+				CompletedDate:   (*time.Time)(&iter.Completed),
 			}
 			results := make([]interface{}, 0)
 			results = append(results, domainIter)
diff --git a/plugins/tapd/tasks/iteration_extractor.go b/plugins/tapd/tasks/iteration_extractor.go
index ffb3f260..65f1fede 100644
--- a/plugins/tapd/tasks/iteration_extractor.go
+++ b/plugins/tapd/tasks/iteration_extractor.go
@@ -33,10 +33,6 @@ var ExtractIterationMeta = core.SubTaskMeta{
 	Description:      "Extract raw workspace data into tool layer table _tool_tapd_iterations",
 }
 
-var iterBody struct {
-	Iteration models.TapdIteration
-}
-
 func ExtractIterations(taskCtx core.SubTaskContext) error {
 	data := taskCtx.GetData().(*TapdTaskData)
 	extractor, err := helper.NewApiExtractor(helper.ApiExtractorArgs{
@@ -50,7 +46,9 @@ func ExtractIterations(taskCtx core.SubTaskContext) error {
 			Table: RAW_ITERATION_TABLE,
 		},
 		Extract: func(row *helper.RawData) ([]interface{}, error) {
-
+			var iterBody struct {
+				Iteration models.TapdIteration
+			}
 			err := json.Unmarshal(row.Data, &iterBody)
 			if err != nil {
 				return nil, err
diff --git a/plugins/tapd/tasks/story_category_extractor.go b/plugins/tapd/tasks/story_category_extractor.go
index 9bb407a7..0d4b8897 100644
--- a/plugins/tapd/tasks/story_category_extractor.go
+++ b/plugins/tapd/tasks/story_category_extractor.go
@@ -33,10 +33,6 @@ var ExtractStoryCategoriesMeta = core.SubTaskMeta{
 	Description:      "Extract raw company data into tool layer table _tool_tapd_story_category",
 }
 
-var storyCategory struct {
-	Category models.TapdStoryCategory
-}
-
 func ExtractStoryCategories(taskCtx core.SubTaskContext) error {
 	data := taskCtx.GetData().(*TapdTaskData)
 	extractor, err := helper.NewApiExtractor(helper.ApiExtractorArgs{
@@ -49,6 +45,9 @@ func ExtractStoryCategories(taskCtx core.SubTaskContext) error {
 			Table: RAW_STORY_CATEGORY_TABLE,
 		},
 		Extract: func(row *helper.RawData) ([]interface{}, error) {
+			var storyCategory struct {
+				Category models.TapdStoryCategory
+			}
 			err := json.Unmarshal(row.Data, &storyCategory)
 			if err != nil {
 				return nil, err
diff --git a/plugins/tapd/tasks/story_changelog_collector.go b/plugins/tapd/tasks/story_changelog_collector.go
index 2410f663..4bc2b991 100644
--- a/plugins/tapd/tasks/story_changelog_collector.go
+++ b/plugins/tapd/tasks/story_changelog_collector.go
@@ -42,12 +42,12 @@ func CollectStoryChangelogs(taskCtx core.SubTaskContext) error {
 	if since == nil {
 		// user didn't specify a time range to sync, try load from database
 		var latestUpdated models.TapdStoryChangelog
-		err := db.Where("connection_id = ?", data.Connection.ID).Order("created DESC").Limit(1).Find(&latestUpdated).Error
+		err := db.Where("connection_id = ? and workspace_id = ?", data.Connection.ID, data.Options.WorkspaceID).Order("created DESC").Limit(1).Find(&latestUpdated).Error
 		if err != nil {
 			return fmt.Errorf("failed to get latest tapd changelog record: %w", err)
 		}
 		if latestUpdated.ID > 0 {
-			since = (*time.Time)(latestUpdated.Created)
+			since = (*time.Time)(&latestUpdated.Created)
 			incremental = true
 		}
 	}
diff --git a/plugins/tapd/tasks/story_changelog_extractor.go b/plugins/tapd/tasks/story_changelog_extractor.go
index 714037e3..9b14de26 100644
--- a/plugins/tapd/tasks/story_changelog_extractor.go
+++ b/plugins/tapd/tasks/story_changelog_extractor.go
@@ -34,10 +34,6 @@ var ExtractStoryChangelogMeta = core.SubTaskMeta{
 	Description:      "Extract raw workspace data into tool layer table _tool_tapd_iterations",
 }
 
-var storyChangelogBody struct {
-	WorkitemChange models.TapdStoryChangelog
-}
-
 func ExtractStoryChangelog(taskCtx core.SubTaskContext) error {
 	data := taskCtx.GetData().(*TapdTaskData)
 	extractor, err := helper.NewApiExtractor(helper.ApiExtractorArgs{
@@ -51,7 +47,9 @@ func ExtractStoryChangelog(taskCtx core.SubTaskContext) error {
 			Table: RAW_STORY_CHANGELOG_TABLE,
 		},
 		Extract: func(row *helper.RawData) ([]interface{}, error) {
-
+			var storyChangelogBody struct {
+				WorkitemChange models.TapdStoryChangelog
+			}
 			results := make([]interface{}, 0, 2)
 
 			err := json.Unmarshal(row.Data, &storyChangelogBody)
diff --git a/plugins/tapd/tasks/story_collector.go b/plugins/tapd/tasks/story_collector.go
index 249448a7..88848cb5 100644
--- a/plugins/tapd/tasks/story_collector.go
+++ b/plugins/tapd/tasks/story_collector.go
@@ -42,12 +42,12 @@ func CollectStorys(taskCtx core.SubTaskContext) error {
 	if since == nil {
 		// user didn't specify a time range to sync, try load from database
 		var latestUpdated models.TapdStory
-		err := db.Where("connection_id = ?", data.Connection.ID).Order("modified DESC").Limit(1).Find(&latestUpdated).Error
+		err := db.Where("connection_id = ? and workspace_id = ?", data.Connection.ID, data.Options.WorkspaceID).Order("modified DESC").Limit(1).Find(&latestUpdated).Error
 		if err != nil {
 			return fmt.Errorf("failed to get latest tapd changelog record: %w", err)
 		}
 		if latestUpdated.ID > 0 {
-			since = (*time.Time)(latestUpdated.Modified)
+			since = (*time.Time)(&latestUpdated.Modified)
 			incremental = true
 		}
 	}
diff --git a/plugins/tapd/tasks/story_commit_collector.go b/plugins/tapd/tasks/story_commit_collector.go
index d8e6fc41..66892863 100644
--- a/plugins/tapd/tasks/story_commit_collector.go
+++ b/plugins/tapd/tasks/story_commit_collector.go
@@ -42,25 +42,27 @@ func CollectStoryCommits(taskCtx core.SubTaskContext) error {
 	db := taskCtx.GetDb()
 	logger := taskCtx.GetLogger()
 	logger.Info("collect issueCommits")
-
+	num := 0
 	since := data.Since
 	incremental := false
 	if since == nil {
 		// user didn't specify a time range to sync, try load from database
 		var latestUpdated models.TapdStoryCommit
-		err := db.Where("connection_id = ?", data.Connection.ID).Order("created DESC").Limit(1).Find(&latestUpdated).Error
+		err := db.Where("connection_id = ? and workspace_id = ?", data.Connection.ID, data.Options.WorkspaceID).Order("created DESC").Limit(1).Find(&latestUpdated).Error
 		if err != nil {
 			return fmt.Errorf("failed to get latest tapd changelog record: %w", err)
 		}
 		if latestUpdated.ID > 0 {
-			since = (*time.Time)(latestUpdated.Created)
+			since = (*time.Time)(&latestUpdated.Created)
 			incremental = true
 		}
 	}
 
 	tx := db.Model(&models.TapdStory{})
+	tx = tx.Where("connection_id = ? and workspace_id = ?", data.Options.ConnectionId, data.Options.WorkspaceID)
+
 	if since != nil {
-		tx = tx.Where("modified > ? and connection_id = ? and workspace_id = ?", since, data.Options.ConnectionId, data.Options.WorkspaceID)
+		tx = tx.Where("modified > ?", since)
 	}
 	cursor, err := tx.Select("id").Rows()
 	if err != nil {
@@ -98,6 +100,13 @@ func CollectStoryCommits(taskCtx core.SubTaskContext) error {
 			var data struct {
 				Stories []json.RawMessage `json:"data"`
 			}
+			if len(data.Stories) > 0 {
+				fmt.Println(len(data.Stories))
+				num += len(data.Stories)
+				fmt.Printf("num is %d", num)
+
+			}
+
 			err := helper.UnmarshalResponse(res, &data)
 			return data.Stories, err
 		},
diff --git a/plugins/tapd/tasks/story_converter.go b/plugins/tapd/tasks/story_converter.go
index 41824568..1fc1e147 100644
--- a/plugins/tapd/tasks/story_converter.go
+++ b/plugins/tapd/tasks/story_converter.go
@@ -64,9 +64,9 @@ func ConvertStory(taskCtx core.SubTaskContext) error {
 				Status:               toolL.StdStatus,
 				StoryPoint:           uint(toolL.Size),
 				OriginalStatus:       toolL.Status,
-				ResolutionDate:       (*time.Time)(toolL.Completed),
-				CreatedDate:          (*time.Time)(toolL.Created),
-				UpdatedDate:          (*time.Time)(toolL.Modified),
+				ResolutionDate:       (*time.Time)(&toolL.Completed),
+				CreatedDate:          (*time.Time)(&toolL.Created),
+				UpdatedDate:          (*time.Time)(&toolL.Modified),
 				ParentIssueId:        IssueIdGen.Generate(toolL.ConnectionId, toolL.ParentID),
 				Priority:             toolL.Priority,
 				TimeRemainingMinutes: int64(toolL.Remain),
diff --git a/plugins/tapd/tasks/story_custom_fields_extractor.go b/plugins/tapd/tasks/story_custom_fields_extractor.go
index 5ac714fb..b7d3cb91 100644
--- a/plugins/tapd/tasks/story_custom_fields_extractor.go
+++ b/plugins/tapd/tasks/story_custom_fields_extractor.go
@@ -33,10 +33,6 @@ var ExtractStoryCustomFieldsMeta = core.SubTaskMeta{
 	Description:      "Extract raw company data into tool layer table _tool_tapd_story_custom_fields",
 }
 
-var storyCustomFields struct {
-	CustomFieldConfig models.TapdStoryCustomFields
-}
-
 func ExtractStoryCustomFields(taskCtx core.SubTaskContext) error {
 	data := taskCtx.GetData().(*TapdTaskData)
 	extractor, err := helper.NewApiExtractor(helper.ApiExtractorArgs{
@@ -49,6 +45,9 @@ func ExtractStoryCustomFields(taskCtx core.SubTaskContext) error {
 			Table: RAW_STORY_CUSTOM_FIELDS_TABLE,
 		},
 		Extract: func(row *helper.RawData) ([]interface{}, error) {
+			var storyCustomFields struct {
+				CustomFieldConfig models.TapdStoryCustomFields
+			}
 			err := json.Unmarshal(row.Data, &storyCustomFields)
 			if err != nil {
 				return nil, err
diff --git a/plugins/tapd/tasks/story_extractor.go b/plugins/tapd/tasks/story_extractor.go
index d69a4429..420669aa 100644
--- a/plugins/tapd/tasks/story_extractor.go
+++ b/plugins/tapd/tasks/story_extractor.go
@@ -36,15 +36,11 @@ var ExtractStoryMeta = core.SubTaskMeta{
 	Description:      "Extract raw workspace data into tool layer table _tool_tapd_iterations",
 }
 
-var storyBody struct {
-	Story models.TapdStory
-}
-
 func ExtractStories(taskCtx core.SubTaskContext) error {
 	data := taskCtx.GetData().(*TapdTaskData)
 	db := taskCtx.GetDb()
-	statusList := make([]*models.TapdBugStatus, 0)
-	err := db.Model(&models.TapdBugStatus{}).
+	statusList := make([]*models.TapdStoryStatus, 0)
+	err := db.Model(&models.TapdStoryStatus{}).
 		Find(&statusList, "connection_id = ? and workspace_id = ?", data.Options.ConnectionId, data.Options.WorkspaceID).
 		Error
 	if err != nil {
@@ -56,7 +52,7 @@ func ExtractStories(taskCtx core.SubTaskContext) error {
 		statusMap[v.EnglishName] = v.ChineseName
 	}
 	getStdStatus := func(statusKey string) string {
-		if statusKey == "已实现" || statusKey == "已拒绝" || statusKey == "关闭" || statusKey == "已取消" {
+		if statusKey == "已实现" || statusKey == "已拒绝" || statusKey == "关闭" || statusKey == "已取消" || statusKey == "已解决" {
 			return ticket.DONE
 		} else if statusKey == "草稿" {
 			return ticket.TODO
@@ -74,8 +70,11 @@ func ExtractStories(taskCtx core.SubTaskContext) error {
 			},
 			Table: RAW_STORY_TABLE,
 		},
+		BatchSize: 100,
 		Extract: func(row *helper.RawData) ([]interface{}, error) {
-
+			var storyBody struct {
+				Story models.TapdStory
+			}
 			err := json.Unmarshal(row.Data, &storyBody)
 			if err != nil {
 				return nil, err
diff --git a/plugins/tapd/tasks/story_status_collector.go b/plugins/tapd/tasks/story_status_collector.go
index 04c35a4d..c1bb6156 100644
--- a/plugins/tapd/tasks/story_status_collector.go
+++ b/plugins/tapd/tasks/story_status_collector.go
@@ -24,7 +24,7 @@ import (
 	"net/url"
 )
 
-const RAW_STORY_STATUS_TABLE = "tapd_api_bug_status"
+const RAW_STORY_STATUS_TABLE = "tapd_api_story_status"
 
 var _ core.SubTaskEntryPoint = CollectStoryStatus
 
@@ -49,7 +49,7 @@ func CollectStoryStatus(taskCtx core.SubTaskContext) error {
 		Query: func(reqData *helper.RequestData) (url.Values, error) {
 			query := url.Values{}
 			query.Set("workspace_id", fmt.Sprintf("%v", data.Options.WorkspaceID))
-			query.Set("system", "bug")
+			query.Set("system", "story")
 			return query, nil
 		},
 		ResponseParser: GetRawMessageDirectFromResponse,
diff --git a/plugins/tapd/tasks/story_status_extractor.go b/plugins/tapd/tasks/story_status_extractor.go
index 30d91657..9ccc8a0b 100644
--- a/plugins/tapd/tasks/story_status_extractor.go
+++ b/plugins/tapd/tasks/story_status_extractor.go
@@ -33,10 +33,6 @@ var ExtractStoryStatusMeta = core.SubTaskMeta{
 	Description:      "Extract raw workspace data into tool layer table _tool_tapd_bugStatus",
 }
 
-var storyStatusRes struct {
-	Data map[string]string
-}
-
 func ExtractStoryStatus(taskCtx core.SubTaskContext) error {
 	data := taskCtx.GetData().(*TapdTaskData)
 	extractor, err := helper.NewApiExtractor(helper.ApiExtractorArgs{
@@ -50,6 +46,9 @@ func ExtractStoryStatus(taskCtx core.SubTaskContext) error {
 			Table: RAW_STORY_STATUS_TABLE,
 		},
 		Extract: func(row *helper.RawData) ([]interface{}, error) {
+			var storyStatusRes struct {
+				Data map[string]string
+			}
 			err := json.Unmarshal(row.Data, &storyStatusRes)
 			if err != nil {
 				return nil, err
diff --git a/plugins/tapd/tasks/task_changelog_collector.go b/plugins/tapd/tasks/task_changelog_collector.go
index 51bdf3a7..87c8165d 100644
--- a/plugins/tapd/tasks/task_changelog_collector.go
+++ b/plugins/tapd/tasks/task_changelog_collector.go
@@ -42,12 +42,12 @@ func CollectTaskChangelogs(taskCtx core.SubTaskContext) error {
 	if since == nil {
 		// user didn't specify a time range to sync, try load from database
 		var latestUpdated models.TapdTaskChangelog
-		err := db.Where("connection_id = ?", data.Connection.ID).Order("created DESC").Limit(1).Find(&latestUpdated).Error
+		err := db.Where("connection_id = ? and workspace_id = ?", data.Connection.ID, data.Options.WorkspaceID).Order("created DESC").Limit(1).Find(&latestUpdated).Error
 		if err != nil {
 			return fmt.Errorf("failed to get latest tapd changelog record: %w", err)
 		}
 		if latestUpdated.ID > 0 {
-			since = (*time.Time)(latestUpdated.Created)
+			since = (*time.Time)(&latestUpdated.Created)
 			incremental = true
 		}
 	}
diff --git a/plugins/tapd/tasks/task_changelog_extractor.go b/plugins/tapd/tasks/task_changelog_extractor.go
index a5033c6b..b04be435 100644
--- a/plugins/tapd/tasks/task_changelog_extractor.go
+++ b/plugins/tapd/tasks/task_changelog_extractor.go
@@ -34,10 +34,6 @@ var ExtractTaskChangelogMeta = core.SubTaskMeta{
 	Description:      "Extract raw workspace data into tool layer table _tool_tapd_iterations",
 }
 
-var taskChangelogBody struct {
-	WorkitemChange models.TapdTaskChangelog
-}
-
 func ExtractTaskChangelog(taskCtx core.SubTaskContext) error {
 	data := taskCtx.GetData().(*TapdTaskData)
 	extractor, err := helper.NewApiExtractor(helper.ApiExtractorArgs{
@@ -51,7 +47,9 @@ func ExtractTaskChangelog(taskCtx core.SubTaskContext) error {
 			Table: RAW_TASK_CHANGELOG_TABLE,
 		},
 		Extract: func(row *helper.RawData) ([]interface{}, error) {
-
+			var taskChangelogBody struct {
+				WorkitemChange models.TapdTaskChangelog
+			}
 			results := make([]interface{}, 0, 2)
 
 			err := json.Unmarshal(row.Data, &taskChangelogBody)
diff --git a/plugins/tapd/tasks/task_collector.go b/plugins/tapd/tasks/task_collector.go
index 2a630d21..35ea0a60 100644
--- a/plugins/tapd/tasks/task_collector.go
+++ b/plugins/tapd/tasks/task_collector.go
@@ -44,12 +44,12 @@ func CollectTasks(taskCtx core.SubTaskContext) error {
 	if since == nil {
 		// user didn't specify a time range to sync, try load from database
 		var latestUpdated models.TapdTask
-		err := db.Where("connection_id = ?", data.Connection.ID).Order("modified DESC").Limit(1).Find(&latestUpdated).Error
+		err := db.Where("connection_id = ? and workspace_id = ?", data.Connection.ID, data.Options.WorkspaceID).Order("modified DESC").Limit(1).Find(&latestUpdated).Error
 		if err != nil {
 			return fmt.Errorf("failed to get latest tapd changelog record: %w", err)
 		}
 		if latestUpdated.ID > 0 {
-			since = (*time.Time)(latestUpdated.Modified)
+			since = (*time.Time)(&latestUpdated.Modified)
 			incremental = true
 		}
 	}
diff --git a/plugins/tapd/tasks/task_commit_collector.go b/plugins/tapd/tasks/task_commit_collector.go
index 09085dac..cfbfd902 100644
--- a/plugins/tapd/tasks/task_commit_collector.go
+++ b/plugins/tapd/tasks/task_commit_collector.go
@@ -42,25 +42,27 @@ func CollectTaskCommits(taskCtx core.SubTaskContext) error {
 	db := taskCtx.GetDb()
 	logger := taskCtx.GetLogger()
 	logger.Info("collect issueCommits")
-
+	num := 0
 	since := data.Since
 	incremental := false
 	if since == nil {
 		// user didn't specify a time range to sync, try load from database
 		var latestUpdated models.TapdTaskCommit
-		err := db.Where("connection_id = ?", data.Connection.ID).Order("created DESC").Limit(1).Find(&latestUpdated).Error
+		err := db.Where("connection_id = ? and workspace_id = ?", data.Connection.ID, data.Options.WorkspaceID).Order("created DESC").Limit(1).Find(&latestUpdated).Error
 		if err != nil {
 			return fmt.Errorf("failed to get latest tapd changelog record: %w", err)
 		}
 		if latestUpdated.ID > 0 {
-			since = (*time.Time)(latestUpdated.Created)
+			since = (*time.Time)(&latestUpdated.Created)
 			incremental = true
 		}
 	}
 
 	tx := db.Model(&models.TapdTask{})
+	tx = tx.Where("connection_id = ? and workspace_id = ?", data.Options.ConnectionId, data.Options.WorkspaceID)
+
 	if since != nil {
-		tx = tx.Where("modified > ? and connection_id = ? and workspace_id = ?", since, data.Options.ConnectionId, data.Options.WorkspaceID)
+		tx = tx.Where("modified > ?", since)
 	}
 	cursor, err := tx.Select("id").Rows()
 	if err != nil {
@@ -98,6 +100,12 @@ func CollectTaskCommits(taskCtx core.SubTaskContext) error {
 			var data struct {
 				Stories []json.RawMessage `json:"data"`
 			}
+			if len(data.Stories) > 0 {
+				fmt.Println(len(data.Stories))
+				num += len(data.Stories)
+				fmt.Printf("num is %d", num)
+
+			}
 			err := helper.UnmarshalResponse(res, &data)
 			return data.Stories, err
 		},
diff --git a/plugins/tapd/tasks/task_converter.go b/plugins/tapd/tasks/task_converter.go
index 805acc13..e025d0fb 100644
--- a/plugins/tapd/tasks/task_converter.go
+++ b/plugins/tapd/tasks/task_converter.go
@@ -64,9 +64,9 @@ func ConvertTask(taskCtx core.SubTaskContext) error {
 				Type:           toolL.StdType,
 				Status:         toolL.StdStatus,
 				OriginalStatus: toolL.Status,
-				ResolutionDate: (*time.Time)(toolL.Completed),
-				CreatedDate:    (*time.Time)(toolL.Created),
-				UpdatedDate:    (*time.Time)(toolL.Modified),
+				ResolutionDate: (*time.Time)(&toolL.Completed),
+				CreatedDate:    (*time.Time)(&toolL.Created),
+				UpdatedDate:    (*time.Time)(&toolL.Modified),
 				ParentIssueId:  IssueIdGen.Generate(toolL.ConnectionId, toolL.StoryID),
 				Priority:       toolL.Priority,
 				CreatorId:      UserIdGen.Generate(data.Connection.ID, toolL.WorkspaceID, toolL.Creator),
diff --git a/plugins/tapd/tasks/task_custom_fields_extractor.go b/plugins/tapd/tasks/task_custom_fields_extractor.go
index 57727949..d3523830 100644
--- a/plugins/tapd/tasks/task_custom_fields_extractor.go
+++ b/plugins/tapd/tasks/task_custom_fields_extractor.go
@@ -33,10 +33,6 @@ var ExtractTaskCustomFieldsMeta = core.SubTaskMeta{
 	Description:      "Extract raw company data into tool layer table _tool_tapd_task_custom_fields",
 }
 
-var taskCustomFieldsRes struct {
-	CustomFieldConfig models.TapdTaskCustomFields
-}
-
 func ExtractTaskCustomFields(taskCtx core.SubTaskContext) error {
 	data := taskCtx.GetData().(*TapdTaskData)
 	extractor, err := helper.NewApiExtractor(helper.ApiExtractorArgs{
@@ -49,6 +45,9 @@ func ExtractTaskCustomFields(taskCtx core.SubTaskContext) error {
 			Table: RAW_TASK_CUSTOM_FIELDS_TABLE,
 		},
 		Extract: func(row *helper.RawData) ([]interface{}, error) {
+			var taskCustomFieldsRes struct {
+				CustomFieldConfig models.TapdTaskCustomFields
+			}
 			err := json.Unmarshal(row.Data, &taskCustomFieldsRes)
 			if err != nil {
 				return nil, err
diff --git a/plugins/tapd/tasks/task_extractor.go b/plugins/tapd/tasks/task_extractor.go
index db9b3b82..87a5e99a 100644
--- a/plugins/tapd/tasks/task_extractor.go
+++ b/plugins/tapd/tasks/task_extractor.go
@@ -36,10 +36,6 @@ var ExtractTaskMeta = core.SubTaskMeta{
 	Description:      "Extract raw workspace data into tool layer table _tool_tapd_iterations",
 }
 
-var taskBody struct {
-	Task models.TapdTask
-}
-
 func ExtractTasks(taskCtx core.SubTaskContext) error {
 	data := taskCtx.GetData().(*TapdTaskData)
 	getStdStatus := func(statusKey string) string {
@@ -61,7 +57,11 @@ func ExtractTasks(taskCtx core.SubTaskContext) error {
 			},
 			Table: RAW_TASK_TABLE,
 		},
+		BatchSize: 100,
 		Extract: func(row *helper.RawData) ([]interface{}, error) {
+			var taskBody struct {
+				Task models.TapdTask
+			}
 
 			err := json.Unmarshal(row.Data, &taskBody)
 			if err != nil {
diff --git a/plugins/tapd/tasks/user_extractor.go b/plugins/tapd/tasks/user_extractor.go
index 49613051..3db27f85 100644
--- a/plugins/tapd/tasks/user_extractor.go
+++ b/plugins/tapd/tasks/user_extractor.go
@@ -33,10 +33,6 @@ var ExtractUserMeta = core.SubTaskMeta{
 	Description:      "Extract raw workspace data into tool layer table _tool_tapd_users",
 }
 
-var userRes struct {
-	UserWorkspace models.TapdUser
-}
-
 func ExtractUsers(taskCtx core.SubTaskContext) error {
 	data := taskCtx.GetData().(*TapdTaskData)
 	extractor, err := helper.NewApiExtractor(helper.ApiExtractorArgs{
@@ -50,6 +46,9 @@ func ExtractUsers(taskCtx core.SubTaskContext) error {
 			Table: RAW_USER_TABLE,
 		},
 		Extract: func(row *helper.RawData) ([]interface{}, error) {
+			var userRes struct {
+				UserWorkspace models.TapdUser
+			}
 			err := json.Unmarshal(row.Data, &userRes)
 			if err != nil {
 				return nil, err
diff --git a/plugins/tapd/tasks/worklog_collector.go b/plugins/tapd/tasks/worklog_collector.go
index f826dedb..4987e17d 100644
--- a/plugins/tapd/tasks/worklog_collector.go
+++ b/plugins/tapd/tasks/worklog_collector.go
@@ -42,12 +42,12 @@ func CollectWorklogs(taskCtx core.SubTaskContext) error {
 	if since == nil {
 		// user didn't specify a time range to sync, try load from database
 		var latestUpdated models.TapdWorklog
-		err := db.Where("connection_id = ?", data.Connection.ID).Order("created DESC").Limit(1).Find(&latestUpdated).Error
+		err := db.Where("connection_id = ? and workspace_id = ?", data.Connection.ID, data.Options.WorkspaceID).Order("created DESC").Limit(1).Find(&latestUpdated).Error
 		if err != nil {
 			return fmt.Errorf("failed to get latest tapd changelog record: %w", err)
 		}
 		if latestUpdated.ID > 0 {
-			since = (*time.Time)(latestUpdated.Created)
+			since = (*time.Time)(&latestUpdated.Created)
 			incremental = true
 		}
 	}
diff --git a/plugins/tapd/tasks/worklog_converter.go b/plugins/tapd/tasks/worklog_converter.go
index b3dc7f4a..5ac30837 100644
--- a/plugins/tapd/tasks/worklog_converter.go
+++ b/plugins/tapd/tasks/worklog_converter.go
@@ -60,7 +60,7 @@ func ConvertWorklog(taskCtx core.SubTaskContext) error {
 				AuthorId:         UserIdGen.Generate(data.Connection.ID, toolL.WorkspaceID, toolL.Owner),
 				Comment:          toolL.Memo,
 				TimeSpentMinutes: int(toolL.Timespent),
-				LoggedDate:       (*time.Time)(toolL.Created),
+				LoggedDate:       (*time.Time)(&toolL.Created),
 				//IssueId:          toolL.EntityID,
 			}
 			switch toolL.EntityType {
diff --git a/plugins/tapd/tasks/worklog_extractor.go b/plugins/tapd/tasks/worklog_extractor.go
index 1ed7f0d8..356b214f 100644
--- a/plugins/tapd/tasks/worklog_extractor.go
+++ b/plugins/tapd/tasks/worklog_extractor.go
@@ -33,10 +33,6 @@ var ExtractWorklogMeta = core.SubTaskMeta{
 	Description:      "Extract raw workspace data into tool layer table _tool_tapd_iterations",
 }
 
-var worklogBody struct {
-	Timesheet models.TapdWorklog
-}
-
 func ExtractWorklogs(taskCtx core.SubTaskContext) error {
 	data := taskCtx.GetData().(*TapdTaskData)
 	extractor, err := helper.NewApiExtractor(helper.ApiExtractorArgs{
@@ -50,6 +46,9 @@ func ExtractWorklogs(taskCtx core.SubTaskContext) error {
 			Table: RAW_WORKLOG_TABLE,
 		},
 		Extract: func(row *helper.RawData) ([]interface{}, error) {
+			var worklogBody struct {
+				Timesheet models.TapdWorklog
+			}
 
 			err := json.Unmarshal(row.Data, &worklogBody)
 			if err != nil {
diff --git a/plugins/tapd/tasks/workspace_collector.go b/plugins/tapd/tasks/workspace_collector.go
index 41e2a4c2..944f62ea 100644
--- a/plugins/tapd/tasks/workspace_collector.go
+++ b/plugins/tapd/tasks/workspace_collector.go
@@ -26,7 +26,7 @@ import (
 	"net/url"
 )
 
-const RAW_WORKSPACE_TABLE = "tapd_api_workspaces"
+const RAW_WORKSPACE_TABLE = "tapd_api_sub_workspaces"
 
 var _ core.SubTaskEntryPoint = CollectWorkspaces
 


[incubator-devlake] 01/02: feat(tapd): add story category

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

warren pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 9e7fc6d953fbf5e1b17dfddb32d9af5e9aa90e09
Author: Yingchu Chen <yi...@merico.dev>
AuthorDate: Wed May 25 21:25:39 2022 +0800

    feat(tapd): add story category
    
    closes #2010
---
 plugins/tapd/tasks/story_category_extractor.go | 1 -
 1 file changed, 1 deletion(-)

diff --git a/plugins/tapd/tasks/story_category_extractor.go b/plugins/tapd/tasks/story_category_extractor.go
index bc960181..9bb407a7 100644
--- a/plugins/tapd/tasks/story_category_extractor.go
+++ b/plugins/tapd/tasks/story_category_extractor.go
@@ -53,7 +53,6 @@ func ExtractStoryCategories(taskCtx core.SubTaskContext) error {
 			if err != nil {
 				return nil, err
 			}
-
 			toolL := storyCategory.Category
 
 			toolL.ConnectionId = data.Connection.ID