Skip to content

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

chore: store proto for branch (#9628)

Danny Xu9845ee7a4dc8
diff --git a/frontend/src/types/proto/store/branch.ts b/frontend/src/types/proto/store/branch.ts
new file mode 100644
index 0000000000..0695c2b81b
--- /dev/null
+++ b/frontend/src/types/proto/store/branch.ts
@@ -0,0 +1,215 @@
+/* eslint-disable */
+import Long from "long";
+import _m0 from "protobufjs/minimal";
+import { DatabaseConfig, DatabaseSchemaMetadata } from "./database";
+
+export const protobufPackage = "bytebase.store";
+
+export interface BranchSnapshot {
+ schema: string;
+ metadata: DatabaseSchemaMetadata | undefined;
+ databaseConfig: DatabaseConfig | undefined;
+}
+
+export interface BranchConfig {
+ /**
+ * The name of source database.
+ * Optional.
+ * Example: instances/instance-id/databases/database-name.
+ */
+ sourceDatabase: Long;
+ /**
+ * The name of the source branch.
+ * Optional.
+ * Example: projects/project-id/branches/branch-id.
+ */
+ sourceBranch: Long;
+}
+
+function createBaseBranchSnapshot(): BranchSnapshot {
+ return { schema: "", metadata: undefined, databaseConfig: undefined };
+}
+
+export const BranchSnapshot = {
+ encode(message: BranchSnapshot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.schema !== "") {
+ writer.uint32(10).string(message.schema);
+ }
+ if (message.metadata !== undefined) {
+ DatabaseSchemaMetadata.encode(message.metadata, writer.uint32(18).fork()).ldelim();
+ }
+ if (message.databaseConfig !== undefined) {
+ DatabaseConfig.encode(message.databaseConfig, writer.uint32(26).fork()).ldelim();
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): BranchSnapshot {
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseBranchSnapshot();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ if (tag !== 10) {
+ break;
+ }
+
+ message.schema = reader.string();
+ continue;
+ case 2:
+ if (tag !== 18) {
+ break;
+ }
+
+ message.metadata = DatabaseSchemaMetadata.decode(reader, reader.uint32());
+ continue;
+ case 3:
+ if (tag !== 26) {
+ break;
+ }
+
+ message.databaseConfig = DatabaseConfig.decode(reader, reader.uint32());
+ continue;
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skipType(tag & 7);
+ }
+ return message;
+ },
+
+ fromJSON(object: any): BranchSnapshot {
+ return {
+ schema: isSet(object.schema) ? globalThis.String(object.schema) : "",
+ metadata: isSet(object.metadata) ? DatabaseSchemaMetadata.fromJSON(object.metadata) : undefined,
+ databaseConfig: isSet(object.databaseConfig) ? DatabaseConfig.fromJSON(object.databaseConfig) : undefined,
+ };
+ },
+
+ toJSON(message: BranchSnapshot): unknown {
+ const obj: any = {};
+ if (message.schema !== "") {
+ obj.schema = message.schema;
+ }
+ if (message.metadata !== undefined) {
+ obj.metadata = DatabaseSchemaMetadata.toJSON(message.metadata);
+ }
+ if (message.databaseConfig !== undefined) {
+ obj.databaseConfig = DatabaseConfig.toJSON(message.databaseConfig);
+ }
+ return obj;
+ },
+
+ create(base?: DeepPartial<BranchSnapshot>): BranchSnapshot {
+ return BranchSnapshot.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<BranchSnapshot>): BranchSnapshot {
+ const message = createBaseBranchSnapshot();
+ message.schema = object.schema ?? "";
+ message.metadata = (object.metadata !== undefined && object.metadata !== null)
+ ? DatabaseSchemaMetadata.fromPartial(object.metadata)
+ : undefined;
+ message.databaseConfig = (object.databaseConfig !== undefined && object.databaseConfig !== null)
+ ? DatabaseConfig.fromPartial(object.databaseConfig)
+ : undefined;
+ return message;
+ },
+};
+
+function createBaseBranchConfig(): BranchConfig {
+ return { sourceDatabase: Long.ZERO, sourceBranch: Long.ZERO };
+}
+
+export const BranchConfig = {
+ encode(message: BranchConfig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (!message.sourceDatabase.isZero()) {
+ writer.uint32(8).int64(message.sourceDatabase);
+ }
+ if (!message.sourceBranch.isZero()) {
+ writer.uint32(16).int64(message.sourceBranch);
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): BranchConfig {
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseBranchConfig();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ if (tag !== 8) {
+ break;
+ }
+
+ message.sourceDatabase = reader.int64() as Long;
+ continue;
+ case 2:
+ if (tag !== 16) {
+ break;
+ }
+
+ message.sourceBranch = reader.int64() as Long;
+ continue;
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skipType(tag & 7);
+ }
+ return message;
+ },
+
+ fromJSON(object: any): BranchConfig {
+ return {
+ sourceDatabase: isSet(object.sourceDatabase) ? Long.fromValue(object.sourceDatabase) : Long.ZERO,
+ sourceBranch: isSet(object.sourceBranch) ? Long.fromValue(object.sourceBranch) : Long.ZERO,
+ };
+ },
+
+ toJSON(message: BranchConfig): unknown {
+ const obj: any = {};
+ if (!message.sourceDatabase.isZero()) {
+ obj.sourceDatabase = (message.sourceDatabase || Long.ZERO).toString();
+ }
+ if (!message.sourceBranch.isZero()) {
+ obj.sourceBranch = (message.sourceBranch || Long.ZERO).toString();
+ }
+ return obj;
+ },
+
+ create(base?: DeepPartial<BranchConfig>): BranchConfig {
+ return BranchConfig.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<BranchConfig>): BranchConfig {
+ const message = createBaseBranchConfig();
+ message.sourceDatabase = (object.sourceDatabase !== undefined && object.sourceDatabase !== null)
+ ? Long.fromValue(object.sourceDatabase)
+ : Long.ZERO;
+ message.sourceBranch = (object.sourceBranch !== undefined && object.sourceBranch !== null)
+ ? Long.fromValue(object.sourceBranch)
+ : Long.ZERO;
+ return message;
+ },
+};
+
+type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
+
+export type DeepPartial<T> = T extends Builtin ? T
+ : T extends Long ? string | number | Long : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
+ : Partial<T>;
+
+if (_m0.util.Long !== Long) {
+ _m0.util.Long = Long as any;
+ _m0.configure();
+}
+
+function isSet(value: any): boolean {
+ return value !== null && value !== undefined;
+}
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index ee4cb24a1a..383b47574b 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -28,20 +28,6 @@
- [ActivityIssueCommentCreatePayload.ExternalApprovalEvent.Action](#bytebase-store-ActivityIssueCommentCreatePayload-ExternalApprovalEvent-Action)
- [ActivityIssueCommentCreatePayload.ExternalApprovalEvent.Type](#bytebase-store-ActivityIssueCommentCreatePayload-ExternalApprovalEvent-Type)
-- [store/changelist.proto](#store_changelist-proto)
- - [Changelist](#bytebase-store-Changelist)
- - [Changelist.Change](#bytebase-store-Changelist-Change)
-
-- [store/common.proto](#store_common-proto)
- - [PageToken](#bytebase-store-PageToken)
-
- - [Engine](#bytebase-store-Engine)
- - [MaskingLevel](#bytebase-store-MaskingLevel)
- - [VcsType](#bytebase-store-VcsType)
-
-- [store/data_source.proto](#store_data_source-proto)
- - [DataSourceOptions](#bytebase-store-DataSourceOptions)
-
- [store/database.proto](#store_database-proto)
- [ColumnConfig](#bytebase-store-ColumnConfig)
- [ColumnConfig.LabelsEntry](#bytebase-store-ColumnConfig-LabelsEntry)
@@ -72,6 +58,24 @@
- [TablePartitionMetadata.Type](#bytebase-store-TablePartitionMetadata-Type)
- [TaskMetadata.State](#bytebase-store-TaskMetadata-State)
+- [store/branch.proto](#store_branch-proto)
+ - [BranchConfig](#bytebase-store-BranchConfig)
+ - [BranchSnapshot](#bytebase-store-BranchSnapshot)
+
+- [store/changelist.proto](#store_changelist-proto)
+ - [Changelist](#bytebase-store-Changelist)
+ - [Changelist.Change](#bytebase-store-Changelist-Change)
+
+- [store/common.proto](#store_common-proto)
+ - [PageToken](#bytebase-store-PageToken)
+
+ - [Engine](#bytebase-store-Engine)
+ - [MaskingLevel](#bytebase-store-MaskingLevel)
+ - [VcsType](#bytebase-store-VcsType)
+
+- [store/data_source.proto](#store_data_source-proto)
+ - [DataSourceOptions](#bytebase-store-DataSourceOptions)
+
- [store/idp.proto](#store_idp-proto)
- [FieldMapping](#bytebase-store-FieldMapping)
- [IdentityProviderConfig](#bytebase-store-IdentityProviderConfig)
@@ -544,181 +548,6 @@ convert to the expected struct there.
-<a name="store_changelist-proto"></a>
-<p align="right"><a href="#top">Top</a></p>
-
-## store/changelist.proto
-
-
-
-<a name="bytebase-store-Changelist"></a>
-
-### Changelist
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| description | [string](#string) | | |
-| changes | [Changelist.Change](#bytebase-store-Changelist-Change) | repeated | |
-
-
-
-
-
-
-<a name="bytebase-store-Changelist-Change"></a>
-
-### Changelist.Change
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| sheet | [string](#string) | | The name of a sheet. |
-| source | [string](#string) | | The source of origin. 1) change history: instances/{instance}/databases/{database}/changeHistories/{changeHistory}. 2) branch: projects/{project}/schemaDesigns/{schemaDesign}. 3) raw SQL if empty. |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<a name="store_common-proto"></a>
-<p align="right"><a href="#top">Top</a></p>
-
-## store/common.proto
-
-
-
-<a name="bytebase-store-PageToken"></a>
-
-### PageToken
-Used internally for obfuscating the page token.
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| limit | [int32](#int32) | | |
-| offset | [int32](#int32) | | |
-
-
-
-
-
-
-
-
-<a name="bytebase-store-Engine"></a>
-
-### Engine
-
-
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| ENGINE_UNSPECIFIED | 0 | |
-| CLICKHOUSE | 1 | |
-| MYSQL | 2 | |
-| POSTGRES | 3 | |
-| SNOWFLAKE | 4 | |
-| SQLITE | 5 | |
-| TIDB | 6 | |
-| MONGODB | 7 | |
-| REDIS | 8 | |
-| ORACLE | 9 | |
-| SPANNER | 10 | |
-| MSSQL | 11 | |
-| REDSHIFT | 12 | |
-| MARIADB | 13 | |
-| OCEANBASE | 14 | |
-| DM | 15 | |
-| RISINGWAVE | 16 | |
-| OCEANBASE_ORACLE | 17 | |
-
-
-
-<a name="bytebase-store-MaskingLevel"></a>
-
-### MaskingLevel
-
-
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| MASKING_LEVEL_UNSPECIFIED | 0 | |
-| NONE | 1 | |
-| PARTIAL | 2 | |
-| FULL | 3 | |
-
-
-
-<a name="bytebase-store-VcsType"></a>
-
-### VcsType
-
-
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| VCS_TYPE_UNSPECIFIED | 0 | |
-| GITLAB | 1 | |
-| GITHUB | 2 | |
-| BITBUCKET | 3 | |
-
-
-
-
-
-
-
-
-
-
-<a name="store_data_source-proto"></a>
-<p align="right"><a href="#top">Top</a></p>
-
-## store/data_source.proto
-
-
-
-<a name="bytebase-store-DataSourceOptions"></a>
-
-### DataSourceOptions
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| srv | [bool](#bool) | | srv is a boolean flag that indicates whether the host is a DNS SRV record. |
-| authentication_database | [string](#string) | | authentication_database is the database name to authenticate against, which stores the user credentials. |
-| sid | [string](#string) | | sid and service_name are used for Oracle. |
-| service_name | [string](#string) | | |
-| ssh_host | [string](#string) | | SSH related The hostname of the SSH server agent. |
-| ssh_port | [string](#string) | | The port of the SSH server agent. It&#39;s 22 typically. |
-| ssh_user | [string](#string) | | The user to login the server. |
-| ssh_obfuscated_password | [string](#string) | | The password to login the server. If it&#39;s empty string, no password is required. |
-| ssh_obfuscated_private_key | [string](#string) | | The private key to login the server. If it&#39;s empty string, we will use the system default private key from os.Getenv(&#34;SSH_AUTH_SOCK&#34;). |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<a name="store_database-proto"></a>
<p align="right"><a href="#top">Top</a></p>
@@ -1222,6 +1051,230 @@ ViewMetadata is the metadata for views.
+<a name="store_branch-proto"></a>
+<p align="right"><a href="#top">Top</a></p>
+
+## store/branch.proto
+
+
+
+<a name="bytebase-store-BranchConfig"></a>
+
+### BranchConfig
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| source_database | [int64](#int64) | | The name of source database. Optional. Example: instances/instance-id/databases/database-name. |
+| source_branch | [int64](#int64) | | The name of the source branch. Optional. Example: projects/project-id/branches/branch-id. |
+
+
+
+
+
+
+<a name="bytebase-store-BranchSnapshot"></a>
+
+### BranchSnapshot
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| schema | [string](#string) | | |
+| metadata | [DatabaseSchemaMetadata](#bytebase-store-DatabaseSchemaMetadata) | | |
+| database_config | [DatabaseConfig](#bytebase-store-DatabaseConfig) | | |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<a name="store_changelist-proto"></a>
+<p align="right"><a href="#top">Top</a></p>
+
+## store/changelist.proto
+
+
+
+<a name="bytebase-store-Changelist"></a>
+
+### Changelist
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| description | [string](#string) | | |
+| changes | [Changelist.Change](#bytebase-store-Changelist-Change) | repeated | |
+
+
+
+
+
+
+<a name="bytebase-store-Changelist-Change"></a>
+
+### Changelist.Change
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| sheet | [string](#string) | | The name of a sheet. |
+| source | [string](#string) | | The source of origin. 1) change history: instances/{instance}/databases/{database}/changeHistories/{changeHistory}. 2) branch: projects/{project}/schemaDesigns/{schemaDesign}. 3) raw SQL if empty. |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<a name="store_common-proto"></a>
+<p align="right"><a href="#top">Top</a></p>
+
+## store/common.proto
+
+
+
+<a name="bytebase-store-PageToken"></a>
+
+### PageToken
+Used internally for obfuscating the page token.
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| limit | [int32](#int32) | | |
+| offset | [int32](#int32) | | |
+
+
+
+
+
+
+
+
+<a name="bytebase-store-Engine"></a>
+
+### Engine
+
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| ENGINE_UNSPECIFIED | 0 | |
+| CLICKHOUSE | 1 | |
+| MYSQL | 2 | |
+| POSTGRES | 3 | |
+| SNOWFLAKE | 4 | |
+| SQLITE | 5 | |
+| TIDB | 6 | |
+| MONGODB | 7 | |
+| REDIS | 8 | |
+| ORACLE | 9 | |
+| SPANNER | 10 | |
+| MSSQL | 11 | |
+| REDSHIFT | 12 | |
+| MARIADB | 13 | |
+| OCEANBASE | 14 | |
+| DM | 15 | |
+| RISINGWAVE | 16 | |
+| OCEANBASE_ORACLE | 17 | |
+
+
+
+<a name="bytebase-store-MaskingLevel"></a>
+
+### MaskingLevel
+
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| MASKING_LEVEL_UNSPECIFIED | 0 | |
+| NONE | 1 | |
+| PARTIAL | 2 | |
+| FULL | 3 | |
+
+
+
+<a name="bytebase-store-VcsType"></a>
+
+### VcsType
+
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| VCS_TYPE_UNSPECIFIED | 0 | |
+| GITLAB | 1 | |
+| GITHUB | 2 | |
+| BITBUCKET | 3 | |
+
+
+
+
+
+
+
+
+
+
+<a name="store_data_source-proto"></a>
+<p align="right"><a href="#top">Top</a></p>
+
+## store/data_source.proto
+
+
+
+<a name="bytebase-store-DataSourceOptions"></a>
+
+### DataSourceOptions
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| srv | [bool](#bool) | | srv is a boolean flag that indicates whether the host is a DNS SRV record. |
+| authentication_database | [string](#string) | | authentication_database is the database name to authenticate against, which stores the user credentials. |
+| sid | [string](#string) | | sid and service_name are used for Oracle. |
+| service_name | [string](#string) | | |
+| ssh_host | [string](#string) | | SSH related The hostname of the SSH server agent. |
+| ssh_port | [string](#string) | | The port of the SSH server agent. It&#39;s 22 typically. |
+| ssh_user | [string](#string) | | The user to login the server. |
+| ssh_obfuscated_password | [string](#string) | | The password to login the server. If it&#39;s empty string, no password is required. |
+| ssh_obfuscated_private_key | [string](#string) | | The private key to login the server. If it&#39;s empty string, we will use the system default private key from os.Getenv(&#34;SSH_AUTH_SOCK&#34;). |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<a name="store_idp-proto"></a>
<p align="right"><a href="#top">Top</a></p>
diff --git a/proto/generated-go/store/branch.pb.go b/proto/generated-go/store/branch.pb.go
new file mode 100644
index 0000000000..62afc9d6fe
--- /dev/null
+++ b/proto/generated-go/store/branch.pb.go
@@ -0,0 +1,254 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.31.0
+// protoc (unknown)
+// source: store/branch.proto
+
+package store
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type BranchSnapshot struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Schema string `protobuf:"bytes,1,opt,name=schema,proto3" json:"schema,omitempty"`
+ Metadata *DatabaseSchemaMetadata `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata,omitempty"`
+ DatabaseConfig *DatabaseConfig `protobuf:"bytes,3,opt,name=database_config,json=databaseConfig,proto3" json:"database_config,omitempty"`
+}
+
+func (x *BranchSnapshot) Reset() {
+ *x = BranchSnapshot{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_store_branch_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *BranchSnapshot) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*BranchSnapshot) ProtoMessage() {}
+
+func (x *BranchSnapshot) ProtoReflect() protoreflect.Message {
+ mi := &file_store_branch_proto_msgTypes[0]
+ 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 BranchSnapshot.ProtoReflect.Descriptor instead.
+func (*BranchSnapshot) Descriptor() ([]byte, []int) {
+ return file_store_branch_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *BranchSnapshot) GetSchema() string {
+ if x != nil {
+ return x.Schema
+ }
+ return ""
+}
+
+func (x *BranchSnapshot) GetMetadata() *DatabaseSchemaMetadata {
+ if x != nil {
+ return x.Metadata
+ }
+ return nil
+}
+
+func (x *BranchSnapshot) GetDatabaseConfig() *DatabaseConfig {
+ if x != nil {
+ return x.DatabaseConfig
+ }
+ return nil
+}
+
+type BranchConfig struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The name of source database.
+ // Optional.
+ // Example: instances/instance-id/databases/database-name.
+ SourceDatabase int64 `protobuf:"varint,1,opt,name=source_database,json=sourceDatabase,proto3" json:"source_database,omitempty"`
+ // The name of the source branch.
+ // Optional.
+ // Example: projects/project-id/branches/branch-id.
+ SourceBranch int64 `protobuf:"varint,2,opt,name=source_branch,json=sourceBranch,proto3" json:"source_branch,omitempty"`
+}
+
+func (x *BranchConfig) Reset() {
+ *x = BranchConfig{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_store_branch_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *BranchConfig) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*BranchConfig) ProtoMessage() {}
+
+func (x *BranchConfig) ProtoReflect() protoreflect.Message {
+ mi := &file_store_branch_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 BranchConfig.ProtoReflect.Descriptor instead.
+func (*BranchConfig) Descriptor() ([]byte, []int) {
+ return file_store_branch_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *BranchConfig) GetSourceDatabase() int64 {
+ if x != nil {
+ return x.SourceDatabase
+ }
+ return 0
+}
+
+func (x *BranchConfig) GetSourceBranch() int64 {
+ if x != nil {
+ return x.SourceBranch
+ }
+ return 0
+}
+
+var File_store_branch_proto protoreflect.FileDescriptor
+
+var file_store_branch_proto_rawDesc = []byte{
+ 0x0a, 0x12, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x2e, 0x70,
+ 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73,
+ 0x74, 0x6f, 0x72, 0x65, 0x1a, 0x14, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x64, 0x61, 0x74, 0x61,
+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb5, 0x01, 0x0a, 0x0e, 0x42,
+ 0x72, 0x61, 0x6e, 0x63, 0x68, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x12, 0x16, 0x0a,
+ 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73,
+ 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x42, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
+ 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
+ 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73,
+ 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52,
+ 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x47, 0x0a, 0x0f, 0x64, 0x61, 0x74,
+ 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74,
+ 0x6f, 0x72, 0x65, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66,
+ 0x69, 0x67, 0x52, 0x0e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66,
+ 0x69, 0x67, 0x22, 0x5c, 0x0a, 0x0c, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x43, 0x6f, 0x6e, 0x66,
+ 0x69, 0x67, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x64, 0x61, 0x74,
+ 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x73, 0x6f, 0x75,
+ 0x72, 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x73,
+ 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x03, 0x52, 0x0c, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68,
+ 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 (
+ file_store_branch_proto_rawDescOnce sync.Once
+ file_store_branch_proto_rawDescData = file_store_branch_proto_rawDesc
+)
+
+func file_store_branch_proto_rawDescGZIP() []byte {
+ file_store_branch_proto_rawDescOnce.Do(func() {
+ file_store_branch_proto_rawDescData = protoimpl.X.CompressGZIP(file_store_branch_proto_rawDescData)
+ })
+ return file_store_branch_proto_rawDescData
+}
+
+var file_store_branch_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
+var file_store_branch_proto_goTypes = []interface{}{
+ (*BranchSnapshot)(nil), // 0: bytebase.store.BranchSnapshot
+ (*BranchConfig)(nil), // 1: bytebase.store.BranchConfig
+ (*DatabaseSchemaMetadata)(nil), // 2: bytebase.store.DatabaseSchemaMetadata
+ (*DatabaseConfig)(nil), // 3: bytebase.store.DatabaseConfig
+}
+var file_store_branch_proto_depIdxs = []int32{
+ 2, // 0: bytebase.store.BranchSnapshot.metadata:type_name -> bytebase.store.DatabaseSchemaMetadata
+ 3, // 1: bytebase.store.BranchSnapshot.database_config:type_name -> bytebase.store.DatabaseConfig
+ 2, // [2:2] is the sub-list for method output_type
+ 2, // [2:2] is the sub-list for method input_type
+ 2, // [2:2] is the sub-list for extension type_name
+ 2, // [2:2] is the sub-list for extension extendee
+ 0, // [0:2] is the sub-list for field type_name
+}
+
+func init() { file_store_branch_proto_init() }
+func file_store_branch_proto_init() {
+ if File_store_branch_proto != nil {
+ return
+ }
+ file_store_database_proto_init()
+ if !protoimpl.UnsafeEnabled {
+ file_store_branch_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*BranchSnapshot); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_store_branch_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*BranchConfig); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_store_branch_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 2,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_store_branch_proto_goTypes,
+ DependencyIndexes: file_store_branch_proto_depIdxs,
+ MessageInfos: file_store_branch_proto_msgTypes,
+ }.Build()
+ File_store_branch_proto = out.File
+ file_store_branch_proto_rawDesc = nil
+ file_store_branch_proto_goTypes = nil
+ file_store_branch_proto_depIdxs = nil
+}
diff --git a/proto/store/branch.proto b/proto/store/branch.proto
new file mode 100644
index 0000000000..8db2410fc7
--- /dev/null
+++ b/proto/store/branch.proto
@@ -0,0 +1,24 @@
+syntax = "proto3";
+
+package bytebase.store;
+
+import "store/database.proto";
+
+option go_package = "generated-go/store";
+
+message BranchSnapshot {
+ string schema = 1;
+ DatabaseSchemaMetadata metadata = 2;
+ DatabaseConfig database_config = 3;
+}
+
+message BranchConfig {
+ // The name of source database.
+ // Optional.
+ // Example: instances/instance-id/databases/database-name.
+ int64 source_database = 1;
+ // The name of the source branch.
+ // Optional.
+ // Example: projects/project-id/branches/branch-id.
+ int64 source_branch = 2;
+}