This is an automated email from the ASF dual-hosted git repository. narro pushed a commit to branch feat/due_date in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit 3d81b0de72cc55534e95f647265c29fb7d343698 Author: narro wizard <[email protected]> AuthorDate: Mon Mar 3 10:41:47 2025 +0800 feat: add DueDate field to Issue model and migration script #8315 --- backend/core/models/domainlayer/ticket/issue.go | 1 + .../20250303_add_due_date_to_issues.go | 54 ++++++++++++++++++++++ backend/core/models/migrationscripts/register.go | 1 + 3 files changed, 56 insertions(+) diff --git a/backend/core/models/domainlayer/ticket/issue.go b/backend/core/models/domainlayer/ticket/issue.go index f7d5cc562..e546ded25 100644 --- a/backend/core/models/domainlayer/ticket/issue.go +++ b/backend/core/models/domainlayer/ticket/issue.go @@ -54,6 +54,7 @@ type Issue struct { Component string `gorm:"type:text"` OriginalProject string `gorm:"type:varchar(255)"` IsSubtask bool + DueDate *time.Time } func (Issue) TableName() string { diff --git a/backend/core/models/migrationscripts/20250303_add_due_date_to_issues.go b/backend/core/models/migrationscripts/20250303_add_due_date_to_issues.go new file mode 100644 index 000000000..ae6f12e77 --- /dev/null +++ b/backend/core/models/migrationscripts/20250303_add_due_date_to_issues.go @@ -0,0 +1,54 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package migrationscripts + +import ( + "time" + + "github.com/apache/incubator-devlake/core/context" + "github.com/apache/incubator-devlake/core/errors" + "github.com/apache/incubator-devlake/core/plugin" +) + +var _ plugin.MigrationScript = (*addDueDateToIssues)(nil) + +type issue20250303 struct { + DueDate *time.Time +} + +func (issue20250303) TableName() string { + return "issues" +} + +type addDueDateToIssues struct{} + +func (*addDueDateToIssues) Up(basicRes context.BasicRes) errors.Error { + db := basicRes.GetDal() + if err := db.AutoMigrate(&issue20250303{}); err != nil { + return err + } + return nil +} + +func (*addDueDateToIssues) Version() uint64 { + return 20250303142101 +} + +func (*addDueDateToIssues) Name() string { + return "add due_date to issues" +} diff --git a/backend/core/models/migrationscripts/register.go b/backend/core/models/migrationscripts/register.go index 036dbf130..b22feede5 100644 --- a/backend/core/models/migrationscripts/register.go +++ b/backend/core/models/migrationscripts/register.go @@ -137,5 +137,6 @@ func All() []plugin.MigrationScript { new(addCqIssueImpacts), new(changeIssueComponentType), new(increaseCqProjectsIdLength), + new(addDueDateToIssues), } }
