diff --git a/server/model/pipeline.go b/server/model/pipeline.go index 77b39ab49..991839c69 100644 --- a/server/model/pipeline.go +++ b/server/model/pipeline.go @@ -24,7 +24,7 @@ type Pipeline struct { Parent int64 `json:"parent" xorm:"pipeline_parent"` Event WebhookEvent `json:"event" xorm:"pipeline_event"` Status StatusValue `json:"status" xorm:"INDEX 'pipeline_status'"` - Error string `json:"error" xorm:"pipeline_error"` + Error string `json:"error" xorm:"LONGTEXT 'pipeline_error'"` Enqueued int64 `json:"enqueued_at" xorm:"pipeline_enqueued"` Created int64 `json:"created_at" xorm:"pipeline_created"` Updated int64 `json:"updated_at" xorm:"updated NOT NULL DEFAULT 0 'updated'"` @@ -46,7 +46,7 @@ type Pipeline struct { Reviewer string `json:"reviewed_by" xorm:"pipeline_reviewer"` Reviewed int64 `json:"reviewed_at" xorm:"pipeline_reviewed"` Workflows []*Workflow `json:"workflows,omitempty" xorm:"-"` - ChangedFiles []string `json:"changed_files,omitempty" xorm:"json 'changed_files'"` + ChangedFiles []string `json:"changed_files,omitempty" xorm:"LONGTEXT 'changed_files'"` AdditionalVariables map[string]string `json:"variables,omitempty" xorm:"json 'additional_variables'"` PullRequestLabels []string `json:"pr_labels,omitempty" xorm:"json 'pr_labels'"` } // @name Pipeline diff --git a/server/model/step.go b/server/model/step.go index 2922f3f11..bf0661c9e 100644 --- a/server/model/step.go +++ b/server/model/step.go @@ -36,13 +36,13 @@ const ( // Step represents a process in the pipeline. type Step struct { ID int64 `json:"id" xorm:"pk autoincr 'step_id'"` - UUID string `json:"uuid" xorm:"UNIQUE INDEX 'step_uuid'"` + UUID string `json:"uuid" xorm:"INDEX 'step_uuid'"` PipelineID int64 `json:"pipeline_id" xorm:"UNIQUE(s) INDEX 'step_pipeline_id'"` PID int `json:"pid" xorm:"UNIQUE(s) 'step_pid'"` PPID int `json:"ppid" xorm:"step_ppid"` Name string `json:"name" xorm:"step_name"` State StatusValue `json:"state" xorm:"step_state"` - Error string `json:"error,omitempty" xorm:"VARCHAR(500) step_error"` + Error string `json:"error,omitempty" xorm:"TEXT 'step_error'"` Failure string `json:"-" xorm:"step_failure"` ExitCode int `json:"exit_code" xorm:"step_exit_code"` Started int64 `json:"start_time,omitempty" xorm:"step_started"` diff --git a/server/model/workflow.go b/server/model/workflow.go index b594631bd..edd5b0a45 100644 --- a/server/model/workflow.go +++ b/server/model/workflow.go @@ -22,7 +22,7 @@ type Workflow struct { PID int `json:"pid" xorm:"UNIQUE(s) 'workflow_pid'"` Name string `json:"name" xorm:"workflow_name"` State StatusValue `json:"state" xorm:"workflow_state"` - Error string `json:"error,omitempty" xorm:"VARCHAR(500) workflow_error"` + Error string `json:"error,omitempty" xorm:"TEXT 'workflow_error'"` Started int64 `json:"start_time,omitempty" xorm:"workflow_started"` Stopped int64 `json:"end_time,omitempty" xorm:"workflow_stopped"` AgentID int64 `json:"agent_id,omitempty" xorm:"workflow_agent_id"` diff --git a/server/store/datastore/migration/020_parent_steps_to_workflows.go b/server/store/datastore/migration/020_parent_steps_to_workflows.go index aa4e77cd9..18c21cbb8 100644 --- a/server/store/datastore/migration/020_parent_steps_to_workflows.go +++ b/server/store/datastore/migration/020_parent_steps_to_workflows.go @@ -27,7 +27,7 @@ type oldStep020 struct { PPID int `xorm:"step_ppid"` Name string `xorm:"step_name"` State model.StatusValue `xorm:"step_state"` - Error string `xorm:"VARCHAR(500) step_error"` + Error string `xorm:"TEXT 'step_error'"` Started int64 `xorm:"step_started"` Stopped int64 `xorm:"step_stopped"` AgentID int64 `xorm:"step_agent_id"` diff --git a/server/store/datastore/step_test.go b/server/store/datastore/step_test.go index 8238baa07..3fd385969 100644 --- a/server/store/datastore/step_test.go +++ b/server/store/datastore/step_test.go @@ -179,6 +179,8 @@ func TestStepIndexes(t *testing.T) { defer closer() sess := store.engine.NewSession() + defer sess.Close() + if err := store.stepCreate(sess, []*model.Step{ { UUID: "4db7e5fc-5312-4d02-9e14-b51b9e3242cc", @@ -206,21 +208,6 @@ func TestStepIndexes(t *testing.T) { }); err == nil { t.Errorf("Unexpected error: duplicate pid") } - - // fail due to duplicate uuid - if err := store.stepCreate(sess, []*model.Step{ - { - UUID: "4db7e5fc-5312-4d02-9e14-b51b9e3242cc", - PipelineID: 5, - PID: 4, - PPID: 3, - State: "success", - Name: "clone", - }, - }); err == nil { - t.Errorf("Unexpected error: duplicate pid") - } - _ = sess.Close() } func TestStepByUUID(t *testing.T) {