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 database group / schema group name in issue payload and task payload (#6536)
h3n4lb86a0623d4d7
diff --git a/backend/legacyapi/issue.go b/backend/legacyapi/issue.goindex 8fddf71022..6d96f6511d 100644--- a/backend/legacyapi/issue.go+++ b/backend/legacyapi/issue.go@@ -161,6 +161,8 @@ type MigrationDetail struct {SheetID int `json:"sheetId"`// DatabaseGroupName is the name of a database group.DatabaseGroupName string `json:"databaseGroupName"`+ // SchemaGroupName is the name of a schema group.+ SchemaGroupName string `json:"schemaGroupName"`// EarliestAllowedTs the earliest execution time of the change at system local Unix timestamp in seconds.EarliestAllowedTs int64 `json:"earliestAllowedTs"`// SchemaVersion is parsed from VCS file name.diff --git a/backend/legacyapi/task.go b/backend/legacyapi/task.goindex dcb5750ad6..b775163093 100644--- a/backend/legacyapi/task.go+++ b/backend/legacyapi/task.go@@ -128,9 +128,10 @@ type TaskDatabaseSchemaUpdatePayload struct {SkippedReason string `json:"skippedReason,omitempty"`SpecID string `json:"specId,omitempty"`- SheetID int `json:"sheetId,omitempty"`- SchemaVersion string `json:"schemaVersion,omitempty"`- VCSPushEvent *vcs.PushEvent `json:"pushEvent,omitempty"`+ SheetID int `json:"sheetId,omitempty"`+ SchemaVersion string `json:"schemaVersion,omitempty"`+ VCSPushEvent *vcs.PushEvent `json:"pushEvent,omitempty"`+ SchemaGroupName string `json:"schemaGroupName,omitempty"`}// TaskDatabaseSchemaUpdateSDLPayload is the task payload for database schema update (SDL).@@ -220,6 +221,8 @@ type TaskDatabaseDataUpdatePayload struct {RollbackFromIssueID int `json:"rollbackFromIssueId,omitempty"`// RollbackFromTaskID is the task ID from which the rollback SQL statement is generated for this task.RollbackFromTaskID int `json:"rollbackFromTaskId,omitempty"`++ SchemaGroupName string `json:"schemaGroupName,omitempty"`}// TaskDatabaseBackupPayload is the task payload for database backup.diff --git a/backend/server/issue.go b/backend/server/issue.goindex 8004e2da4d..38c9575529 100644--- a/backend/server/issue.go+++ b/backend/server/issue.go@@ -429,12 +429,22 @@ func (s *Server) createIssue(ctx context.Context, issueCreate *api.IssueCreate,if assignee == nil {return nil, echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("assignee %d not found", issueCreate.AssigneeID))}- // TODO(p0ny): remove issueCreate.Payload+issueCreatePayload := &storepb.IssuePayload{Approval: &storepb.IssuePayloadApproval{ApprovalFindingDone: false,},}+ databaseGroup, err := isGroupingChangeIssueCreate(issueCreate)+ if err != nil {+ return nil, err+ }+ if databaseGroup != "" {+ issueCreatePayload.Grouping = &storepb.Grouping{+ DatabaseGroupName: databaseGroup,+ }+ }+if !s.licenseService.IsFeatureEnabled(api.FeatureCustomApproval) {issueCreatePayload.Approval.ApprovalFindingDone = true}@@ -532,6 +542,22 @@ func (s *Server) createIssue(ctx context.Context, issueCreate *api.IssueCreate,return composedIssue, nil}+func isGroupingChangeIssueCreate(issueCreate *api.IssueCreate) (string, error) {+ if issueCreate.Type != api.IssueDatabaseDataUpdate && issueCreate.Type != api.IssueDatabaseSchemaUpdate {+ return "", nil+ }+ c := api.MigrationContext{}+ if err := json.Unmarshal([]byte(issueCreate.CreateContext), &c); err != nil {+ return "", err+ }+ for _, detail := range c.DetailList {+ if detail.DatabaseGroupName != "" {+ return detail.DatabaseGroupName, nil+ }+ }+ return "", nil+}+func (s *Server) createGrantRequestIssue(ctx context.Context, issueCreate *api.IssueCreate, creatorID int) (*api.Issue, error) {project, err := s.store.GetProjectV2(ctx, &store.FindProjectMessage{UID: &issueCreate.ProjectID})if err != nil {@@ -1126,11 +1152,27 @@ func (s *Server) getPipelineCreateForDatabaseSchemaAndDataUpdate(ctx context.ConschemaGroups2MatchedTableNames := make(map[string][]string)// TODO(zp): using strings.Builder to improve performance.table2TaskStatement := make(map[string]string)+ table2SchemaGroupName := make(map[string]string)for _, schemaGroup := range schemaGroups {matches, _, err := getMatchesAndUnmatchedTables(ctx, dbSchema, schemaGroup)if err != nil {return nil, err}+ databaseGroup, err := s.store.GetDatabaseGroup(ctx, &store.FindDatabaseGroupMessage{+ UID: &schemaGroup.DatabaseGroupUID,+ })+ if err != nil {+ return nil, err+ }+ if databaseGroup == nil {+ return nil, echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("cannot find database group with uid %d", schemaGroup.DatabaseGroupUID))+ }+ for _, tableName := range matches {+ table2SchemaGroupName[tableName] = fmt.Sprintf("databaseGroups/%s/schemaGroups/%s", databaseGroup.ResourceID, schemaGroup.ResourceID)+ }+ if err != nil {+ return nil, err+ }// Placeholder is unique in the same database group parent, so we can use it as the key.schemaGroups2MatchedTableNames[schemaGroup.Placeholder] = matches}@@ -1177,7 +1219,7 @@ func (s *Server) getPipelineCreateForDatabaseSchemaAndDataUpdate(ctx context.Conif statement, ok := table2TaskStatement[""]; ok && statement != "" {newMigrationDetail := *migrationDetailnewMigrationDetail.Statement = statement- taskCreate, err := getUpdateTask(database, instance, c.VCSPushEvent, &newMigrationDetail, getOrDefaultSchemaVersionWithSuffix(&newMigrationDetail, fmt.Sprintf("-%03d", idx)))+ taskCreate, err := getUpdateTask(database, instance, c.VCSPushEvent, &newMigrationDetail, getOrDefaultSchemaVersionWithSuffix(&newMigrationDetail, fmt.Sprintf("-%03d", idx)), "")if err != nil {return nil, err}@@ -1186,13 +1228,13 @@ func (s *Server) getPipelineCreateForDatabaseSchemaAndDataUpdate(ctx context.Conidx++}- for _, statement := range table2TaskStatement {- if statement == "" {+ for tableName, statement := range table2TaskStatement {+ if statement == "" || tableName == "" {continue}newMigrationDetail := *migrationDetailnewMigrationDetail.Statement = statement- taskCreate, err := getUpdateTask(database, instance, c.VCSPushEvent, &newMigrationDetail, getOrDefaultSchemaVersionWithSuffix(&newMigrationDetail, fmt.Sprintf("-%03d", idx)))+ taskCreate, err := getUpdateTask(database, instance, c.VCSPushEvent, &newMigrationDetail, getOrDefaultSchemaVersionWithSuffix(&newMigrationDetail, fmt.Sprintf("-%03d", idx)), table2SchemaGroupName[tableName])if err != nil {return nil, err}@@ -1222,7 +1264,7 @@ func (s *Server) getPipelineCreateForDatabaseSchemaAndDataUpdate(ctx context.Con}newMigrationDetail := *migrationDetailnewMigrationDetail.SheetID = sheet.UID- taskCreate, err := getUpdateTask(database, instance, c.VCSPushEvent, &newMigrationDetail, getOrDefaultSchemaVersionWithSuffix(&newMigrationDetail, fmt.Sprintf("-%03d", migrationDetailIdx)))+ taskCreate, err := getUpdateTask(database, instance, c.VCSPushEvent, &newMigrationDetail, getOrDefaultSchemaVersionWithSuffix(&newMigrationDetail, fmt.Sprintf("-%03d", migrationDetailIdx)), migrationDetail.SchemaGroupName)if err != nil {return nil, err}@@ -1234,7 +1276,7 @@ func (s *Server) getPipelineCreateForDatabaseSchemaAndDataUpdate(ctx context.ContaskIndexDAGList = append(taskIndexDAGList, api.TaskIndexDAG{FromIndex: len(taskCreateList) + i, ToIndex: len(taskCreateList) + i + 1})}for _, migrationDetail := range migrationDetailList {- taskCreate, err := getUpdateTask(database, instance, c.VCSPushEvent, migrationDetail, getOrDefaultSchemaVersion(migrationDetail))+ taskCreate, err := getUpdateTask(database, instance, c.VCSPushEvent, migrationDetail, getOrDefaultSchemaVersion(migrationDetail), "")if err != nil {return nil, err}@@ -1293,7 +1335,7 @@ func getOrDefaultSchemaVersionWithSuffix(detail *api.MigrationDetail, suffix strreturn common.DefaultMigrationVersion() + suffix}-func getUpdateTask(database *store.DatabaseMessage, instance *store.InstanceMessage, vcsPushEvent *vcs.PushEvent, d *api.MigrationDetail, schemaVersion string) (api.TaskCreate, error) {+func getUpdateTask(database *store.DatabaseMessage, instance *store.InstanceMessage, vcsPushEvent *vcs.PushEvent, d *api.MigrationDetail, schemaVersion string, schemaGroupName string) (api.TaskCreate, error) {var taskName stringvar taskType api.TaskType@@ -1314,9 +1356,10 @@ func getUpdateTask(database *store.DatabaseMessage, instance *store.InstanceMesstaskName = fmt.Sprintf("DDL(schema) for database %q", database.DatabaseName)taskType = api.TaskDatabaseSchemaUpdatepayload := api.TaskDatabaseSchemaUpdatePayload{- SheetID: d.SheetID,- SchemaVersion: schemaVersion,- VCSPushEvent: vcsPushEvent,+ SheetID: d.SheetID,+ SchemaVersion: schemaVersion,+ VCSPushEvent: vcsPushEvent,+ SchemaGroupName: schemaGroupName,}bytes, err := json.Marshal(payload)if err != nil {@@ -1345,6 +1388,7 @@ func getUpdateTask(database *store.DatabaseMessage, instance *store.InstanceMessVCSPushEvent: vcsPushEvent,RollbackEnabled: d.RollbackEnabled,RollbackSQLStatus: api.RollbackSQLStatusPending,+ SchemaGroupName: schemaGroupName,}if d.RollbackDetail != nil {payload.RollbackFromIssueID = d.RollbackDetail.IssueIDdiff --git a/backend/store/database_group.go b/backend/store/database_group.goindex 97567cf8f3..e1f48c86cb 100644--- a/backend/store/database_group.go+++ b/backend/store/database_group.go@@ -33,6 +33,7 @@ type DatabaseGroupMessage struct {type FindDatabaseGroupMessage struct {ProjectUID *intResourceID *string+ UID *int64}// UpdateDatabaseGroupMessage is the message for updating database group.@@ -47,16 +48,18 @@ func (s *Store) DeleteDatabaseGroup(ctx context.Context, databaseGroupUID int64)DELETEFROM db_groupWHERE id = $1- RETURNING project_id, resource_id;+ RETURNING id, project_id, resource_id;`tx, err := s.db.BeginTx(ctx, nil)if err != nil {return errors.Wrapf(err, "failed to begin transaction")}defer tx.Rollback()+ var id int64var projectUID intvar resourceID stringif err := tx.QueryRowContext(ctx, query, databaseGroupUID).Scan(+ &id,&projectUID,&resourceID,); err != nil {@@ -66,6 +69,7 @@ func (s *Store) DeleteDatabaseGroup(ctx context.Context, databaseGroupUID int64)return errors.Wrapf(err, "failed to commit transaction")}s.databaseGroupCache.Delete(getDatabaseGroupCacheKey(projectUID, resourceID))+ s.databaseGroupIDCache.Delete(projectUID)return nil}@@ -87,6 +91,7 @@ func (s *Store) ListDatabaseGroups(ctx context.Context, find *FindDatabaseGroupM}for _, databaseGroup := range databaseGroups {s.databaseGroupCache.Store(getDatabaseGroupCacheKey(databaseGroup.ProjectUID, databaseGroup.ResourceID), databaseGroup)+ s.databaseGroupCache.Store(databaseGroup.UID, databaseGroup)}return databaseGroups, nil@@ -94,11 +99,17 @@ func (s *Store) ListDatabaseGroups(ctx context.Context, find *FindDatabaseGroupM// GetDatabaseGroup gets a database group.func (s *Store) GetDatabaseGroup(ctx context.Context, find *FindDatabaseGroupMessage) (*DatabaseGroupMessage, error) {- if find.ProjectUID != nil && find.ResourceID != nil {+ if find.ProjectUID != nil && find.ResourceID != nil && find.UID == nil {if databaseGroup, ok := s.databaseGroupCache.Load(getDatabaseGroupCacheKey(*find.ProjectUID, *find.ResourceID)); ok {return databaseGroup.(*DatabaseGroupMessage), nil}}+ if find.UID != nil && find.ProjectUID == nil && find.ResourceID == nil {+ if databaseGroup, ok := s.databaseGroupIDCache.Load(*find.UID); ok {+ return databaseGroup.(*DatabaseGroupMessage), nil+ }+ }+tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, err@@ -121,6 +132,7 @@ func (s *Store) GetDatabaseGroup(ctx context.Context, find *FindDatabaseGroupMesreturn nil, errors.Errorf("found multiple database groups")}s.databaseGroupCache.Store(getDatabaseGroupCacheKey(databaseGroups[0].ProjectUID, databaseGroups[0].ResourceID), databaseGroups[0])+ s.databaseGroupIDCache.Store(databaseGroups[0].UID, databaseGroups[0])return databaseGroups[0], nil}@@ -132,6 +144,9 @@ func (*Store) listDatabaseGroupImpl(ctx context.Context, tx *Tx, find *FindDatabif v := find.ResourceID; v != nil {where, args = append(where, fmt.Sprintf("resource_id = $%d", len(args)+1)), append(args, *v)}+ if v := find.UID; v != nil {+ where, args = append(where, fmt.Sprintf("id = $%d", len(args)+1)), append(args, *v)+ }query := fmt.Sprintf(`SELECTid,@@ -234,6 +249,7 @@ func (s *Store) UpdateDatabaseGroup(ctx context.Context, updaterPrincipalID int,}updatedDatabaseGroup.Expression = &expressions.databaseGroupCache.Store(getDatabaseGroupCacheKey(updatedDatabaseGroup.ProjectUID, updatedDatabaseGroup.ResourceID), &updatedDatabaseGroup)+ s.databaseGroupIDCache.Store(updatedDatabaseGroup.UID, &updatedDatabaseGroup)return &updatedDatabaseGroup, nil}@@ -294,6 +310,7 @@ func (s *Store) CreateDatabaseGroup(ctx context.Context, creatorPrincipalID int,}insertedDatabaseGroup.Expression = &expressions.databaseGroupCache.Store(getDatabaseGroupCacheKey(insertedDatabaseGroup.ProjectUID, insertedDatabaseGroup.ResourceID), &insertedDatabaseGroup)+ s.databaseGroupCache.Store(insertedDatabaseGroup.UID, &insertedDatabaseGroup)return &insertedDatabaseGroup, nil}diff --git a/backend/store/store.go b/backend/store/store.goindex 604cf575e1..e5c58ed2c5 100644--- a/backend/store/store.go+++ b/backend/store/store.go@@ -36,6 +36,7 @@ type Store struct {projectIDDeploymentConfigCache sync.Map // map[int]*DeploymentConfigMessagerisksCache sync.Map // []*RiskMessage, use 0 as the keydatabaseGroupCache sync.Map // map[string]*DatabaseGroupMessage+ databaseGroupIDCache sync.Map // map[int]*DatabaseGroupMessageschemaGroupCache sync.Map // map[string]*SchemaGroupMessage// sheetStatementCache caches the statement of a sheet.sheetStatementCache cache.Cache[int, string]diff --git a/frontend/src/types/proto/store/issue.ts b/frontend/src/types/proto/store/issue.tsindex 1d38d0a216..b31357aa59 100644--- a/frontend/src/types/proto/store/issue.ts+++ b/frontend/src/types/proto/store/issue.ts@@ -8,6 +8,12 @@ export const protobufPackage = "bytebase.store";export interface IssuePayload {approval?: IssuePayloadApproval;grantRequest?: GrantRequest;+ grouping?: Grouping;+}++export interface Grouping {+ /** The group name, format projects/{project}/database_groups/{database_group} */+ databaseGroupName: string;}export interface GrantRequest {@@ -19,7 +25,7 @@ export interface GrantRequest {}function createBaseIssuePayload(): IssuePayload {- return { approval: undefined, grantRequest: undefined };+ return { approval: undefined, grantRequest: undefined, grouping: undefined };}export const IssuePayload = {@@ -30,6 +36,9 @@ export const IssuePayload = {if (message.grantRequest !== undefined) {GrantRequest.encode(message.grantRequest, writer.uint32(18).fork()).ldelim();}+ if (message.grouping !== undefined) {+ Grouping.encode(message.grouping, writer.uint32(26).fork()).ldelim();+ }return writer;},@@ -54,6 +63,13 @@ export const IssuePayload = {message.grantRequest = GrantRequest.decode(reader, reader.uint32());continue;+ case 3:+ if (tag !== 26) {+ break;+ }++ message.grouping = Grouping.decode(reader, reader.uint32());+ continue;}if ((tag & 7) === 4 || tag === 0) {break;@@ -67,6 +83,7 @@ export const IssuePayload = {return {approval: isSet(object.approval) ? IssuePayloadApproval.fromJSON(object.approval) : undefined,grantRequest: isSet(object.grantRequest) ? GrantRequest.fromJSON(object.grantRequest) : undefined,+ grouping: isSet(object.grouping) ? Grouping.fromJSON(object.grouping) : undefined,};},@@ -76,6 +93,7 @@ export const IssuePayload = {(obj.approval = message.approval ? IssuePayloadApproval.toJSON(message.approval) : undefined);message.grantRequest !== undefined &&(obj.grantRequest = message.grantRequest ? GrantRequest.toJSON(message.grantRequest) : undefined);+ message.grouping !== undefined && (obj.grouping = message.grouping ? Grouping.toJSON(message.grouping) : undefined);return obj;},@@ -91,6 +109,65 @@ export const IssuePayload = {message.grantRequest = (object.grantRequest !== undefined && object.grantRequest !== null)? GrantRequest.fromPartial(object.grantRequest): undefined;+ message.grouping = (object.grouping !== undefined && object.grouping !== null)+ ? Grouping.fromPartial(object.grouping)+ : undefined;+ return message;+ },+};++function createBaseGrouping(): Grouping {+ return { databaseGroupName: "" };+}++export const Grouping = {+ encode(message: Grouping, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.databaseGroupName !== "") {+ writer.uint32(10).string(message.databaseGroupName);+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): Grouping {+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseGrouping();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ if (tag !== 10) {+ break;+ }++ message.databaseGroupName = reader.string();+ continue;+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skipType(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): Grouping {+ return { databaseGroupName: isSet(object.databaseGroupName) ? String(object.databaseGroupName) : "" };+ },++ toJSON(message: Grouping): unknown {+ const obj: any = {};+ message.databaseGroupName !== undefined && (obj.databaseGroupName = message.databaseGroupName);+ return obj;+ },++ create(base?: DeepPartial<Grouping>): Grouping {+ return Grouping.fromPartial(base ?? {});+ },++ fromPartial(object: DeepPartial<Grouping>): Grouping {+ const message = createBaseGrouping();+ message.databaseGroupName = object.databaseGroupName ?? "";return message;},};diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.mdindex 9f0b7d1268..8b32b26607 100644--- a/proto/gen/grpc-doc/store/README.md+++ b/proto/gen/grpc-doc/store/README.md@@ -70,6 +70,7 @@- [store/issue.proto](#store_issue-proto)- [GrantRequest](#bytebase-store-GrantRequest)+ - [Grouping](#bytebase-store-Grouping)- [IssuePayload](#bytebase-store-IssuePayload)- [store/plan.proto](#store_plan-proto)@@ -1062,6 +1063,21 @@ OIDCIdentityProviderConfig is the structure for OIDC identity provider config.+<a name="bytebase-store-Grouping"></a>++### Grouping++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| database_group_name | [string](#string) | | The group name, format projects/{project}/database_groups/{database_group} |++++++<a name="bytebase-store-IssuePayload"></a>### IssuePayload@@ -1072,6 +1088,7 @@ OIDCIdentityProviderConfig is the structure for OIDC identity provider config.| ----- | ---- | ----- | ----------- || approval | [IssuePayloadApproval](#bytebase-store-IssuePayloadApproval) | | || grant_request | [GrantRequest](#bytebase-store-GrantRequest) | | |+| grouping | [Grouping](#bytebase-store-Grouping) | | |diff --git a/proto/generated-go/store/issue.pb.go b/proto/generated-go/store/issue.pb.goindex d865f6f4a8..2a619eee8f 100644--- a/proto/generated-go/store/issue.pb.go+++ b/proto/generated-go/store/issue.pb.go@@ -28,6 +28,7 @@ type IssuePayload struct {Approval *IssuePayloadApproval `protobuf:"bytes,1,opt,name=approval,proto3" json:"approval,omitempty"`GrantRequest *GrantRequest `protobuf:"bytes,2,opt,name=grant_request,json=grantRequest,proto3" json:"grant_request,omitempty"`+ Grouping *Grouping `protobuf:"bytes,3,opt,name=grouping,proto3" json:"grouping,omitempty"`}func (x *IssuePayload) Reset() {@@ -76,6 +77,61 @@ func (x *IssuePayload) GetGrantRequest() *GrantRequest {return nil}+func (x *IssuePayload) GetGrouping() *Grouping {+ if x != nil {+ return x.Grouping+ }+ return nil+}++type Grouping struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // The group name, format projects/{project}/database_groups/{database_group}+ DatabaseGroupName string `protobuf:"bytes,1,opt,name=database_group_name,json=databaseGroupName,proto3" json:"database_group_name,omitempty"`+}++func (x *Grouping) Reset() {+ *x = Grouping{}+ if protoimpl.UnsafeEnabled {+ mi := &file_store_issue_proto_msgTypes[1]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *Grouping) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*Grouping) ProtoMessage() {}++func (x *Grouping) ProtoReflect() protoreflect.Message {+ mi := &file_store_issue_proto_msgTypes[1]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use Grouping.ProtoReflect.Descriptor instead.+func (*Grouping) Descriptor() ([]byte, []int) {+ return file_store_issue_proto_rawDescGZIP(), []int{1}+}++func (x *Grouping) GetDatabaseGroupName() string {+ if x != nil {+ return x.DatabaseGroupName+ }+ return ""+}+type GrantRequest struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCache@@ -91,7 +147,7 @@ type GrantRequest struct {func (x *GrantRequest) Reset() {*x = GrantRequest{}if protoimpl.UnsafeEnabled {- mi := &file_store_issue_proto_msgTypes[1]+ mi := &file_store_issue_proto_msgTypes[2]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -104,7 +160,7 @@ func (x *GrantRequest) String() string {func (*GrantRequest) ProtoMessage() {}func (x *GrantRequest) ProtoReflect() protoreflect.Message {- mi := &file_store_issue_proto_msgTypes[1]+ mi := &file_store_issue_proto_msgTypes[2]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -117,7 +173,7 @@ func (x *GrantRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use GrantRequest.ProtoReflect.Descriptor instead.func (*GrantRequest) Descriptor() ([]byte, []int) {- return file_store_issue_proto_rawDescGZIP(), []int{1}+ return file_store_issue_proto_rawDescGZIP(), []int{2}}func (x *GrantRequest) GetRole() string {@@ -149,7 +205,7 @@ var file_store_issue_proto_rawDesc = []byte{0x6f, 0x72, 0x65, 0x1a, 0x16, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x74, 0x79, 0x70, 0x65,0x2f, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x73, 0x74, 0x6f,0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74,- 0x6f, 0x22, 0x93, 0x01, 0x0a, 0x0c, 0x49, 0x73, 0x73, 0x75, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f,+ 0x6f, 0x22, 0xc9, 0x01, 0x0a, 0x0c, 0x49, 0x73, 0x73, 0x75, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f,0x61, 0x64, 0x12, 0x40, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x18, 0x01,0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x73, 0x73, 0x75, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f,@@ -158,15 +214,22 @@ var file_store_issue_proto_rawDesc = []byte{0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x79,0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x72, 0x61,0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0c, 0x67, 0x72, 0x61, 0x6e, 0x74,- 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x67, 0x0a, 0x0c, 0x47, 0x72, 0x61, 0x6e, 0x74,- 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18,- 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x75,- 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12,- 0x2f, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01,- 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65,- 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e,- 0x42, 0x14, 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f,- 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70,+ 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x62, 0x79, 0x74, 0x65,+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70,+ 0x69, 0x6e, 0x67, 0x52, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x6e, 0x67, 0x22, 0x3a, 0x0a,+ 0x08, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x2e, 0x0a, 0x13, 0x64, 0x61, 0x74,+ 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65,+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65,+ 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x67, 0x0a, 0x0c, 0x47, 0x72, 0x61,+ 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c,+ 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a,+ 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x73, 0x65,+ 0x72, 0x12, 0x2f, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03,+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x74, 0x79,+ 0x70, 0x65, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69,+ 0x6f, 0x6e, 0x42, 0x14, 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d,+ 0x67, 0x6f, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,}var (@@ -181,22 +244,24 @@ func file_store_issue_proto_rawDescGZIP() []byte {return file_store_issue_proto_rawDescData}-var file_store_issue_proto_msgTypes = make([]protoimpl.MessageInfo, 2)+var file_store_issue_proto_msgTypes = make([]protoimpl.MessageInfo, 3)var file_store_issue_proto_goTypes = []interface{}{(*IssuePayload)(nil), // 0: bytebase.store.IssuePayload- (*GrantRequest)(nil), // 1: bytebase.store.GrantRequest- (*IssuePayloadApproval)(nil), // 2: bytebase.store.IssuePayloadApproval- (*expr.Expr)(nil), // 3: google.type.Expr+ (*Grouping)(nil), // 1: bytebase.store.Grouping+ (*GrantRequest)(nil), // 2: bytebase.store.GrantRequest+ (*IssuePayloadApproval)(nil), // 3: bytebase.store.IssuePayloadApproval+ (*expr.Expr)(nil), // 4: google.type.Expr}var file_store_issue_proto_depIdxs = []int32{- 2, // 0: bytebase.store.IssuePayload.approval:type_name -> bytebase.store.IssuePayloadApproval- 1, // 1: bytebase.store.IssuePayload.grant_request:type_name -> bytebase.store.GrantRequest- 3, // 2: bytebase.store.GrantRequest.condition:type_name -> google.type.Expr- 3, // [3:3] is the sub-list for method output_type- 3, // [3:3] is the sub-list for method input_type- 3, // [3:3] is the sub-list for extension type_name- 3, // [3:3] is the sub-list for extension extendee- 0, // [0:3] is the sub-list for field type_name+ 3, // 0: bytebase.store.IssuePayload.approval:type_name -> bytebase.store.IssuePayloadApproval+ 2, // 1: bytebase.store.IssuePayload.grant_request:type_name -> bytebase.store.GrantRequest+ 1, // 2: bytebase.store.IssuePayload.grouping:type_name -> bytebase.store.Grouping+ 4, // 3: bytebase.store.GrantRequest.condition:type_name -> google.type.Expr+ 4, // [4:4] is the sub-list for method output_type+ 4, // [4:4] is the sub-list for method input_type+ 4, // [4:4] is the sub-list for extension type_name+ 4, // [4:4] is the sub-list for extension extendee+ 0, // [0:4] is the sub-list for field type_name}func init() { file_store_issue_proto_init() }@@ -219,6 +284,18 @@ func file_store_issue_proto_init() {}}file_store_issue_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*Grouping); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_store_issue_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*GrantRequest); i {case 0:return &v.state@@ -237,7 +314,7 @@ func file_store_issue_proto_init() {GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: file_store_issue_proto_rawDesc,NumEnums: 0,- NumMessages: 2,+ NumMessages: 3,NumExtensions: 0,NumServices: 0,},diff --git a/proto/store/issue.proto b/proto/store/issue.protoindex c0cab16b33..fc0f6bd7c0 100644--- a/proto/store/issue.proto+++ b/proto/store/issue.proto@@ -10,6 +10,12 @@ option go_package = "generated-go/store";message IssuePayload {IssuePayloadApproval approval = 1;GrantRequest grant_request = 2;+ Grouping grouping = 3;+}++message Grouping {+ // The group name, format projects/{project}/database_groups/{database_group}+ string database_group_name = 1;}message GrantRequest {