Skip to content

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

refactor: use Range in SheetPayload and remove unused Type enum (#18458)

Danny Xuef4849545094
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index e792d2b2ac..05fe5b918e 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -15896,7 +15896,7 @@ components:
description: content_size is the full size of the content, may not match the size of the `content` field.
payload:
title: payload
- description: Additional metadata and configuration for the sheet.
+ description: Parsed metadata about SQL commands in the sheet.
$ref: '#/components/schemas/bytebase.v1.SheetPayload'
engine:
title: engine
@@ -15904,40 +15904,17 @@ components:
$ref: '#/components/schemas/bytebase.v1.Engine'
title: Sheet
additionalProperties: false
- bytebase.v1.SheetCommand:
- type: object
- properties:
- start:
- type: integer
- title: start
- format: int32
- end:
- type: integer
- title: end
- format: int32
- title: SheetCommand
- additionalProperties: false
bytebase.v1.SheetPayload:
type: object
properties:
- type:
- title: type
- $ref: '#/components/schemas/bytebase.v1.SheetPayload.Type'
commands:
type: array
items:
- $ref: '#/components/schemas/bytebase.v1.SheetCommand'
+ $ref: '#/components/schemas/bytebase.v1.Range'
title: commands
description: The start and end position of each command in the sheet statement.
title: SheetPayload
additionalProperties: false
- bytebase.v1.SheetPayload.Type:
- type: string
- title: Type
- enum:
- - TYPE_UNSPECIFIED
- - SCHEMA_DESIGN
- description: Type of the SheetPayload.
bytebase.v1.SpatialIndexConfig:
type: object
properties:
diff --git a/backend/api/v1/sheet_service.go b/backend/api/v1/sheet_service.go
index d3d876089a..735fcff230 100644
--- a/backend/api/v1/sheet_service.go
+++ b/backend/api/v1/sheet_service.go
@@ -287,9 +287,9 @@ func (s *SheetService) convertToAPISheetMessage(ctx context.Context, sheet *stor
}
v1SheetPayload := &v1pb.SheetPayload{}
if len(sheet.Payload.GetCommands()) > 0 {
- v1SheetPayload.Commands = convertToSheetCommands(sheet.Payload.GetCommands())
+ v1SheetPayload.Commands = convertToRanges(sheet.Payload.GetCommands())
} else {
- v1SheetPayload.Commands = []*v1pb.SheetCommand{
+ v1SheetPayload.Commands = []*v1pb.Range{
{Start: 0, End: int32(sheet.Size)},
}
}
@@ -319,10 +319,10 @@ func convertToStoreSheetMessage(projectID string, creator string, sheet *v1pb.Sh
return sheetMessage
}
-func convertToSheetCommands(commands []*storepb.Range) []*v1pb.SheetCommand {
- var cs []*v1pb.SheetCommand
+func convertToRanges(commands []*storepb.Range) []*v1pb.Range {
+ var cs []*v1pb.Range
for _, command := range commands {
- c := &v1pb.SheetCommand{
+ c := &v1pb.Range{
Start: command.Start,
End: command.End,
}
diff --git a/backend/generated-go/v1/sheet_service.pb.go b/backend/generated-go/v1/sheet_service.pb.go
index fb8bda8c00..e547ed05bc 100644
--- a/backend/generated-go/v1/sheet_service.pb.go
+++ b/backend/generated-go/v1/sheet_service.pb.go
@@ -25,53 +25,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
-// Type of the SheetPayload.
-type SheetPayload_Type int32
-
-const (
- SheetPayload_TYPE_UNSPECIFIED SheetPayload_Type = 0
- SheetPayload_SCHEMA_DESIGN SheetPayload_Type = 1
-)
-
-// Enum value maps for SheetPayload_Type.
-var (
- SheetPayload_Type_name = map[int32]string{
- 0: "TYPE_UNSPECIFIED",
- 1: "SCHEMA_DESIGN",
- }
- SheetPayload_Type_value = map[string]int32{
- "TYPE_UNSPECIFIED": 0,
- "SCHEMA_DESIGN": 1,
- }
-)
-
-func (x SheetPayload_Type) Enum() *SheetPayload_Type {
- p := new(SheetPayload_Type)
- *p = x
- return p
-}
-
-func (x SheetPayload_Type) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (SheetPayload_Type) Descriptor() protoreflect.EnumDescriptor {
- return file_v1_sheet_service_proto_enumTypes[0].Descriptor()
-}
-
-func (SheetPayload_Type) Type() protoreflect.EnumType {
- return &file_v1_sheet_service_proto_enumTypes[0]
-}
-
-func (x SheetPayload_Type) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Use SheetPayload_Type.Descriptor instead.
-func (SheetPayload_Type) EnumDescriptor() ([]byte, []int) {
- return file_v1_sheet_service_proto_rawDescGZIP(), []int{6, 0}
-}
-
type CreateSheetRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The parent resource where this sheet will be created.
@@ -371,7 +324,7 @@ type Sheet struct {
Content []byte `protobuf:"bytes,7,opt,name=content,proto3" json:"content,omitempty"`
// content_size is the full size of the content, may not match the size of the `content` field.
ContentSize int64 `protobuf:"varint,8,opt,name=content_size,json=contentSize,proto3" json:"content_size,omitempty"`
- // Additional metadata and configuration for the sheet.
+ // Parsed metadata about SQL commands in the sheet.
Payload *SheetPayload `protobuf:"bytes,13,opt,name=payload,proto3" json:"payload,omitempty"`
// The SQL dialect.
Engine Engine `protobuf:"varint,14,opt,name=engine,proto3,enum=bytebase.v1.Engine" json:"engine,omitempty"`
@@ -467,9 +420,8 @@ func (x *Sheet) GetEngine() Engine {
type SheetPayload struct {
state protoimpl.MessageState `protogen:"open.v1"`
- Type SheetPayload_Type `protobuf:"varint,1,opt,name=type,proto3,enum=bytebase.v1.SheetPayload_Type" json:"type,omitempty"`
// The start and end position of each command in the sheet statement.
- Commands []*SheetCommand `protobuf:"bytes,4,rep,name=commands,proto3" json:"commands,omitempty"`
+ Commands []*Range `protobuf:"bytes,4,rep,name=commands,proto3" json:"commands,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -504,72 +456,13 @@ func (*SheetPayload) Descriptor() ([]byte, []int) {
return file_v1_sheet_service_proto_rawDescGZIP(), []int{6}
}
-func (x *SheetPayload) GetType() SheetPayload_Type {
- if x != nil {
- return x.Type
- }
- return SheetPayload_TYPE_UNSPECIFIED
-}
-
-func (x *SheetPayload) GetCommands() []*SheetCommand {
+func (x *SheetPayload) GetCommands() []*Range {
if x != nil {
return x.Commands
}
return nil
}
-type SheetCommand struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Start int32 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"`
- End int32 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *SheetCommand) Reset() {
- *x = SheetCommand{}
- mi := &file_v1_sheet_service_proto_msgTypes[7]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *SheetCommand) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*SheetCommand) ProtoMessage() {}
-
-func (x *SheetCommand) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sheet_service_proto_msgTypes[7]
- 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 SheetCommand.ProtoReflect.Descriptor instead.
-func (*SheetCommand) Descriptor() ([]byte, []int) {
- return file_v1_sheet_service_proto_rawDescGZIP(), []int{7}
-}
-
-func (x *SheetCommand) GetStart() int32 {
- if x != nil {
- return x.Start
- }
- return 0
-}
-
-func (x *SheetCommand) GetEnd() int32 {
- if x != nil {
- return x.End
- }
- return 0
-}
-
var File_v1_sheet_service_proto protoreflect.FileDescriptor
const file_v1_sheet_service_proto_rawDesc = "" +
@@ -593,7 +486,7 @@ const file_v1_sheet_service_proto_rawDesc = "" +
"\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\"\x91\x03\n" +
+ "\rallow_missing\x18\x03 \x01(\bR\fallowMissing\"\x96\x03\n" +
"\x05Sheet\x12\x1a\n" +
"\x04name\x18\x01 \x01(\tB\x06\xe0A\x02\xe0A\x05R\x04name\x12!\n" +
"\x05title\x18\x03 \x01(\tB\v\xe0A\x02\xbaH\x05r\x03\x18\xc8\x01R\x05title\x12\x1d\n" +
@@ -601,19 +494,12 @@ const file_v1_sheet_service_proto_rawDesc = "" +
"\vcreate_time\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" +
"createTime\x12\x1d\n" +
"\acontent\x18\a \x01(\fB\x03\xe0A\x02R\acontent\x12&\n" +
- "\fcontent_size\x18\b \x01(\x03B\x03\xe0A\x03R\vcontentSize\x123\n" +
- "\apayload\x18\r \x01(\v2\x19.bytebase.v1.SheetPayloadR\apayload\x120\n" +
+ "\fcontent_size\x18\b \x01(\x03B\x03\xe0A\x03R\vcontentSize\x128\n" +
+ "\apayload\x18\r \x01(\v2\x19.bytebase.v1.SheetPayloadB\x03\xe0A\x03R\apayload\x120\n" +
"\x06engine\x18\x0e \x01(\x0e2\x13.bytebase.v1.EngineB\x03\xe0A\x02R\x06engine::\xeaA7\n" +
- "\x12bytebase.com/Sheet\x12!projects/{project}/sheets/{sheet}\"\xaa\x01\n" +
- "\fSheetPayload\x122\n" +
- "\x04type\x18\x01 \x01(\x0e2\x1e.bytebase.v1.SheetPayload.TypeR\x04type\x125\n" +
- "\bcommands\x18\x04 \x03(\v2\x19.bytebase.v1.SheetCommandR\bcommands\"/\n" +
- "\x04Type\x12\x14\n" +
- "\x10TYPE_UNSPECIFIED\x10\x00\x12\x11\n" +
- "\rSCHEMA_DESIGN\x10\x01\"6\n" +
- "\fSheetCommand\x12\x14\n" +
- "\x05start\x18\x01 \x01(\x05R\x05start\x12\x10\n" +
- "\x03end\x18\x02 \x01(\x05R\x03end2\x86\x05\n" +
+ "\x12bytebase.com/Sheet\x12!projects/{project}/sheets/{sheet}\">\n" +
+ "\fSheetPayload\x12.\n" +
+ "\bcommands\x18\x04 \x03(\v2\x12.bytebase.v1.RangeR\bcommands2\x86\x05\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" +
@@ -633,46 +519,43 @@ func file_v1_sheet_service_proto_rawDescGZIP() []byte {
return file_v1_sheet_service_proto_rawDescData
}
-var file_v1_sheet_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_v1_sheet_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
+var file_v1_sheet_service_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_v1_sheet_service_proto_goTypes = []any{
- (SheetPayload_Type)(0), // 0: bytebase.v1.SheetPayload.Type
- (*CreateSheetRequest)(nil), // 1: bytebase.v1.CreateSheetRequest
- (*BatchCreateSheetsRequest)(nil), // 2: bytebase.v1.BatchCreateSheetsRequest
- (*BatchCreateSheetsResponse)(nil), // 3: bytebase.v1.BatchCreateSheetsResponse
- (*GetSheetRequest)(nil), // 4: bytebase.v1.GetSheetRequest
- (*UpdateSheetRequest)(nil), // 5: bytebase.v1.UpdateSheetRequest
- (*Sheet)(nil), // 6: bytebase.v1.Sheet
- (*SheetPayload)(nil), // 7: bytebase.v1.SheetPayload
- (*SheetCommand)(nil), // 8: bytebase.v1.SheetCommand
- (*fieldmaskpb.FieldMask)(nil), // 9: google.protobuf.FieldMask
- (*timestamppb.Timestamp)(nil), // 10: google.protobuf.Timestamp
- (Engine)(0), // 11: bytebase.v1.Engine
+ (*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
}
var file_v1_sheet_service_proto_depIdxs = []int32{
- 6, // 0: bytebase.v1.CreateSheetRequest.sheet:type_name -> bytebase.v1.Sheet
- 1, // 1: bytebase.v1.BatchCreateSheetsRequest.requests:type_name -> bytebase.v1.CreateSheetRequest
- 6, // 2: bytebase.v1.BatchCreateSheetsResponse.sheets:type_name -> bytebase.v1.Sheet
- 6, // 3: bytebase.v1.UpdateSheetRequest.sheet:type_name -> bytebase.v1.Sheet
- 9, // 4: bytebase.v1.UpdateSheetRequest.update_mask:type_name -> google.protobuf.FieldMask
- 10, // 5: bytebase.v1.Sheet.create_time:type_name -> google.protobuf.Timestamp
- 7, // 6: bytebase.v1.Sheet.payload:type_name -> bytebase.v1.SheetPayload
- 11, // 7: bytebase.v1.Sheet.engine:type_name -> bytebase.v1.Engine
- 0, // 8: bytebase.v1.SheetPayload.type:type_name -> bytebase.v1.SheetPayload.Type
- 8, // 9: bytebase.v1.SheetPayload.commands:type_name -> bytebase.v1.SheetCommand
- 1, // 10: bytebase.v1.SheetService.CreateSheet:input_type -> bytebase.v1.CreateSheetRequest
- 2, // 11: bytebase.v1.SheetService.BatchCreateSheets:input_type -> bytebase.v1.BatchCreateSheetsRequest
- 4, // 12: bytebase.v1.SheetService.GetSheet:input_type -> bytebase.v1.GetSheetRequest
- 5, // 13: bytebase.v1.SheetService.UpdateSheet:input_type -> bytebase.v1.UpdateSheetRequest
- 6, // 14: bytebase.v1.SheetService.CreateSheet:output_type -> bytebase.v1.Sheet
- 3, // 15: bytebase.v1.SheetService.BatchCreateSheets:output_type -> bytebase.v1.BatchCreateSheetsResponse
- 6, // 16: bytebase.v1.SheetService.GetSheet:output_type -> bytebase.v1.Sheet
- 6, // 17: bytebase.v1.SheetService.UpdateSheet:output_type -> bytebase.v1.Sheet
- 14, // [14:18] is the sub-list for method output_type
- 10, // [10:14] is the sub-list for method input_type
- 10, // [10:10] is the sub-list for extension type_name
- 10, // [10:10] is the sub-list for extension extendee
- 0, // [0:10] is the sub-list for field type_name
+ 5, // 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
}
func init() { file_v1_sheet_service_proto_init() }
@@ -687,14 +570,13 @@ func file_v1_sheet_service_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_sheet_service_proto_rawDesc), len(file_v1_sheet_service_proto_rawDesc)),
- NumEnums: 1,
- NumMessages: 8,
+ NumEnums: 0,
+ NumMessages: 7,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_v1_sheet_service_proto_goTypes,
DependencyIndexes: file_v1_sheet_service_proto_depIdxs,
- EnumInfos: file_v1_sheet_service_proto_enumTypes,
MessageInfos: file_v1_sheet_service_proto_msgTypes,
}.Build()
File_v1_sheet_service_proto = out.File
diff --git a/backend/generated-go/v1/sheet_service_equal.pb.go b/backend/generated-go/v1/sheet_service_equal.pb.go
index 435fab88be..0c794de3b3 100644
--- a/backend/generated-go/v1/sheet_service_equal.pb.go
+++ b/backend/generated-go/v1/sheet_service_equal.pb.go
@@ -143,9 +143,6 @@ func (x *SheetPayload) Equal(y *SheetPayload) bool {
if x == nil || y == nil {
return x == nil && y == nil
}
- if x.Type != y.Type {
- return false
- }
if len(x.Commands) != len(y.Commands) {
return false
}
@@ -156,19 +153,3 @@ func (x *SheetPayload) Equal(y *SheetPayload) bool {
}
return true
}
-
-func (x *SheetCommand) Equal(y *SheetCommand) bool {
- if x == y {
- return true
- }
- if x == nil || y == nil {
- return x == nil && y == nil
- }
- if x.Start != y.Start {
- return false
- }
- if x.End != y.End {
- return false
- }
- return true
-}
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 0a33e9a036..493440970f 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
@@ -2,10 +2,10 @@
// @generated from file v1/sheet_service.proto (package bytebase.v1, syntax proto3)
/* eslint-disable */
-import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
+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 { Engine } from "./common_pb";
+import type { Engine, Range } from "./common_pb";
/**
* Describes the file v1/sheet_service.proto.
@@ -197,7 +197,7 @@ export declare type Sheet = Message<"bytebase.v1.Sheet"> & {
contentSize: bigint;
/**
- * Additional metadata and configuration for the sheet.
+ * Parsed metadata about SQL commands in the sheet.
*
* @generated from field: bytebase.v1.SheetPayload payload = 13;
*/
@@ -221,17 +221,12 @@ export declare const SheetSchema: GenMessage<Sheet>;
* @generated from message bytebase.v1.SheetPayload
*/
export declare type SheetPayload = Message<"bytebase.v1.SheetPayload"> & {
- /**
- * @generated from field: bytebase.v1.SheetPayload.Type type = 1;
- */
- type: SheetPayload_Type;
-
/**
* The start and end position of each command in the sheet statement.
*
- * @generated from field: repeated bytebase.v1.SheetCommand commands = 4;
+ * @generated from field: repeated bytebase.v1.Range commands = 4;
*/
- commands: SheetCommand[];
+ commands: Range[];
};
/**
@@ -240,49 +235,6 @@ export declare type SheetPayload = Message<"bytebase.v1.SheetPayload"> & {
*/
export declare const SheetPayloadSchema: GenMessage<SheetPayload>;
-/**
- * Type of the SheetPayload.
- *
- * @generated from enum bytebase.v1.SheetPayload.Type
- */
-export enum SheetPayload_Type {
- /**
- * @generated from enum value: TYPE_UNSPECIFIED = 0;
- */
- TYPE_UNSPECIFIED = 0,
-
- /**
- * @generated from enum value: SCHEMA_DESIGN = 1;
- */
- SCHEMA_DESIGN = 1,
-}
-
-/**
- * Describes the enum bytebase.v1.SheetPayload.Type.
- */
-export declare const SheetPayload_TypeSchema: GenEnum<SheetPayload_Type>;
-
-/**
- * @generated from message bytebase.v1.SheetCommand
- */
-export declare type SheetCommand = Message<"bytebase.v1.SheetCommand"> & {
- /**
- * @generated from field: int32 start = 1;
- */
- start: number;
-
- /**
- * @generated from field: int32 end = 2;
- */
- end: number;
-};
-
-/**
- * Describes the message bytebase.v1.SheetCommand.
- * Use `create(SheetCommandSchema)` to create a new message.
- */
-export declare const SheetCommandSchema: GenMessage<SheetCommand>;
-
/**
* SheetService manages SQL scripts and saved queries.
*
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 37831efe2e..12645e6b7b 100644
--- a/frontend/src/types/proto-es/v1/sheet_service_pb.js
+++ b/frontend/src/types/proto-es/v1/sheet_service_pb.js
@@ -2,7 +2,7 @@
// @generated from file v1/sheet_service.proto (package bytebase.v1, syntax proto3)
/* eslint-disable */
-import { enumDesc, fileDesc, messageDesc, serviceDesc, tsEnum } from "@bufbuild/protobuf/codegenv2";
+import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
import { file_buf_validate_validate } from "../buf/validate/validate_pb";
import { file_google_api_annotations } from "../google/api/annotations_pb";
import { file_google_api_client } from "../google/api/client_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("ChZ2MS9zaGVldF9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSJqChJDcm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iX9pBEXNoZWV0LHVwZGF0ZV9tYXNriuowEGJiLnNoZWV0cy51cGRhdGWQ6jABgtPkkwItOgVzaGVldDIkL3YxL3tzaGVldC5uYW1lPXByb2plY3RzLyovc2hlZXRzLyp9QqcBCg9jb20uYnl0ZWJhc2UudjFCEVNoZWV0U2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [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+kEWChRieXRlYmFzZS5jb20vUHJvamVjdBI2CghyZXF1ZXN0cxgCIAMoCzIfLmJ5dGViYXNlLnYxLkNyZWF0ZVNoZWV0UmVxdWVzdEID4EECIj8KGUJhdGNoQ3JlYXRlU2hlZXRzUmVzcG9uc2USIgoGc2hlZXRzGAEgAygLMhIuYnl0ZWJhc2UudjEuU2hlZXQiSAoPR2V0U2hlZXRSZXF1ZXN0EigKBG5hbWUYASABKAlCGuBBAvpBFAoSYnl0ZWJhc2UuY29tL1NoZWV0EgsKA3JhdxgCIAEoCCKEAQoSVXBkYXRlU2hlZXRS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0cy5jcmVhdGWQ6jABgtPkkwIvOgEqIiovdjEve3BhcmVudD1wcm9qZWN0cy8qfS9zaGVldHM6YmF0Y2hDcmVhdGUSgAEKCEdldFNoZWV0EhwuYnl0ZWJhc2UudjEuR2V0U2hlZXRSZXF1ZXN0GhIuYnl0ZWJhc2UudjEuU2hlZXQiQtpBBG5hbWWK6jANYmIuc2hlZXRzLmdldJDqMAGC0+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]);
/**
* Describes the message bytebase.v1.CreateSheetRequest.
@@ -67,27 +67,6 @@ export const SheetSchema = /*@__PURE__*/
export const SheetPayloadSchema = /*@__PURE__*/
messageDesc(file_v1_sheet_service, 6);
-/**
- * Describes the enum bytebase.v1.SheetPayload.Type.
- */
-export const SheetPayload_TypeSchema = /*@__PURE__*/
- enumDesc(file_v1_sheet_service, 6, 0);
-
-/**
- * Type of the SheetPayload.
- *
- * @generated from enum bytebase.v1.SheetPayload.Type
- */
-export const SheetPayload_Type = /*@__PURE__*/
- tsEnum(SheetPayload_TypeSchema);
-
-/**
- * Describes the message bytebase.v1.SheetCommand.
- * Use `create(SheetCommandSchema)` to create a new message.
- */
-export const SheetCommandSchema = /*@__PURE__*/
- messageDesc(file_v1_sheet_service, 7);
-
/**
* SheetService manages SQL scripts and saved queries.
*
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index b9fb3608fb..238f88cea1 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -14210,9 +14210,10 @@ components:
type: string
description: content_size is the full size of the content, may not match the size of the `content` field.
payload:
+ readOnly: true
allOf:
- $ref: '#/components/schemas/SheetPayload'
- description: Additional metadata and configuration for the sheet.
+ description: Parsed metadata about SQL commands in the sheet.
engine:
enum:
- ENGINE_UNSPECIFIED
@@ -14244,28 +14245,13 @@ components:
type: string
description: The SQL dialect.
format: enum
- SheetCommand:
- type: object
- properties:
- start:
- type: integer
- format: int32
- end:
- type: integer
- format: int32
SheetPayload:
type: object
properties:
- type:
- enum:
- - TYPE_UNSPECIFIED
- - SCHEMA_DESIGN
- type: string
- format: enum
commands:
type: array
items:
- $ref: '#/components/schemas/SheetCommand'
+ $ref: '#/components/schemas/Range'
description: The start and end position of each command in the sheet statement.
SpatialIndexConfig:
type: object
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index a5ff4efa66..ac1eada1ef 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -655,12 +655,9 @@
- [CreateSheetRequest](#bytebase-v1-CreateSheetRequest)
- [GetSheetRequest](#bytebase-v1-GetSheetRequest)
- [Sheet](#bytebase-v1-Sheet)
- - [SheetCommand](#bytebase-v1-SheetCommand)
- [SheetPayload](#bytebase-v1-SheetPayload)
- [UpdateSheetRequest](#bytebase-v1-UpdateSheetRequest)
- - [SheetPayload.Type](#bytebase-v1-SheetPayload-Type)
-
- [SheetService](#bytebase-v1-SheetService)
- [v1/subscription_service.proto](#v1_subscription_service-proto)
@@ -10717,7 +10714,7 @@ RolloutService manages the execution of deployment plans.
| create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The create time of the sheet. |
| content | [bytes](#bytes) | | The content of the sheet. By default, it will be cut off, if it doesn&#39;t match the `content_size`, you can set the `raw` to true in GetSheet request to retrieve the full content. |
| content_size | [int64](#int64) | | content_size is the full size of the content, may not match the size of the `content` field. |
-| payload | [SheetPayload](#bytebase-v1-SheetPayload) | | Additional metadata and configuration for the sheet. |
+| payload | [SheetPayload](#bytebase-v1-SheetPayload) | | Parsed metadata about SQL commands in the sheet. |
| engine | [Engine](#bytebase-v1-Engine) | | The SQL dialect. |
@@ -10725,22 +10722,6 @@ RolloutService manages the execution of deployment plans.
-<a name="bytebase-v1-SheetCommand"></a>
-
-### SheetCommand
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| start | [int32](#int32) | | |
-| end | [int32](#int32) | | |
-
-
-
-
-
-
<a name="bytebase-v1-SheetPayload"></a>
### SheetPayload
@@ -10749,8 +10730,7 @@ RolloutService manages the execution of deployment plans.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| type | [SheetPayload.Type](#bytebase-v1-SheetPayload-Type) | | |
-| commands | [SheetCommand](#bytebase-v1-SheetCommand) | repeated | The start and end position of each command in the sheet statement. |
+| commands | [Range](#bytebase-v1-Range) | repeated | The start and end position of each command in the sheet statement. |
@@ -10777,18 +10757,6 @@ The sheet&#39;s `name` field is used to identify the sheet to update. Format: pr
-
-<a name="bytebase-v1-SheetPayload-Type"></a>
-
-### SheetPayload.Type
-Type of the SheetPayload.
-
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| TYPE_UNSPECIFIED | 0 | |
-| SCHEMA_DESIGN | 1 | |
-
-
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index e1f9a31653..ac670646a4 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -2680,10 +2680,6 @@
<a href="#bytebase.v1.Sheet"><span class="badge">M</span>Sheet</a>
</li>
- <li>
- <a href="#bytebase.v1.SheetCommand"><span class="badge">M</span>SheetCommand</a>
- </li>
-
<li>
<a href="#bytebase.v1.SheetPayload"><span class="badge">M</span>SheetPayload</a>
</li>
@@ -2693,10 +2689,6 @@
</li>
- <li>
- <a href="#bytebase.v1.SheetPayload.Type"><span class="badge">E</span>SheetPayload.Type</a>
- </li>
-
<li>
@@ -30042,7 +30034,7 @@ set the `raw` to true in GetSheet request to retrieve the full content. </p></td
<td>payload</td>
<td><a href="#bytebase.v1.SheetPayload">SheetPayload</a></td>
<td></td>
- <td><p>Additional metadata and configuration for the sheet. </p></td>
+ <td><p>Parsed metadata about SQL commands in the sheet. </p></td>
</tr>
<tr>
@@ -30059,37 +30051,6 @@ set the `raw` to true in GetSheet request to retrieve the full content. </p></td
- <h3 id="bytebase.v1.SheetCommand">SheetCommand</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>start</td>
- <td><a href="#int32">int32</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>end</td>
- <td><a href="#int32">int32</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
<h3 id="bytebase.v1.SheetPayload">SheetPayload</h3>
<p></p>
@@ -30100,16 +30061,9 @@ set the `raw` to true in GetSheet request to retrieve the full content. </p></td
</thead>
<tbody>
- <tr>
- <td>type</td>
- <td><a href="#bytebase.v1.SheetPayload.Type">SheetPayload.Type</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
<tr>
<td>commands</td>
- <td><a href="#bytebase.v1.SheetCommand">SheetCommand</a></td>
+ <td><a href="#bytebase.v1.Range">Range</a></td>
<td>repeated</td>
<td><p>The start and end position of each command in the sheet statement. </p></td>
</tr>
@@ -30170,29 +30124,6 @@ In this situation, `update_mask` is ignored. </p></td>
- <h3 id="bytebase.v1.SheetPayload.Type">SheetPayload.Type</h3>
- <p>Type of the SheetPayload.</p>
- <table class="enum-table">
- <thead>
- <tr><td>Name</td><td>Number</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>TYPE_UNSPECIFIED</td>
- <td>0</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>SCHEMA_DESIGN</td>
- <td>1</td>
- <td><p></p></td>
- </tr>
-
- </tbody>
- </table>
-
diff --git a/proto/v1/v1/sheet_service.proto b/proto/v1/v1/sheet_service.proto
index ecc2581fe6..8fd962c291 100644
--- a/proto/v1/v1/sheet_service.proto
+++ b/proto/v1/v1/sheet_service.proto
@@ -155,26 +155,14 @@ message Sheet {
// content_size is the full size of the content, may not match the size of the `content` field.
int64 content_size = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
- // Additional metadata and configuration for the sheet.
- SheetPayload payload = 13;
+ // Parsed metadata about SQL commands in the sheet.
+ SheetPayload payload = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
// The SQL dialect.
Engine engine = 14 [(google.api.field_behavior) = REQUIRED];
}
message SheetPayload {
- // Type of the SheetPayload.
- enum Type {
- TYPE_UNSPECIFIED = 0;
- SCHEMA_DESIGN = 1;
- }
- Type type = 1;
-
// The start and end position of each command in the sheet statement.
- repeated SheetCommand commands = 4;
-}
-
-message SheetCommand {
- int32 start = 1;
- int32 end = 2;
+ repeated Range commands = 4;
}