You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: backend/src/apiserver/model/pipeline_version.go
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -31,19 +31,21 @@ const (
31
31
typePipelineVersionstruct {
32
32
UUIDstring`gorm:"column:UUID; not null; primaryKey;"`
33
33
CreatedAtInSecint64`gorm:"column:CreatedAtInSec; not null; index;"`
34
-
// Explicitly specify type:varchar(255) to ensure MySQL can create index on this column.
34
+
// Explicitly specify varchar(127) and varchar(64) for PipelineId & Name
35
+
// so that the combined index (PipelineId + Name) do not exceed 767 bytes in utf8mb4,
36
+
// which ensures MySQL can create composite index on this column.
35
37
// In GORM v1, omitting type still allowed index creation due to default behavior.
36
38
// However, GORM v2 requires explicit type declaration for indexed string fields,
37
39
// otherwise it may default to longtext, which is not indexable in MySQL.
38
-
Namestring`gorm:"column:Name; not null; type:varchar(255); uniqueIndex:idx_pipelineid_name;"`
40
+
Namestring`gorm:"column:Name; not null; type:varchar(127); uniqueIndex:idx_pipelineid_name;"`
39
41
DisplayNamestring`gorm:"column:DisplayName; not null"`
40
42
// TODO(gkcalat): this is deprecated. Consider removing and adding data migration logic at the server startup.
41
43
Parametersstring`gorm:"column:Parameters; not null; type:text;"`// deprecated
42
44
// PipelineVersion belongs to Pipeline. If a pipeline with a specific UUID
43
45
// is deleted from Pipeline table, all this pipeline's versions will be
44
46
// deleted from PipelineVersion table.
45
47
// nolint:staticcheck // [ST1003] Field name matches upstream legacy naming
46
-
PipelineIdstring`gorm:"column:PipelineId; not null; index; uniqueIndex:idx_pipelineid_name;"`
48
+
PipelineIdstring`gorm:"column:PipelineId; not null; index; uniqueIndex:idx_pipelineid_name;type:varchar(64)"`
47
49
PipelinePipeline`gorm:"foreignKey:PipelineId;references:UUID;constraint:OnDelete:CASCADE,OnUpdate:CASCADE"`// This 'belongs to' relation replaces the legacy AddForeignKey constraint previously defined in client_manager.go
48
50
StatusPipelineVersionStatus`gorm:"column:Status; not null;"`
49
51
// Code source url links to the pipeline version's definition in repo.
0 commit comments