Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: add immutability for CREATE_DATABASE plans and make title optional for export issues (#18724)
Danny Xu4703df75feb6
diff --git a/backend/api/v1/issue_service.go b/backend/api/v1/issue_service.goindex a1eab82b0e..481d6a1a65 100644--- a/backend/api/v1/issue_service.go+++ b/backend/api/v1/issue_service.go@@ -445,16 +445,17 @@ func (s *IssueService) CreateIssue(ctx context.Context, req *connect.Request[v1p}func (s *IssueService) buildIssueMessage(ctx context.Context, project *store.ProjectMessage, userEmail string, request *v1pb.CreateIssueRequest) (*store.IssueMessage, error) {- if request.Issue.Title == "" {- return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("issue title is required"))- }-var planUID *int64var grantRequest *storepb.GrantRequest// Type-specific validation and preparationswitch request.Issue.Type {case v1pb.Issue_GRANT_REQUEST:+ // Title is required for grant requests+ if request.Issue.Title == "" {+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("issue title is required"))+ }+// Check if grant request feature is enabledif err := s.licenseService.IsFeatureEnabled(v1pb.PlanFeature_FEATURE_REQUEST_ROLE_WORKFLOW); err != nil {return nil, connect.NewError(connect.CodePermissionDenied,diff --git a/backend/api/v1/plan_service.go b/backend/api/v1/plan_service.goindex 9977bbb78b..5915bbd285 100644--- a/backend/api/v1/plan_service.go+++ b/backend/api/v1/plan_service.go@@ -12,6 +12,7 @@ import ("github.com/bytebase/bytebase/backend/common""github.com/bytebase/bytebase/backend/common/log"+ "github.com/bytebase/bytebase/backend/runner/approval""github.com/bytebase/bytebase/backend/component/bus""github.com/bytebase/bytebase/backend/component/iam"@@ -20,7 +21,6 @@ import (storepb "github.com/bytebase/bytebase/backend/generated-go/store"v1pb "github.com/bytebase/bytebase/backend/generated-go/v1""github.com/bytebase/bytebase/backend/generated-go/v1/v1connect"- "github.com/bytebase/bytebase/backend/runner/approval""github.com/bytebase/bytebase/backend/store")@@ -259,6 +259,11 @@ func (s *PlanService) UpdatePlan(ctx context.Context, request *connect.Request[vreturn nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("disallowed to update the plan specs because the plan is created from a release"))}+ // Disallow updating CREATE_DATABASE plan specs+ if storePlanConfigHasCreateDatabase(oldPlan.Config) && slices.Contains(req.UpdateMask.Paths, "specs") {+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("disallowed to update the plan specs for CREATE_DATABASE plans"))+ }+ok, err = func() (bool, error) {if oldPlan.Creator == user.Email {return true, nil@@ -709,6 +714,15 @@ func storePlanConfigHasRelease(plan *storepb.PlanConfig) bool {return false}+func storePlanConfigHasCreateDatabase(plan *storepb.PlanConfig) bool {+ for _, spec := range plan.GetSpecs() {+ if _, ok := spec.Config.(*storepb.PlanConfig_Spec_CreateDatabaseConfig); ok {+ return true+ }+ }+ return false+}+// Converters section - ordered with callers before callees.// getPlanCheckRunFromPlan returns the plan check run for a plan.