Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Add projectId to the TaskDatabaseCreatePayload

天舟0d165bc02c22
diff --git a/api/task.go b/api/task.go
index fdb7a92df0..42da953314 100644
--- a/api/task.go
+++ b/api/task.go
@@ -54,6 +54,8 @@ const (
// So we annotate with json tag using camelCase naming which is consistent with normal
// json naming convention
type TaskDatabaseCreatePayload struct {
+ // The project owning the database.
+ ProjectId int `json:"projectId,omitempty"`
Statement string `json:"statement,omitempty"`
DatabaseName string `json:"databaseName,omitempty"`
CharacterSet string `json:"character,omitempty"`
diff --git a/server/issue.go b/server/issue.go
index 32956c17c7..ef03350dc6 100644
--- a/server/issue.go
+++ b/server/issue.go
@@ -369,6 +369,7 @@ func (s *Server) CreateIssue(ctx context.Context, issueCreate *api.IssueCreate,
taskCreate.StageId = createdStage.ID
if taskCreate.Type == api.TaskDatabaseCreate {
payload := api.TaskDatabaseCreatePayload{}
+ payload.ProjectId = issueCreate.ProjectId
payload.Statement = taskCreate.Statement
payload.DatabaseName = taskCreate.DatabaseName
payload.CharacterSet = taskCreate.CharacterSet
diff --git a/server/task.go b/server/task.go
index 800d21d669..6cbcebbe8b 100644
--- a/server/task.go
+++ b/server/task.go
@@ -268,7 +268,7 @@ func (s *Server) ChangeTaskStatusWithPatch(ctx context.Context, task *api.Task,
z, offset := time.Now().Zone()
databaseCreate := &api.DatabaseCreate{
CreatorId: taskStatusPatch.UpdaterId,
- ProjectId: issue.ProjectId,
+ ProjectId: payload.ProjectId,
InstanceId: task.InstanceId,
Name: payload.DatabaseName,
CharacterSet: payload.CharacterSet,