Skip to content

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

refactor: make sheets immutable by removing UpdateSheet API (#18484)

Danny Xue40cda5ede28
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index 7a9aefda6f..2ec1bc5423 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -5559,44 +5559,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/bytebase.v1.Sheet'
- /bytebase.v1.SheetService/UpdateSheet:
- post:
- tags:
- - bytebase.v1.SheetService
- summary: 'Updates a SQL sheet''s title or content. Permissions required: bb.sheets.update'
- description: |-
- Updates a SQL sheet's title or content.
- Permissions required: bb.sheets.update
- operationId: bytebase.v1.SheetService.UpdateSheet
- parameters:
- - name: Connect-Protocol-Version
- in: header
- required: true
- schema:
- $ref: '#/components/schemas/connect-protocol-version'
- - name: Connect-Timeout-Ms
- in: header
- schema:
- $ref: '#/components/schemas/connect-timeout-header'
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.UpdateSheetRequest'
- required: true
- responses:
- default:
- description: Error
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/connect.error'
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.Sheet'
/bytebase.v1.SubscriptionService/GetSubscription:
post:
tags:
@@ -17670,35 +17632,6 @@ components:
title: UpdateSettingRequest
additionalProperties: false
description: The request message for updating or creating a setting.
- bytebase.v1.UpdateSheetRequest:
- type: object
- properties:
- sheet:
- title: sheet
- description: |-
- The sheet to update.
-
- The sheet's `name` field is used to identify the sheet to update.
- Format: projects/{project}/sheets/{sheet}
- $ref: '#/components/schemas/bytebase.v1.Sheet'
- updateMask:
- title: update_mask
- description: |-
- The list of fields to be updated.
- Fields are specified relative to the sheet.
- (e.g., `title`, `statement`; *not* `sheet.title` or `sheet.statement`)
- Only support update the following fields for now:
- - `title`
- - `statement`
- $ref: '#/components/schemas/google.protobuf.FieldMask'
- allowMissing:
- type: boolean
- title: allow_missing
- description: |-
- If set to true, and the sheet is not found, a new sheet will be created.
- In this situation, `update_mask` is ignored.
- title: UpdateSheetRequest
- additionalProperties: false
bytebase.v1.UpdateSubscriptionRequest:
type: object
properties:
diff --git a/backend/api/v1/sheet_service.go b/backend/api/v1/sheet_service.go
index 735fcff230..d75ed6322d 100644
--- a/backend/api/v1/sheet_service.go
+++ b/backend/api/v1/sheet_service.go
@@ -171,94 +171,6 @@ func (s *SheetService) GetSheet(ctx context.Context, request *connect.Request[v1
return connect.NewResponse(v1pbSheet), nil
}
-// UpdateSheet updates a sheet.
-func (s *SheetService) UpdateSheet(ctx context.Context, request *connect.Request[v1pb.UpdateSheetRequest]) (*connect.Response[v1pb.Sheet], error) {
- if request.Msg.Sheet == nil {
- return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("sheet cannot be empty"))
- }
- if request.Msg.UpdateMask == nil {
- return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("update mask cannot be empty"))
- }
- if request.Msg.Sheet.Name == "" {
- return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("sheet name cannot be empty"))
- }
-
- projectResourceID, sheetUID, err := common.GetProjectResourceIDSheetUID(request.Msg.Sheet.Name)
- if err != nil {
- return nil, connect.NewError(connect.CodeInvalidArgument, err)
- }
- if sheetUID <= 0 {
- return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid sheet id %d, must be positive integer", sheetUID))
- }
-
- project, err := s.store.GetProject(ctx, &store.FindProjectMessage{
- ResourceID: &projectResourceID,
- })
- if err != nil {
- return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("project with resource id %s not found", projectResourceID))
- }
- if project == nil {
- return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("project with resource id %s not found", projectResourceID))
- }
- if project.Deleted {
- return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("project with resource id %q had deleted", projectResourceID))
- }
-
- user, ok := GetUserFromContext(ctx)
- if !ok {
- return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))
- }
-
- sheet, err := s.store.GetSheet(ctx, &store.FindSheetMessage{
- UID: &sheetUID,
- ProjectID: &project.ResourceID,
- })
- if err != nil {
- return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get sheet"))
- }
- if sheet == nil {
- if request.Msg.AllowMissing {
- ok, err := s.iamManager.CheckPermission(ctx, iam.PermissionSheetsCreate, user, project.ResourceID)
- if err != nil {
- return nil, connect.NewError(connect.CodeInternal, errors.Wrap(err, "failed to check permission"))
- }
- if !ok {
- return nil, connect.NewError(connect.CodePermissionDenied, errors.Errorf("user does not have permission %q", iam.PermissionSheetsCreate))
- }
- return s.CreateSheet(ctx, connect.NewRequest(&v1pb.CreateSheetRequest{
- Parent: common.FormatProject(project.ResourceID),
- Sheet: request.Msg.Sheet,
- }))
- }
- return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("sheet %q not found", request.Msg.Sheet.Name))
- }
-
- sheetPatch := &store.PatchSheetMessage{
- UID: sheet.UID,
- Updater: user.Email,
- }
-
- for _, path := range request.Msg.UpdateMask.Paths {
- switch path {
- case "content":
- statement := string(request.Msg.Sheet.Content)
- sheetPatch.Statement = &statement
- default:
- return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid update mask path %q", path))
- }
- }
- storeSheet, err := s.store.PatchSheet(ctx, sheetPatch)
- if err != nil {
- return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to update sheet"))
- }
- v1pbSheet, err := s.convertToAPISheetMessage(ctx, storeSheet)
- if err != nil {
- return nil, err
- }
-
- return connect.NewResponse(v1pbSheet), nil
-}
-
func (s *SheetService) findSheet(ctx context.Context, find *store.FindSheetMessage) (*store.SheetMessage, error) {
sheet, err := s.store.GetSheet(ctx, find)
if err != nil {
diff --git a/backend/generated-go/v1/sheet_service.pb.go b/backend/generated-go/v1/sheet_service.pb.go
index df9102a1a4..43e19f6381 100644
--- a/backend/generated-go/v1/sheet_service.pb.go
+++ b/backend/generated-go/v1/sheet_service.pb.go
@@ -11,7 +11,6 @@ import (
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
@@ -233,78 +232,6 @@ func (x *GetSheetRequest) GetRaw() bool {
return false
}
-type UpdateSheetRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The sheet to update.
- //
- // The sheet's `name` field is used to identify the sheet to update.
- // Format: projects/{project}/sheets/{sheet}
- Sheet *Sheet `protobuf:"bytes,1,opt,name=sheet,proto3" json:"sheet,omitempty"`
- // The list of fields to be updated.
- // Fields are specified relative to the sheet.
- // (e.g., `title`, `statement`; *not* `sheet.title` or `sheet.statement`)
- // Only support update the following fields for now:
- // - `title`
- // - `statement`
- UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
- // If set to true, and the sheet is not found, a new sheet will be created.
- // In this situation, `update_mask` is ignored.
- AllowMissing bool `protobuf:"varint,3,opt,name=allow_missing,json=allowMissing,proto3" json:"allow_missing,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *UpdateSheetRequest) Reset() {
- *x = UpdateSheetRequest{}
- mi := &file_v1_sheet_service_proto_msgTypes[4]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *UpdateSheetRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*UpdateSheetRequest) ProtoMessage() {}
-
-func (x *UpdateSheetRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sheet_service_proto_msgTypes[4]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use UpdateSheetRequest.ProtoReflect.Descriptor instead.
-func (*UpdateSheetRequest) Descriptor() ([]byte, []int) {
- return file_v1_sheet_service_proto_rawDescGZIP(), []int{4}
-}
-
-func (x *UpdateSheetRequest) GetSheet() *Sheet {
- if x != nil {
- return x.Sheet
- }
- return nil
-}
-
-func (x *UpdateSheetRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
- if x != nil {
- return x.UpdateMask
- }
- return nil
-}
-
-func (x *UpdateSheetRequest) GetAllowMissing() bool {
- if x != nil {
- return x.AllowMissing
- }
- return false
-}
-
type Sheet struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The name of the sheet resource.
@@ -334,7 +261,7 @@ type Sheet struct {
func (x *Sheet) Reset() {
*x = Sheet{}
- mi := &file_v1_sheet_service_proto_msgTypes[5]
+ mi := &file_v1_sheet_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -346,7 +273,7 @@ func (x *Sheet) String() string {
func (*Sheet) ProtoMessage() {}
func (x *Sheet) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sheet_service_proto_msgTypes[5]
+ mi := &file_v1_sheet_service_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -359,7 +286,7 @@ func (x *Sheet) ProtoReflect() protoreflect.Message {
// Deprecated: Use Sheet.ProtoReflect.Descriptor instead.
func (*Sheet) Descriptor() ([]byte, []int) {
- return file_v1_sheet_service_proto_rawDescGZIP(), []int{5}
+ return file_v1_sheet_service_proto_rawDescGZIP(), []int{4}
}
func (x *Sheet) GetName() string {
@@ -428,7 +355,7 @@ type SheetPayload struct {
func (x *SheetPayload) Reset() {
*x = SheetPayload{}
- mi := &file_v1_sheet_service_proto_msgTypes[6]
+ mi := &file_v1_sheet_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -440,7 +367,7 @@ func (x *SheetPayload) String() string {
func (*SheetPayload) ProtoMessage() {}
func (x *SheetPayload) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sheet_service_proto_msgTypes[6]
+ mi := &file_v1_sheet_service_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -453,7 +380,7 @@ func (x *SheetPayload) ProtoReflect() protoreflect.Message {
// Deprecated: Use SheetPayload.ProtoReflect.Descriptor instead.
func (*SheetPayload) Descriptor() ([]byte, []int) {
- return file_v1_sheet_service_proto_rawDescGZIP(), []int{6}
+ return file_v1_sheet_service_proto_rawDescGZIP(), []int{5}
}
func (x *SheetPayload) GetCommands() []*Range {
@@ -467,7 +394,7 @@ var File_v1_sheet_service_proto protoreflect.FileDescriptor
const file_v1_sheet_service_proto_rawDesc = "" +
"\n" +
- "\x16v1/sheet_service.proto\x12\vbytebase.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\x1a\x0fv1/common.proto\"y\n" +
+ "\x16v1/sheet_service.proto\x12\vbytebase.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\x1a\x0fv1/common.proto\"y\n" +
"\x12CreateSheetRequest\x124\n" +
"\x06parent\x18\x01 \x01(\tB\x1c\xe0A\x02\xfaA\x16\n" +
"\x14bytebase.com/ProjectR\x06parent\x12-\n" +
@@ -481,12 +408,7 @@ const file_v1_sheet_service_proto_rawDesc = "" +
"\x0fGetSheetRequest\x12.\n" +
"\x04name\x18\x01 \x01(\tB\x1a\xe0A\x02\xfaA\x14\n" +
"\x12bytebase.com/SheetR\x04name\x12\x10\n" +
- "\x03raw\x18\x02 \x01(\bR\x03raw\"\xa5\x01\n" +
- "\x12UpdateSheetRequest\x12-\n" +
- "\x05sheet\x18\x01 \x01(\v2\x12.bytebase.v1.SheetB\x03\xe0A\x02R\x05sheet\x12;\n" +
- "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" +
- "updateMask\x12#\n" +
- "\rallow_missing\x18\x03 \x01(\bR\fallowMissing\"\x96\x03\n" +
+ "\x03raw\x18\x02 \x01(\bR\x03raw\"\x96\x03\n" +
"\x05Sheet\x12\x1a\n" +
"\x04name\x18\x01 \x01(\tB\x06\xe0A\x02\xe0A\x05R\x04name\x12!\n" +
"\x05title\x18\x02 \x01(\tB\v\xe0A\x02\xbaH\x05r\x03\x18\xc8\x01R\x05title\x12\x1d\n" +
@@ -499,12 +421,11 @@ const file_v1_sheet_service_proto_rawDesc = "" +
"\x06engine\x18\b \x01(\x0e2\x13.bytebase.v1.EngineB\x03\xe0A\x02R\x06engine::\xeaA7\n" +
"\x12bytebase.com/Sheet\x12!projects/{project}/sheets/{sheet}\">\n" +
"\fSheetPayload\x12.\n" +
- "\bcommands\x18\x01 \x03(\v2\x12.bytebase.v1.RangeR\bcommands2\x86\x05\n" +
+ "\bcommands\x18\x01 \x03(\v2\x12.bytebase.v1.RangeR\bcommands2\xe0\x03\n" +
"\fSheetService\x12\x98\x01\n" +
"\vCreateSheet\x12\x1f.bytebase.v1.CreateSheetRequest\x1a\x12.bytebase.v1.Sheet\"T\xdaA\fparent,sheet\x8a\xea0\x10bb.sheets.create\x90\xea0\x01\x82\xd3\xe4\x93\x02':\x05sheet\"\x1e/v1/{parent=projects/*}/sheets\x12\xb1\x01\n" +
"\x11BatchCreateSheets\x12%.bytebase.v1.BatchCreateSheetsRequest\x1a&.bytebase.v1.BatchCreateSheetsResponse\"M\x8a\xea0\x10bb.sheets.create\x90\xea0\x01\x82\xd3\xe4\x93\x02/:\x01*\"*/v1/{parent=projects/*}/sheets:batchCreate\x12\x80\x01\n" +
- "\bGetSheet\x12\x1c.bytebase.v1.GetSheetRequest\x1a\x12.bytebase.v1.Sheet\"B\xdaA\x04name\x8a\xea0\rbb.sheets.get\x90\xea0\x01\x82\xd3\xe4\x93\x02 \x12\x1e/v1/{name=projects/*/sheets/*}\x12\xa3\x01\n" +
- "\vUpdateSheet\x12\x1f.bytebase.v1.UpdateSheetRequest\x1a\x12.bytebase.v1.Sheet\"_\xdaA\x11sheet,update_mask\x8a\xea0\x10bb.sheets.update\x90\xea0\x01\x82\xd3\xe4\x93\x02-:\x05sheet2$/v1/{sheet.name=projects/*/sheets/*}B\xa7\x01\n" +
+ "\bGetSheet\x12\x1c.bytebase.v1.GetSheetRequest\x1a\x12.bytebase.v1.Sheet\"B\xdaA\x04name\x8a\xea0\rbb.sheets.get\x90\xea0\x01\x82\xd3\xe4\x93\x02 \x12\x1e/v1/{name=projects/*/sheets/*}B\xa7\x01\n" +
"\x0fcom.bytebase.v1B\x11SheetServiceProtoP\x01Z4github.com/bytebase/bytebase/backend/generated-go/v1\xa2\x02\x03BXX\xaa\x02\vBytebase.V1\xca\x02\vBytebase\\V1\xe2\x02\x17Bytebase\\V1\\GPBMetadata\xea\x02\fBytebase::V1b\x06proto3"
var (
@@ -519,43 +440,37 @@ func file_v1_sheet_service_proto_rawDescGZIP() []byte {
return file_v1_sheet_service_proto_rawDescData
}
-var file_v1_sheet_service_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
+var file_v1_sheet_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_v1_sheet_service_proto_goTypes = []any{
(*CreateSheetRequest)(nil), // 0: bytebase.v1.CreateSheetRequest
(*BatchCreateSheetsRequest)(nil), // 1: bytebase.v1.BatchCreateSheetsRequest
(*BatchCreateSheetsResponse)(nil), // 2: bytebase.v1.BatchCreateSheetsResponse
(*GetSheetRequest)(nil), // 3: bytebase.v1.GetSheetRequest
- (*UpdateSheetRequest)(nil), // 4: bytebase.v1.UpdateSheetRequest
- (*Sheet)(nil), // 5: bytebase.v1.Sheet
- (*SheetPayload)(nil), // 6: bytebase.v1.SheetPayload
- (*fieldmaskpb.FieldMask)(nil), // 7: google.protobuf.FieldMask
- (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp
- (Engine)(0), // 9: bytebase.v1.Engine
- (*Range)(nil), // 10: bytebase.v1.Range
+ (*Sheet)(nil), // 4: bytebase.v1.Sheet
+ (*SheetPayload)(nil), // 5: bytebase.v1.SheetPayload
+ (*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp
+ (Engine)(0), // 7: bytebase.v1.Engine
+ (*Range)(nil), // 8: bytebase.v1.Range
}
var file_v1_sheet_service_proto_depIdxs = []int32{
- 5, // 0: bytebase.v1.CreateSheetRequest.sheet:type_name -> bytebase.v1.Sheet
+ 4, // 0: bytebase.v1.CreateSheetRequest.sheet:type_name -> bytebase.v1.Sheet
0, // 1: bytebase.v1.BatchCreateSheetsRequest.requests:type_name -> bytebase.v1.CreateSheetRequest
- 5, // 2: bytebase.v1.BatchCreateSheetsResponse.sheets:type_name -> bytebase.v1.Sheet
- 5, // 3: bytebase.v1.UpdateSheetRequest.sheet:type_name -> bytebase.v1.Sheet
- 7, // 4: bytebase.v1.UpdateSheetRequest.update_mask:type_name -> google.protobuf.FieldMask
- 8, // 5: bytebase.v1.Sheet.create_time:type_name -> google.protobuf.Timestamp
- 6, // 6: bytebase.v1.Sheet.payload:type_name -> bytebase.v1.SheetPayload
- 9, // 7: bytebase.v1.Sheet.engine:type_name -> bytebase.v1.Engine
- 10, // 8: bytebase.v1.SheetPayload.commands:type_name -> bytebase.v1.Range
- 0, // 9: bytebase.v1.SheetService.CreateSheet:input_type -> bytebase.v1.CreateSheetRequest
- 1, // 10: bytebase.v1.SheetService.BatchCreateSheets:input_type -> bytebase.v1.BatchCreateSheetsRequest
- 3, // 11: bytebase.v1.SheetService.GetSheet:input_type -> bytebase.v1.GetSheetRequest
- 4, // 12: bytebase.v1.SheetService.UpdateSheet:input_type -> bytebase.v1.UpdateSheetRequest
- 5, // 13: bytebase.v1.SheetService.CreateSheet:output_type -> bytebase.v1.Sheet
- 2, // 14: bytebase.v1.SheetService.BatchCreateSheets:output_type -> bytebase.v1.BatchCreateSheetsResponse
- 5, // 15: bytebase.v1.SheetService.GetSheet:output_type -> bytebase.v1.Sheet
- 5, // 16: bytebase.v1.SheetService.UpdateSheet:output_type -> bytebase.v1.Sheet
- 13, // [13:17] is the sub-list for method output_type
- 9, // [9:13] is the sub-list for method input_type
- 9, // [9:9] is the sub-list for extension type_name
- 9, // [9:9] is the sub-list for extension extendee
- 0, // [0:9] is the sub-list for field type_name
+ 4, // 2: bytebase.v1.BatchCreateSheetsResponse.sheets:type_name -> bytebase.v1.Sheet
+ 6, // 3: bytebase.v1.Sheet.create_time:type_name -> google.protobuf.Timestamp
+ 5, // 4: bytebase.v1.Sheet.payload:type_name -> bytebase.v1.SheetPayload
+ 7, // 5: bytebase.v1.Sheet.engine:type_name -> bytebase.v1.Engine
+ 8, // 6: bytebase.v1.SheetPayload.commands:type_name -> bytebase.v1.Range
+ 0, // 7: bytebase.v1.SheetService.CreateSheet:input_type -> bytebase.v1.CreateSheetRequest
+ 1, // 8: bytebase.v1.SheetService.BatchCreateSheets:input_type -> bytebase.v1.BatchCreateSheetsRequest
+ 3, // 9: bytebase.v1.SheetService.GetSheet:input_type -> bytebase.v1.GetSheetRequest
+ 4, // 10: bytebase.v1.SheetService.CreateSheet:output_type -> bytebase.v1.Sheet
+ 2, // 11: bytebase.v1.SheetService.BatchCreateSheets:output_type -> bytebase.v1.BatchCreateSheetsResponse
+ 4, // 12: bytebase.v1.SheetService.GetSheet:output_type -> bytebase.v1.Sheet
+ 10, // [10:13] is the sub-list for method output_type
+ 7, // [7:10] is the sub-list for method input_type
+ 7, // [7:7] is the sub-list for extension type_name
+ 7, // [7:7] is the sub-list for extension extendee
+ 0, // [0:7] is the sub-list for field type_name
}
func init() { file_v1_sheet_service_proto_init() }
@@ -571,7 +486,7 @@ func file_v1_sheet_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_sheet_service_proto_rawDesc), len(file_v1_sheet_service_proto_rawDesc)),
NumEnums: 0,
- NumMessages: 7,
+ NumMessages: 6,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/backend/generated-go/v1/sheet_service.pb.gw.go b/backend/generated-go/v1/sheet_service.pb.gw.go
index c6e11827e9..93c8b4f65e 100644
--- a/backend/generated-go/v1/sheet_service.pb.gw.go
+++ b/backend/generated-go/v1/sheet_service.pb.gw.go
@@ -178,87 +178,6 @@ func local_request_SheetService_GetSheet_0(ctx context.Context, marshaler runtim
return msg, metadata, err
}
-var filter_SheetService_UpdateSheet_0 = &utilities.DoubleArray{Encoding: map[string]int{"sheet": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}}
-
-func request_SheetService_UpdateSheet_0(ctx context.Context, marshaler runtime.Marshaler, client SheetServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq UpdateSheetRequest
- metadata runtime.ServerMetadata
- err error
- )
- newReader, berr := utilities.IOReaderFactory(req.Body)
- if berr != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
- }
- if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Sheet); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if req.Body != nil {
- _, _ = io.Copy(io.Discard, req.Body)
- }
- if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
- if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Sheet); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- } else {
- protoReq.UpdateMask = fieldMask
- }
- }
- val, ok := pathParams["sheet.name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sheet.name")
- }
- err = runtime.PopulateFieldFromPath(&protoReq, "sheet.name", val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sheet.name", err)
- }
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SheetService_UpdateSheet_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := client.UpdateSheet(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_SheetService_UpdateSheet_0(ctx context.Context, marshaler runtime.Marshaler, server SheetServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq UpdateSheetRequest
- metadata runtime.ServerMetadata
- err error
- )
- newReader, berr := utilities.IOReaderFactory(req.Body)
- if berr != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
- }
- if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Sheet); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
- if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Sheet); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- } else {
- protoReq.UpdateMask = fieldMask
- }
- }
- val, ok := pathParams["sheet.name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sheet.name")
- }
- err = runtime.PopulateFieldFromPath(&protoReq, "sheet.name", val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sheet.name", err)
- }
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SheetService_UpdateSheet_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := server.UpdateSheet(ctx, &protoReq)
- return msg, metadata, err
-}
-
// RegisterSheetServiceHandlerServer registers the http handlers for service SheetService to "mux".
// UnaryRPC :call SheetServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@@ -325,26 +244,6 @@ func RegisterSheetServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu
}
forward_SheetService_GetSheet_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
- mux.Handle(http.MethodPatch, pattern_SheetService_UpdateSheet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.SheetService/UpdateSheet", runtime.WithHTTPPathPattern("/v1/{sheet.name=projects/*/sheets/*}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_SheetService_UpdateSheet_0(annotatedContext, inboundMarshaler, server, req, pathParams)
- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_SheetService_UpdateSheet_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
return nil
}
@@ -436,23 +335,6 @@ func RegisterSheetServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu
}
forward_SheetService_GetSheet_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
- mux.Handle(http.MethodPatch, pattern_SheetService_UpdateSheet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.SheetService/UpdateSheet", runtime.WithHTTPPathPattern("/v1/{sheet.name=projects/*/sheets/*}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_SheetService_UpdateSheet_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_SheetService_UpdateSheet_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
return nil
}
@@ -460,12 +342,10 @@ var (
pattern_SheetService_CreateSheet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "sheets"}, ""))
pattern_SheetService_BatchCreateSheets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "sheets"}, "batchCreate"))
pattern_SheetService_GetSheet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "sheets", "name"}, ""))
- pattern_SheetService_UpdateSheet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "sheets", "sheet.name"}, ""))
)
var (
forward_SheetService_CreateSheet_0 = runtime.ForwardResponseMessage
forward_SheetService_BatchCreateSheets_0 = runtime.ForwardResponseMessage
forward_SheetService_GetSheet_0 = runtime.ForwardResponseMessage
- forward_SheetService_UpdateSheet_0 = runtime.ForwardResponseMessage
)
diff --git a/backend/generated-go/v1/sheet_service_equal.pb.go b/backend/generated-go/v1/sheet_service_equal.pb.go
index 0c794de3b3..4a614ce434 100644
--- a/backend/generated-go/v1/sheet_service_equal.pb.go
+++ b/backend/generated-go/v1/sheet_service_equal.pb.go
@@ -3,11 +3,6 @@
package v1
-import (
- proto "google.golang.org/protobuf/proto"
- fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
-)
-
func (x *CreateSheetRequest) Equal(y *CreateSheetRequest) bool {
if x == y {
return true
@@ -79,29 +74,6 @@ func (x *GetSheetRequest) Equal(y *GetSheetRequest) bool {
return true
}
-func (x *UpdateSheetRequest) Equal(y *UpdateSheetRequest) bool {
- if x == y {
- return true
- }
- if x == nil || y == nil {
- return x == nil && y == nil
- }
- if !x.Sheet.Equal(y.Sheet) {
- return false
- }
- if equal, ok := interface{}(x.UpdateMask).(interface {
- Equal(*fieldmaskpb.FieldMask) bool
- }); !ok || !equal.Equal(y.UpdateMask) {
- return false
- } else if !proto.Equal(x.UpdateMask, y.UpdateMask) {
- return false
- }
- if x.AllowMissing != y.AllowMissing {
- return false
- }
- return true
-}
-
func (x *Sheet) Equal(y *Sheet) bool {
if x == y {
return true
diff --git a/backend/generated-go/v1/sheet_service_grpc.pb.go b/backend/generated-go/v1/sheet_service_grpc.pb.go
index 8bad5aec21..6bcf9ec55f 100644
--- a/backend/generated-go/v1/sheet_service_grpc.pb.go
+++ b/backend/generated-go/v1/sheet_service_grpc.pb.go
@@ -22,7 +22,6 @@ const (
SheetService_CreateSheet_FullMethodName = "/bytebase.v1.SheetService/CreateSheet"
SheetService_BatchCreateSheets_FullMethodName = "/bytebase.v1.SheetService/BatchCreateSheets"
SheetService_GetSheet_FullMethodName = "/bytebase.v1.SheetService/GetSheet"
- SheetService_UpdateSheet_FullMethodName = "/bytebase.v1.SheetService/UpdateSheet"
)
// SheetServiceClient is the client API for SheetService service.
@@ -40,9 +39,6 @@ type SheetServiceClient interface {
// Retrieves a SQL sheet by name.
// Permissions required: bb.sheets.get
GetSheet(ctx context.Context, in *GetSheetRequest, opts ...grpc.CallOption) (*Sheet, error)
- // Updates a SQL sheet's title or content.
- // Permissions required: bb.sheets.update
- UpdateSheet(ctx context.Context, in *UpdateSheetRequest, opts ...grpc.CallOption) (*Sheet, error)
}
type sheetServiceClient struct {
@@ -83,16 +79,6 @@ func (c *sheetServiceClient) GetSheet(ctx context.Context, in *GetSheetRequest,
return out, nil
}
-func (c *sheetServiceClient) UpdateSheet(ctx context.Context, in *UpdateSheetRequest, opts ...grpc.CallOption) (*Sheet, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(Sheet)
- err := c.cc.Invoke(ctx, SheetService_UpdateSheet_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
// SheetServiceServer is the server API for SheetService service.
// All implementations must embed UnimplementedSheetServiceServer
// for forward compatibility.
@@ -108,9 +94,6 @@ type SheetServiceServer interface {
// Retrieves a SQL sheet by name.
// Permissions required: bb.sheets.get
GetSheet(context.Context, *GetSheetRequest) (*Sheet, error)
- // Updates a SQL sheet's title or content.
- // Permissions required: bb.sheets.update
- UpdateSheet(context.Context, *UpdateSheetRequest) (*Sheet, error)
mustEmbedUnimplementedSheetServiceServer()
}
@@ -130,9 +113,6 @@ func (UnimplementedSheetServiceServer) BatchCreateSheets(context.Context, *Batch
func (UnimplementedSheetServiceServer) GetSheet(context.Context, *GetSheetRequest) (*Sheet, error) {
return nil, status.Error(codes.Unimplemented, "method GetSheet not implemented")
}
-func (UnimplementedSheetServiceServer) UpdateSheet(context.Context, *UpdateSheetRequest) (*Sheet, error) {
- return nil, status.Error(codes.Unimplemented, "method UpdateSheet not implemented")
-}
func (UnimplementedSheetServiceServer) mustEmbedUnimplementedSheetServiceServer() {}
func (UnimplementedSheetServiceServer) testEmbeddedByValue() {}
@@ -208,24 +188,6 @@ func _SheetService_GetSheet_Handler(srv interface{}, ctx context.Context, dec fu
return interceptor(ctx, in, info, handler)
}
-func _SheetService_UpdateSheet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(UpdateSheetRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(SheetServiceServer).UpdateSheet(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: SheetService_UpdateSheet_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(SheetServiceServer).UpdateSheet(ctx, req.(*UpdateSheetRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
// SheetService_ServiceDesc is the grpc.ServiceDesc for SheetService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -245,10 +207,6 @@ var SheetService_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetSheet",
Handler: _SheetService_GetSheet_Handler,
},
- {
- MethodName: "UpdateSheet",
- Handler: _SheetService_UpdateSheet_Handler,
- },
},
Streams: []grpc.StreamDesc{},
Metadata: "v1/sheet_service.proto",
diff --git a/backend/generated-go/v1/v1connect/sheet_service.connect.go b/backend/generated-go/v1/v1connect/sheet_service.connect.go
index ebf8972ad9..88d2328098 100644
--- a/backend/generated-go/v1/v1connect/sheet_service.connect.go
+++ b/backend/generated-go/v1/v1connect/sheet_service.connect.go
@@ -41,9 +41,6 @@ const (
SheetServiceBatchCreateSheetsProcedure = "/bytebase.v1.SheetService/BatchCreateSheets"
// SheetServiceGetSheetProcedure is the fully-qualified name of the SheetService's GetSheet RPC.
SheetServiceGetSheetProcedure = "/bytebase.v1.SheetService/GetSheet"
- // SheetServiceUpdateSheetProcedure is the fully-qualified name of the SheetService's UpdateSheet
- // RPC.
- SheetServiceUpdateSheetProcedure = "/bytebase.v1.SheetService/UpdateSheet"
)
// SheetServiceClient is a client for the bytebase.v1.SheetService service.
@@ -57,9 +54,6 @@ type SheetServiceClient interface {
// Retrieves a SQL sheet by name.
// Permissions required: bb.sheets.get
GetSheet(context.Context, *connect.Request[v1.GetSheetRequest]) (*connect.Response[v1.Sheet], error)
- // Updates a SQL sheet's title or content.
- // Permissions required: bb.sheets.update
- UpdateSheet(context.Context, *connect.Request[v1.UpdateSheetRequest]) (*connect.Response[v1.Sheet], error)
}
// NewSheetServiceClient constructs a client for the bytebase.v1.SheetService service. By default,
@@ -91,12 +85,6 @@ func NewSheetServiceClient(httpClient connect.HTTPClient, baseURL string, opts .
connect.WithSchema(sheetServiceMethods.ByName("GetSheet")),
connect.WithClientOptions(opts...),
),
- updateSheet: connect.NewClient[v1.UpdateSheetRequest, v1.Sheet](
- httpClient,
- baseURL+SheetServiceUpdateSheetProcedure,
- connect.WithSchema(sheetServiceMethods.ByName("UpdateSheet")),
- connect.WithClientOptions(opts...),
- ),
}
}
@@ -105,7 +93,6 @@ type sheetServiceClient struct {
createSheet *connect.Client[v1.CreateSheetRequest, v1.Sheet]
batchCreateSheets *connect.Client[v1.BatchCreateSheetsRequest, v1.BatchCreateSheetsResponse]
getSheet *connect.Client[v1.GetSheetRequest, v1.Sheet]
- updateSheet *connect.Client[v1.UpdateSheetRequest, v1.Sheet]
}
// CreateSheet calls bytebase.v1.SheetService.CreateSheet.
@@ -123,11 +110,6 @@ func (c *sheetServiceClient) GetSheet(ctx context.Context, req *connect.Request[
return c.getSheet.CallUnary(ctx, req)
}
-// UpdateSheet calls bytebase.v1.SheetService.UpdateSheet.
-func (c *sheetServiceClient) UpdateSheet(ctx context.Context, req *connect.Request[v1.UpdateSheetRequest]) (*connect.Response[v1.Sheet], error) {
- return c.updateSheet.CallUnary(ctx, req)
-}
-
// SheetServiceHandler is an implementation of the bytebase.v1.SheetService service.
type SheetServiceHandler interface {
// Creates a new SQL sheet.
@@ -139,9 +121,6 @@ type SheetServiceHandler interface {
// Retrieves a SQL sheet by name.
// Permissions required: bb.sheets.get
GetSheet(context.Context, *connect.Request[v1.GetSheetRequest]) (*connect.Response[v1.Sheet], error)
- // Updates a SQL sheet's title or content.
- // Permissions required: bb.sheets.update
- UpdateSheet(context.Context, *connect.Request[v1.UpdateSheetRequest]) (*connect.Response[v1.Sheet], error)
}
// NewSheetServiceHandler builds an HTTP handler from the service implementation. It returns the
@@ -169,12 +148,6 @@ func NewSheetServiceHandler(svc SheetServiceHandler, opts ...connect.HandlerOpti
connect.WithSchema(sheetServiceMethods.ByName("GetSheet")),
connect.WithHandlerOptions(opts...),
)
- sheetServiceUpdateSheetHandler := connect.NewUnaryHandler(
- SheetServiceUpdateSheetProcedure,
- svc.UpdateSheet,
- connect.WithSchema(sheetServiceMethods.ByName("UpdateSheet")),
- connect.WithHandlerOptions(opts...),
- )
return "/bytebase.v1.SheetService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case SheetServiceCreateSheetProcedure:
@@ -183,8 +156,6 @@ func NewSheetServiceHandler(svc SheetServiceHandler, opts ...connect.HandlerOpti
sheetServiceBatchCreateSheetsHandler.ServeHTTP(w, r)
case SheetServiceGetSheetProcedure:
sheetServiceGetSheetHandler.ServeHTTP(w, r)
- case SheetServiceUpdateSheetProcedure:
- sheetServiceUpdateSheetHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
@@ -205,7 +176,3 @@ func (UnimplementedSheetServiceHandler) BatchCreateSheets(context.Context, *conn
func (UnimplementedSheetServiceHandler) GetSheet(context.Context, *connect.Request[v1.GetSheetRequest]) (*connect.Response[v1.Sheet], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.SheetService.GetSheet is not implemented"))
}
-
-func (UnimplementedSheetServiceHandler) UpdateSheet(context.Context, *connect.Request[v1.UpdateSheetRequest]) (*connect.Response[v1.Sheet], error) {
- return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.SheetService.UpdateSheet is not implemented"))
-}
diff --git a/backend/store/sheet.go b/backend/store/sheet.go
index 451d58b529..7d04d321a2 100644
--- a/backend/store/sheet.go
+++ b/backend/store/sheet.go
@@ -47,13 +47,6 @@ type FindSheetMessage struct {
LoadFull bool
}
-// PatchSheetMessage is the message to patch a sheet.
-type PatchSheetMessage struct {
- UID int
- Updater string
- Statement *string
-}
-
// GetSheetStatementByID gets the statement of a sheet by ID.
func (s *Store) GetSheetStatementByID(ctx context.Context, id int) (string, error) {
if v, ok := s.sheetStatementCache.Get(id); ok && s.enableCache {
@@ -197,7 +190,7 @@ func (s *Store) CreateSheet(ctx context.Context, create *SheetMessage) (*SheetMe
h := sha256.Sum256([]byte(create.Statement))
create.Sha256 = h[:]
- if err := s.BatchCreateSheetBlob(ctx, [][]byte{create.Sha256}, []string{create.Statement}); err != nil {
+ if err := s.batchCreateSheetBlob(ctx, [][]byte{create.Sha256}, []string{create.Statement}); err != nil {
return nil, errors.Wrapf(err, "failed to create sheet blobs")
}
@@ -266,7 +259,7 @@ func (s *Store) BatchCreateSheet(ctx context.Context, projectID string, creates
payloads = append(payloads, payload)
}
- if err := s.BatchCreateSheetBlob(ctx, sha256s, statements); err != nil {
+ if err := s.batchCreateSheetBlob(ctx, sha256s, statements); err != nil {
return nil, errors.Wrapf(err, "failed to create sheet blobs")
}
@@ -327,7 +320,7 @@ func (s *Store) BatchCreateSheet(ctx context.Context, projectID string, creates
return creates, nil
}
-func (s *Store) BatchCreateSheetBlob(ctx context.Context, sha256s [][]byte, contents []string) error {
+func (s *Store) batchCreateSheetBlob(ctx context.Context, sha256s [][]byte, contents []string) error {
q := qb.Q().Space(`
INSERT INTO sheet_blob (
sha256,
@@ -349,44 +342,3 @@ func (s *Store) BatchCreateSheetBlob(ctx context.Context, sha256s [][]byte, cont
return nil
}
-
-// PatchSheet updates a sheet.
-func (s *Store) PatchSheet(ctx context.Context, patch *PatchSheetMessage) (*SheetMessage, error) {
- if patch.Statement == nil {
- return s.GetSheet(ctx, &FindSheetMessage{UID: &patch.UID})
- }
-
- h := sha256.Sum256([]byte(*patch.Statement))
-
- if err := s.BatchCreateSheetBlob(ctx, [][]byte{h[:]}, []string{*patch.Statement}); err != nil {
- return nil, errors.Wrapf(err, "failed to create sheet blobs")
- }
-
- q := qb.Q().Space(`
- UPDATE sheet
- SET
- sha256 = ?
- WHERE id = ?
- RETURNING id
- `, h[:], patch.UID)
-
- query, args, err := q.ToSQL()
- if err != nil {
- return nil, errors.Wrapf(err, "failed to build sql")
- }
-
- var uid int
- if err := s.GetDB().QueryRowContext(ctx, query, args...).Scan(
- &uid,
- ); err != nil {
- if err == sql.ErrNoRows {
- return nil, &common.Error{Code: common.NotFound, Err: errors.Errorf("sheet ID not found: %d", patch.UID)}
- }
- return nil, errors.Wrapf(err, "failed to update sheet")
- }
-
- s.sheetStatementCache.Add(patch.UID, *patch.Statement)
- s.sheetCache.Remove(patch.UID)
-
- return s.GetSheet(ctx, &FindSheetMessage{UID: &patch.UID})
-}
diff --git a/frontend/src/store/modules/v1/sheet.ts b/frontend/src/store/modules/v1/sheet.ts
index 29b44ee1a0..fb9bafb843 100644
--- a/frontend/src/store/modules/v1/sheet.ts
+++ b/frontend/src/store/modules/v1/sheet.ts
@@ -11,7 +11,6 @@ import {
CreateSheetRequestSchema,
GetSheetRequestSchema,
SheetSchema,
- UpdateSheetRequestSchema,
} from "@/types/proto-es/v1/sheet_service_pb";
import { extractSheetUID, getSheetStatement } from "@/utils";
@@ -121,27 +120,6 @@ export const useSheetV1Store = defineStore("sheet_v1", () => {
return getOrFetchSheetByName(`projects/-/sheets/${uid}`);
};
- const patchSheetContent = async (sheet: Partial<Sheet>) => {
- if (!sheet.name) return;
- const fullSheet = create(SheetSchema, {
- name: sheet.name || "",
- title: sheet.title || "",
- creator: sheet.creator || "",
- content: sheet.content || new Uint8Array(),
- contentSize: sheet.contentSize || BigInt(0),
- engine: sheet.engine || Engine.MYSQL,
- payload: sheet.payload,
- createTime: sheet.createTime,
- });
- const request = create(UpdateSheetRequestSchema, {
- sheet: fullSheet,
- updateMask: { paths: ["content"] },
- });
- const response = await sheetServiceClientConnect.updateSheet(request);
- setCache(response);
- return response;
- };
-
return {
createSheet,
getSheetByName,
@@ -149,7 +127,6 @@ export const useSheetV1Store = defineStore("sheet_v1", () => {
getOrFetchSheetByName,
getSheetByUID,
getOrFetchSheetByUID,
- patchSheetContent,
};
});
diff --git a/frontend/src/types/proto-es/v1/sheet_service_pb.d.ts b/frontend/src/types/proto-es/v1/sheet_service_pb.d.ts
index ec6bd95f3d..4ced3ddbc2 100644
--- a/frontend/src/types/proto-es/v1/sheet_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/sheet_service_pb.d.ts
@@ -4,7 +4,7 @@
import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
import type { Message } from "@bufbuild/protobuf";
-import type { FieldMask, Timestamp } from "@bufbuild/protobuf/wkt";
+import type { Timestamp } from "@bufbuild/protobuf/wkt";
import type { Engine, Range } from "./common_pb";
/**
@@ -104,47 +104,6 @@ export declare type GetSheetRequest = Message<"bytebase.v1.GetSheetRequest"> & {
*/
export declare const GetSheetRequestSchema: GenMessage<GetSheetRequest>;
-/**
- * @generated from message bytebase.v1.UpdateSheetRequest
- */
-export declare type UpdateSheetRequest = Message<"bytebase.v1.UpdateSheetRequest"> & {
- /**
- * The sheet to update.
- *
- * The sheet's `name` field is used to identify the sheet to update.
- * Format: projects/{project}/sheets/{sheet}
- *
- * @generated from field: bytebase.v1.Sheet sheet = 1;
- */
- sheet?: Sheet;
-
- /**
- * The list of fields to be updated.
- * Fields are specified relative to the sheet.
- * (e.g., `title`, `statement`; *not* `sheet.title` or `sheet.statement`)
- * Only support update the following fields for now:
- * - `title`
- * - `statement`
- *
- * @generated from field: google.protobuf.FieldMask update_mask = 2;
- */
- updateMask?: FieldMask;
-
- /**
- * If set to true, and the sheet is not found, a new sheet will be created.
- * In this situation, `update_mask` is ignored.
- *
- * @generated from field: bool allow_missing = 3;
- */
- allowMissing: boolean;
-};
-
-/**
- * Describes the message bytebase.v1.UpdateSheetRequest.
- * Use `create(UpdateSheetRequestSchema)` to create a new message.
- */
-export declare const UpdateSheetRequestSchema: GenMessage<UpdateSheetRequest>;
-
/**
* @generated from message bytebase.v1.Sheet
*/
@@ -274,16 +233,5 @@ export declare const SheetService: GenService<{
input: typeof GetSheetRequestSchema;
output: typeof SheetSchema;
},
- /**
- * Updates a SQL sheet's title or content.
- * Permissions required: bb.sheets.update
- *
- * @generated from rpc bytebase.v1.SheetService.UpdateSheet
- */
- updateSheet: {
- methodKind: "unary";
- input: typeof UpdateSheetRequestSchema;
- output: typeof SheetSchema;
- },
}>;
diff --git a/frontend/src/types/proto-es/v1/sheet_service_pb.js b/frontend/src/types/proto-es/v1/sheet_service_pb.js
index fe3200d21c..7b59659bfe 100644
--- a/frontend/src/types/proto-es/v1/sheet_service_pb.js
+++ b/frontend/src/types/proto-es/v1/sheet_service_pb.js
@@ -8,7 +8,7 @@ import { file_google_api_annotations } from "../google/api/annotations_pb";
import { file_google_api_client } from "../google/api/client_pb";
import { file_google_api_field_behavior } from "../google/api/field_behavior_pb";
import { file_google_api_resource } from "../google/api/resource_pb";
-import { file_google_protobuf_field_mask, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";
+import { file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";
import { file_v1_annotation } from "./annotation_pb";
import { file_v1_common } from "./common_pb";
@@ -16,7 +16,7 @@ import { file_v1_common } from "./common_pb";
* Describes the file v1/sheet_service.proto.
*/
export const file_v1_sheet_service = /*@__PURE__*/
- fileDesc("ChZ2MS9zaGVldF9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSJqChJDcmVhdGVTaGVldFJlcXVlc3QSLAoGcGFyZW50GAEgASgJQhzgQQL6QRYKFGJ5dGViYXNlLmNvbS9Qcm9qZWN0EiYKBXNoZWV0GAIgASgLMhIuYnl0ZWJhc2UudjEuU2hlZXRCA+BBAiKAAQoYQmF0Y2hDcmVhdGVTaGVldHNSZXF1ZXN0EiwKBnBhcmVudBgBIAEoCUIc4EEC+kEWChRieXRlYmFzZS5jb20vUHJvamVjdBI2CghyZXF1ZXN0cxgCIAMoCzIfLmJ5dGViYXNlLnYxLkNyZWF0ZVNoZWV0UmVxdWVzdEID4EECIj8KGUJhdGNoQ3JlYXRlU2hlZXRzUmVzcG9uc2USIgoGc2hlZXRzGAEgAygLMhIuYnl0ZWJhc2UudjEuU2hlZXQiSAoPR2V0U2hlZXRSZXF1ZXN0EigKBG5hbWUYASABKAlCGuBBAvpBFAoSYnl0ZWJhc2UuY29tL1NoZWV0EgsKA3JhdxgCIAEoCCKEAQoSVXBkYXRlU2hlZXRSZXF1ZXN0EiYKBXNoZWV0GAEgASgLMhIuYnl0ZWJhc2UudjEuU2hlZXRCA+BBAhIvCgt1cGRhdGVfbWFzaxgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2sSFQoNYWxsb3dfbWlzc2luZxgDIAEoCCLNAgoFU2hlZXQSFAoEbmFtZRgBIAEoCUIG4EEC4EEFEhoKBXRpdGxlGAIgASgJQgvgQQK6SAVyAxjIARIUCgdjcmVhdG9yGAMgASgJQgPgQQMSNAoLY3JlYXRlX3RpbWUYBCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQMSFAoHY29udGVudBgFIAEoDEID4EECEhkKDGNvbnRlbnRfc2l6ZRgGIAEoA0ID4EEDEi8KB3BheWxvYWQYByABKAsyGS5ieXRlYmFzZS52MS5TaGVldFBheWxvYWRCA+BBAxIoCgZlbmdpbmUYCCABKA4yEy5ieXRlYmFzZS52MS5FbmdpbmVCA+BBAjo66kE3ChJieXRlYmFzZS5jb20vU2hlZXQSIXByb2plY3RzL3twcm9qZWN0fS9zaGVldHMve3NoZWV0fSI0CgxTaGVldFBheWxvYWQSJAoIY29tbWFuZHMYASADKAsyEi5ieXRlYmFzZS52MS5SYW5nZTKGBQoMU2hlZXRTZXJ2aWNlEpgBCgtDcmVhdGVTaGVldBIfLmJ5dGViYXNlLnYxLkNyZWF0ZVNoZWV0UmVxdWVzdBoSLmJ5dGViYXNlLnYxLlNoZWV0IlTaQQxwYXJlbnQsc2hlZXSK6jAQYmIuc2hlZXRzLmNyZWF0ZZDqMAGC0+STAic6BXNoZWV0Ih4vdjEve3BhcmVudD1wcm9qZWN0cy8qfS9zaGVldHMSsQEKEUJhdGNoQ3JlYXRlU2hlZXRzEiUuYnl0ZWJhc2UudjEuQmF0Y2hDcmVhdGVTaGVldHNSZXF1ZXN0GiYuYnl0ZWJhc2UudjEuQmF0Y2hDcmVhdGVTaGVldHNSZXNwb25zZSJNiuowEGJiLnNoZWV0cy5jcmVhdGWQ6jABgtPkkwIvOgEqIiovdjEve3BhcmVudD1wcm9qZWN0cy8qfS9zaGVldHM6YmF0Y2hDcmVhdGUSgAEKCEdldFNoZWV0EhwuYnl0ZWJhc2UudjEuR2V0U2hlZXRSZXF1ZXN0GhIuYnl0ZWJhc2UudjEuU2hlZXQiQtpBBG5hbWWK6jANYmIuc2hlZXRzLmdldJDqMAGC0+STAiASHi92MS97bmFtZT1wcm9qZWN0cy8qL3NoZWV0cy8qfRKjAQoLVXBkYXRlU2hlZXQSHy5ieXRlYmFzZS52MS5VcGRhdGVTaGVldFJlcXVlc3QaEi5ieXRlYmFzZS52MS5TaGVldCJf2kERc2hlZXQsdXBkYXRlX21hc2uK6jAQYmIuc2hlZXRzLnVwZGF0ZZDqMAGC0+STAi06BXNoZWV0MiQvdjEve3NoZWV0Lm5hbWU9cHJvamVjdHMvKi9zaGVldHMvKn1CpwEKD2NvbS5ieXRlYmFzZS52MUIRU2hlZXRTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common]);
+ fileDesc("ChZ2MS9zaGVldF9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSJqChJDcmVhdGVTaGVldFJlcXVlc3QSLAoGcGFyZW50GAEgASgJQhzgQQL6QRYKFGJ5dGViYXNlLmNvbS9Qcm9qZWN0EiYKBXNoZWV0GAIgASgLMhIuYnl0ZWJhc2UudjEuU2hlZXRCA+BBAiKAAQoYQmF0Y2hDcmVhdGVTaGVldHNSZXF1ZXN0EiwKBnBhcmVudBgBIAEoCUIc4EEC+kEWChRieXRlYmFzZS5jb20vUHJvamVjdBI2CghyZXF1ZXN0cxgCIAMoCzIfLmJ5dGViYXNlLnYxLkNyZWF0ZVNoZWV0UmVxdWVzdEID4EECIj8KGUJhdGNoQ3JlYXRlU2hlZXRzUmVzcG9uc2USIgoGc2hlZXRzGAEgAygLMhIuYnl0ZWJhc2UudjEuU2hlZXQiSAoPR2V0U2hlZXRSZXF1ZXN0EigKBG5hbWUYASABKAlCGuBBAvpBFAoSYnl0ZWJhc2UuY29tL1NoZWV0EgsKA3JhdxgCIAEoCCLNAgoFU2hlZXQSFAoEbmFtZRgBIAEoCUIG4EEC4EEFEhoKBXRpdGxlGAIgASgJQgvgQQK6SAVyAxjIARIUCgdjcmVhdG9yGAMgASgJQgPgQQMSNAoLY3JlYXRlX3RpbWUYBCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQMSFAoHY29udGVudBgFIAEoDEID4EECEhkKDGNvbnRlbnRfc2l6ZRgGIAEoA0ID4EEDEi8KB3BheWxvYWQYByABKAsyGS5ieXRlYmFzZS52MS5TaGVldFBheWxvYWRCA+BBAxIoCgZlbmdpbmUYCCABKA4yEy5ieXRlYmFzZS52MS5FbmdpbmVCA+BBAjo66kE3ChJieXRlYmFzZS5jb20vU2hlZXQSIXByb2plY3RzL3twcm9qZWN0fS9zaGVldHMve3NoZWV0fSI0CgxTaGVldFBheWxvYWQSJAoIY29tbWFuZHMYASADKAsyEi5ieXRlYmFzZS52MS5SYW5nZTLgAwoMU2hlZXRTZXJ2aWNlEpgBCgtDcmVhdGVTaGVldBIfLmJ5dGViYXNlLnYxLkNyZWF0ZVNoZWV0UmVxdWVzdBoSLmJ5dGViYXNlLnYxLlNoZWV0IlTaQQxwYXJlbnQsc2hlZXSK6jAQYmIuc2hlZXRzLmNyZWF0ZZDqMAGC0+STAic6BXNoZWV0Ih4vdjEve3BhcmVudD1wcm9qZWN0cy8qfS9zaGVldHMSsQEKEUJhdGNoQ3JlYXRlU2hlZXRzEiUuYnl0ZWJhc2UudjEuQmF0Y2hDcmVhdGVTaGVldHNSZXF1ZXN0GiYuYnl0ZWJhc2UudjEuQmF0Y2hDcmVhdGVTaGVldHNSZXNwb25zZSJNiuowEGJiLnNoZWV0cy5jcmVhdGWQ6jABgtPkkwIvOgEqIiovdjEve3BhcmVudD1wcm9qZWN0cy8qfS9zaGVldHM6YmF0Y2hDcmVhdGUSgAEKCEdldFNoZWV0EhwuYnl0ZWJhc2UudjEuR2V0U2hlZXRSZXF1ZXN0GhIuYnl0ZWJhc2UudjEuU2hlZXQiQtpBBG5hbWWK6jANYmIuc2hlZXRzLmdldJDqMAGC0+STAiASHi92MS97bmFtZT1wcm9qZWN0cy8qL3NoZWV0cy8qfUKnAQoPY29tLmJ5dGViYXNlLnYxQhFTaGVldFNlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common]);
/**
* Describes the message bytebase.v1.CreateSheetRequest.
@@ -46,26 +46,19 @@ export const BatchCreateSheetsResponseSchema = /*@__PURE__*/
export const GetSheetRequestSchema = /*@__PURE__*/
messageDesc(file_v1_sheet_service, 3);
-/**
- * Describes the message bytebase.v1.UpdateSheetRequest.
- * Use `create(UpdateSheetRequestSchema)` to create a new message.
- */
-export const UpdateSheetRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_sheet_service, 4);
-
/**
* Describes the message bytebase.v1.Sheet.
* Use `create(SheetSchema)` to create a new message.
*/
export const SheetSchema = /*@__PURE__*/
- messageDesc(file_v1_sheet_service, 5);
+ messageDesc(file_v1_sheet_service, 4);
/**
* Describes the message bytebase.v1.SheetPayload.
* Use `create(SheetPayloadSchema)` to create a new message.
*/
export const SheetPayloadSchema = /*@__PURE__*/
- messageDesc(file_v1_sheet_service, 6);
+ messageDesc(file_v1_sheet_service, 5);
/**
* SheetService manages SQL scripts and saved queries.
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index b6209bf0f2..bdb114200a 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -6077,64 +6077,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Status'
- patch:
- tags:
- - SheetService
- description: |-
- Updates a SQL sheet's title or content.
- Permissions required: bb.sheets.update
- operationId: SheetService_UpdateSheet
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
- schema:
- type: string
- - name: sheet
- in: path
- description: The sheet id.
- required: true
- schema:
- type: string
- - name: updateMask
- in: query
- description: |-
- The list of fields to be updated.
- Fields are specified relative to the sheet.
- (e.g., `title`, `statement`; *not* `sheet.title` or `sheet.statement`)
- Only support update the following fields for now:
- - `title`
- - `statement`
- schema:
- type: string
- format: field-mask
- - name: allowMissing
- in: query
- description: |-
- If set to true, and the sheet is not found, a new sheet will be created.
- In this situation, `update_mask` is ignored.
- schema:
- type: boolean
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Sheet'
- required: true
- responses:
- "200":
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Sheet'
- default:
- description: Default error response
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Status'
/v1/projects/{project}/sheets:batchCreate:
post:
tags:
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 68b38ed6fd..e6a1a26e56 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -645,7 +645,6 @@
- [GetSheetRequest](#bytebase-v1-GetSheetRequest)
- [Sheet](#bytebase-v1-Sheet)
- [SheetPayload](#bytebase-v1-SheetPayload)
- - [UpdateSheetRequest](#bytebase-v1-UpdateSheetRequest)
- [SheetService](#bytebase-v1-SheetService)
@@ -10545,25 +10544,6 @@ RolloutService manages the execution of deployment plans.
-
-<a name="bytebase-v1-UpdateSheetRequest"></a>
-
-### UpdateSheetRequest
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| sheet | [Sheet](#bytebase-v1-Sheet) | | The sheet to update.
-
-The sheet&#39;s `name` field is used to identify the sheet to update. Format: projects/{project}/sheets/{sheet} |
-| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to be updated. Fields are specified relative to the sheet. (e.g., `title`, `statement`; *not* `sheet.title` or `sheet.statement`) Only support update the following fields for now: - `title` - `statement` |
-| allow_missing | [bool](#bool) | | If set to true, and the sheet is not found, a new sheet will be created. In this situation, `update_mask` is ignored. |
-
-
-
-
-
@@ -10581,7 +10561,6 @@ SheetService manages SQL scripts and saved queries.
| CreateSheet | [CreateSheetRequest](#bytebase-v1-CreateSheetRequest) | [Sheet](#bytebase-v1-Sheet) | Creates a new SQL sheet. Permissions required: bb.sheets.create |
| BatchCreateSheets | [BatchCreateSheetsRequest](#bytebase-v1-BatchCreateSheetsRequest) | [BatchCreateSheetsResponse](#bytebase-v1-BatchCreateSheetsResponse) | Creates multiple SQL sheets in a single operation. Permissions required: bb.sheets.create |
| GetSheet | [GetSheetRequest](#bytebase-v1-GetSheetRequest) | [Sheet](#bytebase-v1-Sheet) | Retrieves a SQL sheet by name. Permissions required: bb.sheets.get |
-| UpdateSheet | [UpdateSheetRequest](#bytebase-v1-UpdateSheetRequest) | [Sheet](#bytebase-v1-Sheet) | Updates a SQL sheet&#39;s title or content. Permissions required: bb.sheets.update |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index d0c89f0e5b..1143f4ed83 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -2640,10 +2640,6 @@
<a href="#bytebase.v1.SheetPayload"><span class="badge">M</span>SheetPayload</a>
</li>
- <li>
- <a href="#bytebase.v1.UpdateSheetRequest"><span class="badge">M</span>UpdateSheetRequest</a>
- </li>
-
@@ -29639,53 +29635,6 @@ set the `raw` to true in GetSheet request to retrieve the full content. </p></td
- <h3 id="bytebase.v1.UpdateSheetRequest">UpdateSheetRequest</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>sheet</td>
- <td><a href="#bytebase.v1.Sheet">Sheet</a></td>
- <td></td>
- <td><p>The sheet to update.
-
-The sheet&#39;s `name` field is used to identify the sheet to update.
-Format: projects/{project}/sheets/{sheet} </p></td>
- </tr>
-
- <tr>
- <td>update_mask</td>
- <td><a href="#google.protobuf.FieldMask">google.protobuf.FieldMask</a></td>
- <td></td>
- <td><p>The list of fields to be updated.
-Fields are specified relative to the sheet.
-(e.g., `title`, `statement`; *not* `sheet.title` or `sheet.statement`)
-Only support update the following fields for now:
-- `title`
-- `statement` </p></td>
- </tr>
-
- <tr>
- <td>allow_missing</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>If set to true, and the sheet is not found, a new sheet will be created.
-In this situation, `update_mask` is ignored. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
@@ -29724,14 +29673,6 @@ Permissions required: bb.sheets.create</p></td>
Permissions required: bb.sheets.get</p></td>
</tr>
- <tr>
- <td>UpdateSheet</td>
- <td><a href="#bytebase.v1.UpdateSheetRequest">UpdateSheetRequest</a></td>
- <td><a href="#bytebase.v1.Sheet">Sheet</a></td>
- <td><p>Updates a SQL sheet&#39;s title or content.
-Permissions required: bb.sheets.update</p></td>
- </tr>
-
</tbody>
</table>
@@ -29780,16 +29721,6 @@ Permissions required: bb.sheets.update</p></td>
</tr>
-
-
- <tr>
- <td>UpdateSheet</td>
- <td>PATCH</td>
- <td>/v1/{sheet.name=projects/*/sheets/*}</td>
- <td>sheet</td>
- </tr>
-
-
</tbody>
</table>
diff --git a/proto/v1/v1/sheet_service.proto b/proto/v1/v1/sheet_service.proto
index 25e03e02a8..db4ce48b05 100644
--- a/proto/v1/v1/sheet_service.proto
+++ b/proto/v1/v1/sheet_service.proto
@@ -7,7 +7,6 @@ import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
-import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "v1/annotation.proto";
import "v1/common.proto";
@@ -47,18 +46,6 @@ service SheetService {
option (bytebase.v1.permission) = "bb.sheets.get";
option (bytebase.v1.auth_method) = IAM;
}
-
- // Updates a SQL sheet's title or content.
- // Permissions required: bb.sheets.update
- rpc UpdateSheet(UpdateSheetRequest) returns (Sheet) {
- option (google.api.http) = {
- patch: "/v1/{sheet.name=projects/*/sheets/*}"
- body: "sheet"
- };
- option (google.api.method_signature) = "sheet,update_mask";
- option (bytebase.v1.permission) = "bb.sheets.update";
- option (bytebase.v1.auth_method) = IAM;
- }
}
message CreateSheetRequest {
@@ -100,26 +87,6 @@ message GetSheetRequest {
bool raw = 2;
}
-message UpdateSheetRequest {
- // The sheet to update.
- //
- // The sheet's `name` field is used to identify the sheet to update.
- // Format: projects/{project}/sheets/{sheet}
- Sheet sheet = 1 [(google.api.field_behavior) = REQUIRED];
-
- // The list of fields to be updated.
- // Fields are specified relative to the sheet.
- // (e.g., `title`, `statement`; *not* `sheet.title` or `sheet.statement`)
- // Only support update the following fields for now:
- // - `title`
- // - `statement`
- google.protobuf.FieldMask update_mask = 2;
-
- // If set to true, and the sheet is not found, a new sheet will be created.
- // In this situation, `update_mask` is ignored.
- bool allow_missing = 3;
-}
-
message Sheet {
option (google.api.resource) = {
type: "bytebase.com/Sheet"