Skip to content

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

chore: refactoring diff metadata (#15024)

Danny Xu7ae7e45a93b4
diff --git a/backend/api/v1/branch_merge.go b/backend/api/v1/branch_merge.go
deleted file mode 100644
index 3a8d238cb8..0000000000
--- a/backend/api/v1/branch_merge.go
+++ /dev/null
@@ -1,2831 +0,0 @@
-package v1
-
-import (
- "fmt"
- "reflect"
- "regexp"
- "slices"
- "strconv"
- "strings"
-
- "github.com/google/go-cmp/cmp"
- "github.com/pkg/errors"
- "google.golang.org/protobuf/proto"
- "google.golang.org/protobuf/testing/protocmp"
- "google.golang.org/protobuf/types/known/timestamppb"
-
- "github.com/bytebase/bytebase/backend/plugin/db/mysql"
- "github.com/bytebase/bytebase/backend/plugin/db/tidb"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
-)
-
-var (
- currentTimestampRegexp = regexp.MustCompile(`(?mi)CURRENT_TIMESTAMP(\((?P<fsp>(\d+))?\))?`)
- nowRegexp = regexp.MustCompile(`(?mi)NOW(\((?P<fsp>(\d+))?\))?`)
-)
-
-type timestampDefaultValue interface {
- isTimeStampDefaultValue()
- getFsp() int
-}
-type currentTimestamp struct {
- // fsp is the fractional seconds precision.
- fsp int
-}
-
-func (*currentTimestamp) isTimeStampDefaultValue() {}
-
-func (c *currentTimestamp) getFsp() int { return c.fsp }
-
-type now struct {
- fsp int
-}
-
-func (*now) isTimeStampDefaultValue() {}
-
-func (n *now) getFsp() int { return n.fsp }
-
-func buildTimestampDefaultValue(input string) timestampDefaultValue {
- matches := currentTimestampRegexp.FindStringSubmatch(input)
- if matches != nil {
- for i, name := range currentTimestampRegexp.SubexpNames() {
- if name == "fsp" {
- if matches[i] != "" {
- fsp, err := strconv.ParseInt(matches[i], 10, 64)
- if err != nil {
- return nil
- }
- return &currentTimestamp{int(fsp)}
- }
- }
- }
- return &currentTimestamp{}
- }
-
- matches = nowRegexp.FindStringSubmatch(input)
- if matches != nil {
- for i, name := range nowRegexp.SubexpNames() {
- if name == "fsp" {
- if matches[i] != "" {
- fsp, err := strconv.ParseInt(matches[i], 10, 64)
- if err != nil {
- return nil
- }
- return &now{int(fsp)}
- }
- }
- }
- return &now{}
- }
-
- return nil
-}
-
-var (
- autoRandomRegexp = regexp.MustCompile(`(?mis)^AUTO_RANDOM(\(\s*(?P<shardBit>(\d+))?\s*(,\s*(?P<allocationRange>(\d+)))?\s*\))?`)
-)
-
-// https://docs.pingcap.com/tidb/stable/auto-random
-type autoRandomDefaultValue struct {
- shardBit int
- allocationRange int
-}
-
-func buildAutoRandomDefaultValue(input string) *autoRandomDefaultValue {
- matches := autoRandomRegexp.FindStringSubmatch(input)
- if matches != nil {
- result := &autoRandomDefaultValue{}
- for i, name := range autoRandomRegexp.SubexpNames() {
- if name == "shardBit" {
- if matches[i] != "" {
- shardBit, err := strconv.ParseInt(matches[i], 10, 64)
- if err != nil {
- return nil
- }
- result.shardBit = int(shardBit)
- }
- } else if name == "allocationRange" {
- if matches[i] != "" {
- allocationRange, err := strconv.ParseInt(matches[i], 10, 64)
- if err != nil {
- return nil
- }
- result.allocationRange = int(allocationRange)
- }
- }
- }
- return result
- }
-
- return nil
-}
-
-func isAutoRandomEquivalent(a, b *autoRandomDefaultValue) bool {
- if a == nil || b == nil {
- return (a == nil) == (b == nil)
- }
- // https://docs.pingcap.com/tidb/stable/auto-random
- canonicalShardBitA, canonicalShardBitB := a.shardBit, b.shardBit
- if canonicalShardBitA == 0 {
- canonicalShardBitA = 5
- }
- if canonicalShardBitB == 0 {
- canonicalShardBitB = 5
- }
-
- canonicalAllocationRangeA, canonicalAllocationRangeB := a.allocationRange, b.allocationRange
- if canonicalAllocationRangeA == 0 {
- canonicalAllocationRangeA = 64
- }
- if canonicalAllocationRangeB == 0 {
- canonicalAllocationRangeB = 64
- }
-
- return (canonicalShardBitA == canonicalShardBitB) && (canonicalAllocationRangeA == canonicalAllocationRangeB)
-}
-
-type diffAction string
-
-const (
- diffActionCreate diffAction = "CREATE"
- diffActionUpdate diffAction = "UPDATE"
- diffActionDrop diffAction = "DROP"
-)
-
-// tryMerge merges other metadata to current metadata, always returns a non-nil metadata if no error occurs.
-func tryMerge(ancestor, head, base *storepb.DatabaseSchemaMetadata, ancestorConfig *storepb.DatabaseConfig, headConfig, baseConfig *storepb.DatabaseConfig, engine storepb.Engine) (*storepb.DatabaseSchemaMetadata, *storepb.DatabaseConfig, error) {
- ancestor, head, base = proto.Clone(ancestor).(*storepb.DatabaseSchemaMetadata), proto.Clone(head).(*storepb.DatabaseSchemaMetadata), proto.Clone(base).(*storepb.DatabaseSchemaMetadata)
-
- if ancestor == nil {
- ancestor = &storepb.DatabaseSchemaMetadata{}
- }
-
- diffBetweenAncestorAndHead, err := diffMetadata(ancestor, head)
- if err != nil {
- return nil, nil, errors.Wrap(err, "failed to diff between ancestor and head")
- }
- configDiffBetweenAncestorAndHead := deriveUpdateInfoFromMetadataDiff(diffBetweenAncestorAndHead, headConfig)
-
- diffBetweenAncestorAndBase, err := diffMetadata(ancestor, base)
- if err != nil {
- return nil, nil, errors.Wrap(err, "failed to diff between ancestor and base")
- }
- configDiffBetweenAncestorAndBase := deriveUpdateInfoFromMetadataDiff(diffBetweenAncestorAndBase, baseConfig)
-
- if conflict, msg := diffBetweenAncestorAndBase.tryMerge(diffBetweenAncestorAndHead, engine); conflict {
- return nil, nil, errors.Errorf("merge conflict: %s", msg)
- }
- mergedUpdateInfoDiff, err := mergeUpdateInfoDiffRooNode(configDiffBetweenAncestorAndBase, configDiffBetweenAncestorAndHead)
- if err != nil {
- return nil, nil, errors.Wrap(err, "failed to merge update info diff")
- }
-
- if err := diffBetweenAncestorAndBase.applyDiffTo(ancestor); err != nil {
- return nil, nil, errors.Wrap(err, "failed to apply diff to target")
- }
-
- config := applyUpdateInfoDiffRootNode(mergedUpdateInfoDiff, ancestorConfig)
- // The updateInfoDiff do not contain the column config, align database config to add the column config.
- config = alignDatabaseConfig(ancestor, config)
- return ancestor, config, nil
-}
-
-type diffBaseNode struct {
- action diffAction
-}
-
-type metadataDiffRootNode struct {
- schemas map[string]*metadataDiffSchemaNode
-}
-
-// tryMerge merges other root node to current root node, stop and return error if conflict occurs.
-func (mr *metadataDiffRootNode) tryMerge(other *metadataDiffRootNode, engine storepb.Engine) (bool, string) {
- for _, schema := range mr.schemas {
- otherSchema, in := other.schemas[schema.name]
- if !in {
- continue
- }
- conflict, msg := schema.tryMerge(otherSchema, engine)
- if conflict {
- return true, msg
- }
- delete(other.schemas, schema.name)
- }
- // Append other schema to current root node.
- for _, otherSchema := range other.schemas {
- mr.schemas[otherSchema.name] = otherSchema
- }
- return false, ""
-}
-
-func (mr *metadataDiffRootNode) applyDiffTo(target *storepb.DatabaseSchemaMetadata) error {
- sortedSchemaNames := make([]string, 0, len(mr.schemas))
- for schemaName := range mr.schemas {
- sortedSchemaNames = append(sortedSchemaNames, schemaName)
- }
- slices.Sort(sortedSchemaNames)
- for _, schemaName := range sortedSchemaNames {
- schema := mr.schemas[schemaName]
- if err := schema.applyDiffTo(target); err != nil {
- return errors.Wrapf(err, "failed to apply diff to schema %q", schema.name)
- }
- }
- return nil
-}
-
-// Schema related.
-type metadataDiffSchemaNode struct {
- diffBaseNode
- name string
- //nolint
- base *storepb.SchemaMetadata
- head *storepb.SchemaMetadata
-
- tables map[string]*metadataDiffTableNode
- views map[string]*metadataDiffViewNode
- functions map[string]*metadataDiffFunctioNnode
- procedures map[string]*metadataDiffProcedureNode
-
- // SchemaMetadata contains other object types, likes function, view etc. But we do not support them yet.
-}
-
-func (n *metadataDiffSchemaNode) tryMerge(other *metadataDiffSchemaNode, engine storepb.Engine) (bool, string) {
- if other == nil {
- return true, "other node check conflict with schema node not be nil"
- }
-
- if n.name != other.name {
- return true, fmt.Sprintf("non-expected schema node pair, one is %s, the other is %s", n.name, other.name)
- }
- if n.action != other.action {
- return true, fmt.Sprintf("conflict schema action, one is %s, the other is %s", n.action, other.action)
- }
-
- if n.action == diffActionDrop {
- return false, ""
- }
-
- // if n.action == diffActionCreate {
- // // If two actions are CREATE both, we need to check the schema attributes is conflict.
- // // XXX: Expanding the schema attributes check if we support more attributes.
- // }
-
- // if n.action == diffActionUpdate {
- // // If two actions are UPDATE both, we need to check the schema attributes is conflict.
- // // XXX: Expanding the schema attributes check if we support more attributes.
- // }
-
- for tableName, tableNode := range n.tables {
- otherTableNode, in := other.tables[tableName]
- if !in {
- continue
- }
- conflict, msg := tableNode.tryMerge(otherTableNode, engine)
- if conflict {
- return true, msg
- }
- delete(other.tables, tableName)
- }
-
- for _, remainingTable := range other.tables {
- n.tables[remainingTable.name] = remainingTable
- }
-
- for viewName, viewNode := range n.views {
- otherViewNode, in := other.views[viewName]
- if !in {
- continue
- }
- conflict, msg := viewNode.tryMerge(otherViewNode)
- if conflict {
- return true, msg
- }
- delete(other.views, viewName)
- }
-
- for _, remainingView := range other.views {
- n.views[remainingView.name] = remainingView
- }
-
- for functionName, functionNode := range n.functions {
- otherFunctionNode, in := other.functions[functionName]
- if !in {
- continue
- }
- conflict, msg := functionNode.tryMerge(otherFunctionNode)
- if conflict {
- return true, msg
- }
- delete(other.functions, functionName)
- }
-
- for _, remainingFunction := range other.functions {
- n.functions[remainingFunction.name] = remainingFunction
- }
-
- for procedureName, procedureNode := range n.procedures {
- otherProcedureNode, in := other.procedures[procedureName]
- if !in {
- continue
- }
- conflict, msg := procedureNode.tryMerge(otherProcedureNode)
- if conflict {
- return true, msg
- }
- delete(other.procedures, procedureName)
- }
-
- return false, ""
-}
-
-func (n *metadataDiffSchemaNode) applyDiffTo(target *storepb.DatabaseSchemaMetadata) error {
- if target == nil {
- return errors.New("target must not be nil")
- }
-
- sortedTableNames := make([]string, 0, len(n.tables))
- for tableName := range n.tables {
- sortedTableNames = append(sortedTableNames, tableName)
- }
- slices.Sort(sortedTableNames)
-
- sortedViewNames := make([]string, 0, len(n.views))
- for viewName := range n.views {
- sortedViewNames = append(sortedViewNames, viewName)
- }
-
- sortedFunctionNames := make([]string, 0, len(n.functions))
- for functionName := range n.functions {
- sortedFunctionNames = append(sortedFunctionNames, functionName)
- }
-
- sortedProcedureNames := make([]string, 0, len(n.procedures))
- for procedureName := range n.procedures {
- sortedProcedureNames = append(sortedProcedureNames, procedureName)
- }
-
- switch n.action {
- case diffActionCreate:
- newSchema := &storepb.SchemaMetadata{
- Name: n.name,
- }
- for _, tableName := range sortedTableNames {
- table := n.tables[tableName]
- if err := table.applyDiffTo(newSchema); err != nil {
- return errors.Wrapf(err, "failed to apply diff to table %q", table.name)
- }
- }
- for _, viewName := range sortedViewNames {
- view := n.views[viewName]
- if err := view.applyDiffTo(newSchema); err != nil {
- return errors.Wrapf(err, "failed to apply diff to view %q", view.name)
- }
- }
- for _, functionName := range sortedFunctionNames {
- function := n.functions[functionName]
- if err := function.applyDiffTo(newSchema); err != nil {
- return errors.Wrapf(err, "failed to apply diff to function %q", function.name)
- }
- }
- for _, procedureName := range sortedProcedureNames {
- procedure := n.procedures[procedureName]
- if err := procedure.applyDiffTo(newSchema); err != nil {
- return errors.Wrapf(err, "failed to apply diff to procedure %q", procedure.name)
- }
- }
- target.Schemas = append(target.Schemas, newSchema)
- case diffActionDrop:
- for i, schema := range target.Schemas {
- if schema.Name == n.name {
- target.Schemas = append(target.Schemas[:i], target.Schemas[i+1:]...)
- break
- }
- }
- case diffActionUpdate:
- for idx, schema := range target.Schemas {
- if schema.Name == n.name {
- newSchema := &storepb.SchemaMetadata{
- Name: n.name,
- Tables: schema.Tables,
- Views: schema.Views,
- Functions: schema.Functions,
- Procedures: schema.Procedures,
- }
- for _, tableName := range sortedTableNames {
- table := n.tables[tableName]
- if err := table.applyDiffTo(newSchema); err != nil {
- return errors.Wrapf(err, "failed to apply diff to table %q", table.name)
- }
- }
- for _, viewName := range sortedViewNames {
- view := n.views[viewName]
- if err := view.applyDiffTo(newSchema); err != nil {
- return errors.Wrapf(err, "failed to apply diff to view %q", view.name)
- }
- }
- for _, functionName := range sortedFunctionNames {
- function := n.functions[functionName]
- if err := function.applyDiffTo(newSchema); err != nil {
- return errors.Wrapf(err, "failed to apply diff to function %q", function.name)
- }
- }
- for _, procedureName := range sortedProcedureNames {
- procedure := n.procedures[procedureName]
- if err := procedure.applyDiffTo(newSchema); err != nil {
- return errors.Wrapf(err, "failed to apply diff to procedure %q", procedure.name)
- }
- }
- target.Schemas[idx] = newSchema
- }
- }
- }
- return nil
-}
-
-// Table related.
-type metadataDiffTableNode struct {
- diffBaseNode
- name string
- //nolint
- base *storepb.TableMetadata
- head *storepb.TableMetadata
-
- // columnNames is designed to help to handle the column orders.
- // The size of columnNames is always equal to the size of columnsMap,
- // and all the value appeared in columnNames is also the key of columnsMap.
- columnNames []string
- columnsMap map[string]*metadataDiffColumnNode
-
- foreignKeys map[string]*metadataDiffForeignKeyNode
- indexes map[string]*metadataDiffIndexNode
- // TableMetaData contains other object types, likes trigger, index etc. But we do not support them yet.
-
- // partitionNames is designed to help to handle the partition orders.
- // The size of partitionNames is always equal to the size of partitionsMap,
- // and all the value appeared in partitionNames is also the key of partitionsMap.
- partitionNames []string
- partitionsMap map[string]*metadataDiffPartitionNode
-}
-
-func (n *metadataDiffTableNode) tryMerge(other *metadataDiffTableNode, engine storepb.Engine) (bool, string) {
- if other == nil {
- return true, "other node check conflict with table node must not be nil"
- }
-
- if n.name != other.name {
- return true, fmt.Sprintf("non-expected table node pair, one is %s, the other is %s", n.name, other.name)
- }
- if n.action != other.action {
- return true, fmt.Sprintf("conflict table action, one is %s, the other is %s", n.action, other.action)
- }
-
- if n.action == diffActionDrop {
- return false, ""
- }
-
- if n.action == diffActionCreate {
- // If two actions are CREATE or UPDATE both, we need to check the table attributes is conflict.
- // XXX: Expanding the table attributes check if we support more attributes.
- // Engine and Collation is the attributes are used to display only, would not
- // affect the table schema in schema design.
- if n.head.Comment != other.head.Comment {
- return true, fmt.Sprintf("conflict table comment, one is %s, the other is %s", n.head.Comment, other.head.Comment)
- }
- if n.head.UserComment != other.head.UserComment {
- return true, fmt.Sprintf("conflict table user comment, one is %s, the other is %s", n.head.UserComment, other.head.UserComment)
- }
- }
-
- if n.action == diffActionUpdate {
- // Engine and Collation is the attributes are used to display only, would not
- // affect the table schema in schema design.
- if other.base.Comment != other.head.Comment {
- if n.base.Comment != n.head.Comment {
- if n.head.Comment != other.head.Comment {
- return true, fmt.Sprintf("conflict table comment, one is %s, the other is %s", n.head.Comment, other.head.Comment)
- }
- } else {
- n.head.Comment = other.head.Comment
- }
- }
-
- if other.base.UserComment != other.head.UserComment {
- if n.base.UserComment != n.head.UserComment {
- if n.head.UserComment != other.head.UserComment {
- return true, fmt.Sprintf("conflict table user comment, one is %s, the other is %s", n.head.UserComment, other.head.UserComment)
- }
- } else {
- n.head.UserComment = other.head.UserComment
- }
- }
- }
-
- for _, columnName := range n.columnNames {
- columnNode := n.columnsMap[columnName]
- otherColumnNode, in := other.columnsMap[columnName]
- if !in {
- continue
- }
- conflict, msg := columnNode.tryMerge(otherColumnNode, engine)
- if conflict {
- return true, msg
- }
- delete(other.columnsMap, columnName)
- }
-
- for foreignKeyName, foreignKeyNode := range n.foreignKeys {
- otherForeignKeyNode, in := other.foreignKeys[foreignKeyName]
- if !in {
- continue
- }
- conflict, msg := foreignKeyNode.tryMerge(otherForeignKeyNode)
- if conflict {
- return true, msg
- }
- delete(other.foreignKeys, foreignKeyName)
- }
-
- for indexName, indexNode := range n.indexes {
- otherIndexNode, in := other.indexes[indexName]
- if !in {
- continue
- }
- conflict, msg := indexNode.tryMerge(otherIndexNode)
- if conflict {
- return true, msg
- }
- delete(other.indexes, indexName)
- }
-
- for _, partitionName := range n.partitionNames {
- partitionNode := n.partitionsMap[partitionName]
- otherPartitionNode, in := other.partitionsMap[partitionName]
- if !in {
- continue
- }
- conflict, msg := partitionNode.tryMerge(otherPartitionNode)
- if conflict {
- return true, msg
- }
- delete(other.partitionsMap, partitionName)
- }
-
- for _, columnName := range other.columnNames {
- // We had deleted the column node which appeared in both table nodes.
- if columnNode, in := other.columnsMap[columnName]; in {
- n.columnsMap[columnName] = columnNode
- n.columnNames = append(n.columnNames, columnName)
- continue
- }
- }
-
- for _, partition := range other.partitionNames {
- // We had deleted the partition node which appeared in both table nodes.
- if partitionNode, in := other.partitionsMap[partition]; in {
- n.partitionsMap[partition] = partitionNode
- n.partitionNames = append(n.partitionNames, partition)
- continue
- }
- }
-
- for _, remainingForeignKey := range other.foreignKeys {
- n.foreignKeys[remainingForeignKey.name] = remainingForeignKey
- }
-
- for _, remainingIndex := range other.indexes {
- n.indexes[remainingIndex.name] = remainingIndex
- }
-
- return false, ""
-}
-
-func (n *metadataDiffTableNode) applyDiffTo(target *storepb.SchemaMetadata) error {
- if target == nil {
- return errors.New("target must not be nil")
- }
-
- sortedForeignKeyName := make([]string, 0, len(n.foreignKeys))
- for foreignKeyName := range n.foreignKeys {
- sortedForeignKeyName = append(sortedForeignKeyName, foreignKeyName)
- }
- slices.Sort(sortedForeignKeyName)
-
- sortedIndexName := make([]string, 0, len(n.indexes))
- for indexName := range n.indexes {
- sortedIndexName = append(sortedIndexName, indexName)
- }
- slices.Sort(sortedIndexName)
-
- switch n.action {
- case diffActionCreate:
- newTable := &storepb.TableMetadata{
- Name: n.name,
- Engine: n.head.Engine,
- Collation: n.head.Collation,
- Comment: n.head.Comment,
- UserComment: n.head.UserComment,
- }
- for _, columnName := range n.columnNames {
- if columnNode, in := n.columnsMap[columnName]; in {
- if err := columnNode.applyDiffTo(newTable); err != nil {
- return errors.Wrapf(err, "failed to apply diff to column %q", columnNode.name)
- }
- }
- }
-
- for _, foreignKeyName := range sortedForeignKeyName {
- foreignKey := n.foreignKeys[foreignKeyName]
- if err := foreignKey.applyDiffTo(newTable); err != nil {
- return errors.Wrapf(err, "failed to apply diff to foreign key %q", foreignKey.name)
- }
- }
- for _, indexName := range sortedIndexName {
- index := n.indexes[indexName]
- if err := index.applyDiffTo(newTable); err != nil {
- return errors.Wrapf(err, "failed to apply diff to index %q", index.name)
- }
- }
-
- for _, partitionName := range n.partitionNames {
- partition := n.partitionsMap[partitionName]
- if err := partition.applyDiffTo(newTable); err != nil {
- return errors.Wrapf(err, "failed to apply diff to partition %q", partition.name)
- }
- }
-
- target.Tables = append(target.Tables, newTable)
- case diffActionDrop:
- for i, table := range target.Tables {
- if table.Name == n.name {
- target.Tables = append(target.Tables[:i], target.Tables[i+1:]...)
- break
- }
- }
- case diffActionUpdate:
- for idx, table := range target.Tables {
- // Update table currently is only contains diff of columns, foreign keys and indexes.
- // So we do apply column and foreign key diff to target table.
- if table.Name == n.name {
- newTable := &storepb.TableMetadata{
- Name: n.name,
- Engine: n.head.Engine,
- Collation: n.head.Collation,
- Comment: n.head.Comment,
- UserComment: n.head.UserComment,
- Columns: table.Columns,
- ForeignKeys: table.ForeignKeys,
- Indexes: table.Indexes,
- Partitions: table.Partitions,
- }
- for _, columnName := range n.columnNames {
- if columnNode, in := n.columnsMap[columnName]; in {
- if err := columnNode.applyDiffTo(newTable); err != nil {
- return errors.Wrapf(err, "failed to apply diff to column %q", columnNode.name)
- }
- }
- }
- for _, foreignKeyName := range sortedForeignKeyName {
- foreignKey := n.foreignKeys[foreignKeyName]
- if err := foreignKey.applyDiffTo(newTable); err != nil {
- return errors.Wrapf(err, "failed to apply diff to foreign key %q", foreignKey.name)
- }
- }
- for _, indexName := range sortedIndexName {
- index := n.indexes[indexName]
- if err := index.applyDiffTo(newTable); err != nil {
- return errors.Wrapf(err, "failed to apply diff to index %q", index.name)
- }
- }
- for _, partitionName := range n.partitionNames {
- partition := n.partitionsMap[partitionName]
- if err := partition.applyDiffTo(newTable); err != nil {
- return errors.Wrapf(err, "failed to apply diff to partition %q", partition.name)
- }
- }
- target.Tables[idx] = newTable
- }
- }
- }
- return nil
-}
-
-// Column related.
-type metadataDiffColumnNode struct {
- diffBaseNode
- name string
- //nolint
- base *storepb.ColumnMetadata
- head *storepb.ColumnMetadata
-}
-
-func (n *metadataDiffColumnNode) tryMerge(other *metadataDiffColumnNode, engine storepb.Engine) (bool, string) {
- if other == nil {
- return true, "other node check conflict with column node must not be nil"
- }
-
- if n.name != other.name {
- return true, fmt.Sprintf("non-expected column node pair, one is %s, the other is %s", n.name, other.name)
- }
- if n.action != other.action {
- return true, fmt.Sprintf("conflict column action, one is %s, the other is %s", n.action, other.action)
- }
-
- if n.action == diffActionDrop {
- return false, ""
- }
-
- if n.action == diffActionCreate {
- if !isColumnTypeEqual(n.head.Type, other.head.Type, engine) {
- return true, fmt.Sprintf("conflict column type, one is %s, the other is %s", n.head.Type, other.head.Type)
- }
- if !compareColumnDefaultValue(n.head.DefaultValue, other.head.DefaultValue) {
- return true, fmt.Sprintf("conflict column default value, one is %+v, the other is %+v", n.head.DefaultValue, other.head.DefaultValue)
- }
- if n.head.Nullable != other.head.Nullable {
- return true, fmt.Sprintf("conflict column nullable, one is %t, the other is %t", n.head.Nullable, other.head.Nullable)
- }
- if n.head.Comment != other.head.Comment {
- return true, fmt.Sprintf("conflict column comment, one is %s, the other is %s", n.head.Comment, other.head.Comment)
- }
- if n.head.UserComment != other.head.UserComment {
- return true, fmt.Sprintf("conflict column user comment, one is %s, the other is %s", n.head.UserComment, other.head.UserComment)
- }
- }
- if n.action == diffActionUpdate {
- if !isColumnTypeEqual(other.base.Type, other.head.Type, engine) {
- if !isColumnTypeEqual(n.base.Type, n.head.Type, engine) {
- if !isColumnTypeEqual(n.head.Type, other.head.Type, engine) {
- return true, fmt.Sprintf("conflict column type, one is %s, the other is %s", n.head.Type, other.head.Type)
- }
- } else {
- n.head.Type = other.head.Type
- }
- }
-
- if !compareColumnDefaultValue(n.head.DefaultValue, other.head.DefaultValue) {
- if !compareColumnDefaultValue(n.base.DefaultValue, n.head.DefaultValue) {
- if !compareColumnDefaultValue(n.head.DefaultValue, other.head.DefaultValue) {
- return true, fmt.Sprintf("conflict column default value, one is %+v, the other is %+v", n.head.DefaultValue, other.head.DefaultValue)
- }
- } else {
- n.head.DefaultValue = other.head.DefaultValue
- }
- }
-
- if !compareColumnOnUpdateValue(n.head.OnUpdate, other.head.OnUpdate) {
- if !compareColumnOnUpdateValue(n.base.OnUpdate, n.head.OnUpdate) {
- if !compareColumnOnUpdateValue(n.head.OnUpdate, other.head.OnUpdate) {
- return true, fmt.Sprintf("conflict column onUpdate value, one is %+v, the other is %+v", n.head.OnUpdate, other.head.OnUpdate)
- }
- } else {
- n.head.OnUpdate = other.head.OnUpdate
- }
- }
-
- if other.base.Nullable != other.head.Nullable {
- if n.base.Nullable != n.head.Nullable {
- if n.head.Nullable != other.head.Nullable {
- return true, fmt.Sprintf("conflict column nullable, one is %t, the other is %t", n.head.Nullable, other.head.Nullable)
- }
- } else {
- n.head.Nullable = other.head.Nullable
- }
- }
-
- if other.base.Comment != other.head.Comment {
- if n.base.Comment != n.head.Comment {
- if n.head.Comment != other.head.Comment {
- return true, fmt.Sprintf("conflict column comment, one is %s, the other is %s", n.head.Comment, other.head.Comment)
- }
- } else {
- n.head.Comment = other.head.Comment
- }
- }
-
- if other.base.UserComment != other.head.UserComment {
- if n.base.UserComment != n.head.UserComment {
- if n.head.UserComment != other.head.UserComment {
- return true, fmt.Sprintf("conflict column user comment, one is %s, the other is %s", n.head.UserComment, other.head.UserComment)
- }
- } else {
- n.head.UserComment = other.head.UserComment
- }
- }
- }
-
- return false, ""
-}
-
-func compareColumnOnUpdateValue(a, b string) bool {
- // TODO(zp): The special case should be assosiacted with the engine type.
- aTimestampDefaultValue := buildTimestampDefaultValue(a)
- bTimestampDefaultValue := buildTimestampDefaultValue(b)
- if aTimestampDefaultValue != nil && bTimestampDefaultValue != nil {
- return aTimestampDefaultValue.getFsp() == bTimestampDefaultValue.getFsp()
- }
- return a == b
-}
-
-// To avoid getting caught up in the case struggle, we handle some special cases first.
-// compareColumnDefaultValue compares the default value of two columns.
-// The type of a, b should can be assigned to storepb.isColumnMetadata_DefaultValue.
-// return true if the default value of a and b are equal, otherwise return false.
-func compareColumnDefaultValue(a, b any) bool {
- // TODO(zp): The special case should be assosiacted with the engine type.
- aExpr, aOK := a.(*storepb.ColumnMetadata_DefaultExpression)
- bExpr, bOK := b.(*storepb.ColumnMetadata_DefaultExpression)
- if aOK && bOK {
- if strings.EqualFold(aExpr.DefaultExpression, "AUTO_INCREMENT") {
- return strings.EqualFold(bExpr.DefaultExpression, "AUTO_INCREMENT")
- }
- aTimestampDefaultValue := buildTimestampDefaultValue(aExpr.DefaultExpression)
- bTimestampDefaultValue := buildTimestampDefaultValue(bExpr.DefaultExpression)
- if aTimestampDefaultValue != nil && bTimestampDefaultValue != nil {
- return aTimestampDefaultValue.getFsp() == bTimestampDefaultValue.getFsp()
- }
-
- aAutoRandomDefaultValue := buildAutoRandomDefaultValue(aExpr.DefaultExpression)
- bAutoRandomDefaultValue := buildAutoRandomDefaultValue(bExpr.DefaultExpression)
- if aAutoRandomDefaultValue != nil && bAutoRandomDefaultValue != nil {
- return isAutoRandomEquivalent(aAutoRandomDefaultValue, bAutoRandomDefaultValue)
- }
- }
-
- r := cmp.Diff(a, b, protocmp.Transform())
-
- return r == ""
-}
-
-func (n *metadataDiffColumnNode) applyDiffTo(target *storepb.TableMetadata) error {
- // TODO(zp): handle the column position...
- switch n.action {
- case diffActionCreate:
- target.Columns = append(target.Columns, n.head)
- case diffActionDrop:
- for i, column := range target.Columns {
- if column.Name == n.name {
- target.Columns = append(target.Columns[:i], target.Columns[i+1:]...)
- break
- }
- }
- case diffActionUpdate:
- for i, column := range target.Columns {
- if column.Name == n.name {
- target.Columns[i] = n.head
- break
- }
- }
- }
- return nil
-}
-
-// Index related.
-type metadataDiffIndexNode struct {
- diffBaseNode
- name string
- //nolint
- base *storepb.IndexMetadata
- head *storepb.IndexMetadata
-}
-
-func (n *metadataDiffIndexNode) tryMerge(other *metadataDiffIndexNode) (bool, string) {
- if other == nil {
- return true, "other node check conflict with column node must not be nil"
- }
-
- if n.name != other.name {
- return true, fmt.Sprintf("non-expected index node pair, one is %s, the other is %s", n.name, other.name)
- }
- if n.action != other.action {
- return true, fmt.Sprintf("conflict index action, one is %s, the other is %s", n.action, other.action)
- }
- if n.action == diffActionDrop {
- return false, ""
- }
- if n.action == diffActionCreate {
- if !slices.Equal(n.head.Expressions, other.head.Expressions) {
- return true, fmt.Sprintf("conflict index expressions, one is %v, the other is %v", n.head.Expressions, other.head.Expressions)
- }
- if n.head.Type != other.head.Type {
- return true, fmt.Sprintf("conflict index type, one is %s, the other is %s", n.head.Type, other.head.Type)
- }
- if n.head.Unique != other.head.Unique {
- return true, fmt.Sprintf("conflict index unique, one is %t, the other is %t", n.head.Unique, other.head.Unique)
- }
- if n.head.Primary != other.head.Primary {
- return true, fmt.Sprintf("conflict index primary, one is %t, the other is %t", n.head.Primary, other.head.Primary)
- }
- }
-
- if n.action == diffActionUpdate {
- if !slices.Equal(other.base.Expressions, other.head.Expressions) {
- if !slices.Equal(n.base.Expressions, n.head.Expressions) {
- if !slices.Equal(n.head.Expressions, other.head.Expressions) {
- return true, fmt.Sprintf("conflict index expressions, one is %v, the other is %v", n.head.Expressions, other.head.Expressions)
- }
- } else {
- n.head.Expressions = other.head.Expressions
- }
- }
-
- if other.base.Type != other.head.Type {
- if n.base.Type != n.head.Type {
- if n.head.Type != other.head.Type {
- return true, fmt.Sprintf("conflict index type, one is %s, the other is %s", n.head.Type, other.head.Type)
- }
- } else {
- n.head.Type = other.head.Type
- }
- }
-
- if other.base.Unique != other.head.Unique {
- if n.base.Unique != n.head.Unique {
- if n.head.Unique != other.head.Unique {
- return true, fmt.Sprintf("conflict index unique, one is %t, the other is %t", n.head.Unique, other.head.Unique)
- }
- } else {
- n.head.Unique = other.head.Unique
- }
- }
-
- if other.base.Primary != other.head.Primary {
- if n.base.Primary != n.head.Primary {
- if n.head.Primary != other.head.Primary {
- return true, fmt.Sprintf("conflict index primary, one is %t, the other is %t", n.head.Primary, other.head.Primary)
- }
- } else {
- n.head.Primary = other.head.Primary
- }
- }
- }
-
- return false, ""
-}
-
-func (n *metadataDiffIndexNode) applyDiffTo(target *storepb.TableMetadata) error {
- switch n.action {
- case diffActionCreate:
- target.Indexes = append(target.Indexes, n.head)
- case diffActionDrop:
- for i, index := range target.Indexes {
- if index.Name == n.name {
- target.Indexes = append(target.Indexes[:i], target.Indexes[i+1:]...)
- break
- }
- }
- case diffActionUpdate:
- for i, index := range target.Indexes {
- if index.Name == n.name {
- target.Indexes[i] = n.head
- break
- }
- }
- }
- return nil
-}
-
-type metadataDiffPartitionNode struct {
- diffBaseNode
- name string
- // nolint
- base *storepb.TablePartitionMetadata
- head *storepb.TablePartitionMetadata
-
- // subpartitionNames is designed to help to handle the subpartition orders.
- subpartitionNames []string
- subpartitions map[string]*metadataDiffPartitionNode
-}
-
-func (n *metadataDiffPartitionNode) tryMerge(other *metadataDiffPartitionNode) (bool, string) {
- if other == nil {
- return true, "other node check conflict with partition node must not be nil"
- }
-
- if n.name != other.name {
- return true, fmt.Sprintf("non-expected partition node pair, one is %s, the other is %s", n.name, other.name)
- }
- if n.action != other.action {
- return true, fmt.Sprintf("conflict partition action, one is %s, the other is %s", n.action, other.action)
- }
- if n.action == diffActionDrop {
- return false, ""
- }
- if n.action == diffActionCreate {
- if n.head.Type != other.head.Type {
- return true, fmt.Sprintf("conflict partition type, one is %s, the other is %s", n.head.Type, other.head.Type)
- }
- if !isPartitionExprEqual(n.head.Expression, other.head.Expression) {
- return true, fmt.Sprintf("conflict partition expression, one is %s, the other is %s", n.head.Expression, other.head.Expression)
- }
- if n.head.Value != other.head.Value {
- return true, fmt.Sprintf("conflict partition value, one is %s, the other is %s", n.head.Value, other.head.Value)
- }
- }
-
- if n.action == diffActionUpdate {
- if other.base.Type != other.head.Type {
- if n.base.Type != n.head.Type {
- if n.head.Type != other.head.Type {
- return true, fmt.Sprintf("conflict partition type, one is %s, the other is %s", n.head.Type, other.head.Type)
- }
- } else {
- n.head.Type = other.head.Type
- }
- }
-
- if !isPartitionExprEqual(other.base.Expression, other.head.Expression) {
- if !isPartitionExprEqual(n.base.Expression, n.head.Expression) {
- if !isPartitionExprEqual(n.head.Expression, other.head.Expression) {
- return true, fmt.Sprintf("conflict partition expression, one is %s, the other is %s", n.head.Expression, other.head.Expression)
- }
- } else {
- n.head.Expression = other.head.Expression
- }
- }
-
- if other.base.Value != other.head.Value {
- if n.base.Value != n.head.Value {
- if n.head.Value != other.head.Value {
- return true, fmt.Sprintf("conflict partition value, one is %s, the other is %s", n.head.Value, other.head.Value)
- }
- } else {
- n.head.Value = other.head.Value
- }
- }
- }
-
- for _, subpartitionName := range n.subpartitionNames {
- subpartitionNode := n.subpartitions[subpartitionName]
- otherSubpartitionNode, in := other.subpartitions[subpartitionName]
- if !in {
- continue
- }
- conflict, msg := subpartitionNode.tryMerge(otherSubpartitionNode)
- if conflict {
- return true, msg
- }
- delete(other.subpartitions, subpartitionName)
- }
-
- for _, remainingSubpartition := range other.subpartitions {
- n.subpartitions[remainingSubpartition.name] = remainingSubpartition
- }
-
- return false, ""
-}
-
-func isPartitionExprEqual(a, b string) bool {
- ignoreTokens := []string{
- "`", " ", "\t", "\n", "\r", "(", ")",
- }
- for _, token := range ignoreTokens {
- a = strings.ReplaceAll(a, token, "")
- b = strings.ReplaceAll(b, token, "")
- }
- return strings.EqualFold(a, b)
-}
-
-func (n *metadataDiffPartitionNode) applyDiffTo(target *storepb.TableMetadata) error {
- switch n.action {
- case diffActionCreate:
- target.Partitions = append(target.Partitions, n.head)
- case diffActionDrop:
- for i, partition := range target.Partitions {
- if partition.Name == n.name {
- target.Partitions = append(target.Partitions[:i], target.Partitions[i+1:]...)
- break
- }
- }
- case diffActionUpdate:
- for i, partition := range target.Partitions {
- if partition.Name == n.name {
- target.Partitions[i] = n.head
- break
- }
- }
- }
- return nil
-}
-
-type metadataDiffFunctioNnode struct {
- diffBaseNode
- name string
- //nolint
- base *storepb.FunctionMetadata
- head *storepb.FunctionMetadata
-}
-
-func (n *metadataDiffFunctioNnode) tryMerge(other *metadataDiffFunctioNnode) (bool, string) {
- if other == nil {
- return true, "other node check conflict with function node must not be nil"
- }
-
- if n.name != other.name {
- return true, fmt.Sprintf("non-expected function node pair, one is %s, the other is %s", n.name, other.name)
- }
- if n.action != other.action {
- return true, fmt.Sprintf("conflict function action, one is %s, the other is %s", n.action, other.action)
- }
- if n.action == diffActionDrop {
- return false, ""
- }
- if n.action == diffActionCreate {
- nHeadDefinition := strings.TrimRight(n.head.Definition, ";")
- otherHeadDefinition := strings.TrimRight(other.head.Definition, ";")
- if !equalRoutineDefinition(nHeadDefinition, otherHeadDefinition) {
- return true, fmt.Sprintf("conflict function definition, one is %s, the other is %s", nHeadDefinition, otherHeadDefinition)
- }
- }
-
- if n.action == diffActionUpdate {
- otherBaseDefinition := strings.TrimRight(other.base.Definition, ";")
- otherHeadDefinition := strings.TrimRight(other.head.Definition, ";")
- if !equalRoutineDefinition(otherBaseDefinition, otherHeadDefinition) {
- nHeadDefinition := strings.TrimRight(n.head.Definition, ";")
- nBaseDefinition := strings.TrimRight(n.base.Definition, ";")
- if !equalRoutineDefinition(nHeadDefinition, nBaseDefinition) {
- if !equalRoutineDefinition(nHeadDefinition, otherHeadDefinition) {
- return true, fmt.Sprintf("conflict function definition, one is %s, the other is %s", nHeadDefinition, otherHeadDefinition)
- }
- } else {
- n.head.Definition = other.head.Definition
- }
- }
- }
-
- return false, ""
-}
-
-func (n *metadataDiffFunctioNnode) applyDiffTo(target *storepb.SchemaMetadata) error {
- if target == nil {
- return errors.New("target must not be nil")
- }
-
- switch n.action {
- case diffActionCreate:
- newFunction := &storepb.FunctionMetadata{
- Name: n.name,
- Definition: n.head.Definition,
- }
- target.Functions = append(target.Functions, newFunction)
- case diffActionUpdate:
- for i, function := range target.Functions {
- if function.Name == n.name {
- target.Functions[i] = n.head
- break
- }
- }
- case diffActionDrop:
- for i, function := range target.Functions {
- if function.Name == n.name {
- target.Functions = append(target.Functions[:i], target.Functions[i+1:]...)
- break
- }
- }
- return nil
- }
- return nil
-}
-
-type metadataDiffProcedureNode struct {
- diffBaseNode
- name string
- //nolint
- base *storepb.ProcedureMetadata
- head *storepb.ProcedureMetadata
-}
-
-func (n *metadataDiffProcedureNode) tryMerge(other *metadataDiffProcedureNode) (bool, string) {
- if other == nil {
- return true, "other node check conflict with procedure node must not be nil"
- }
-
- if n.name != other.name {
- return true, fmt.Sprintf("non-expected procedure node pair, one is %s, the other is %s", n.name, other.name)
- }
- if n.action != other.action {
- return true, fmt.Sprintf("conflict procedure action, one is %s, the other is %s", n.action, other.action)
- }
- if n.action == diffActionDrop {
- return false, ""
- }
- if n.action == diffActionCreate {
- nHeadDefinition := strings.TrimRight(n.head.Definition, ";")
- otherHeadDefinition := strings.TrimRight(other.head.Definition, ";")
- if !equalRoutineDefinition(nHeadDefinition, otherHeadDefinition) {
- return true, fmt.Sprintf("conflict procedure definition, one is %s, the other is %s", nHeadDefinition, otherHeadDefinition)
- }
- }
-
- if n.action == diffActionUpdate {
- otherBaseDefinition := strings.TrimRight(other.base.Definition, ";")
- otherHeadDefinition := strings.TrimRight(other.head.Definition, ";")
- if !equalRoutineDefinition(otherBaseDefinition, otherHeadDefinition) {
- nHeadDefinition := strings.TrimRight(n.head.Definition, ";")
- nBaseDefinition := strings.TrimRight(n.base.Definition, ";")
- if !equalRoutineDefinition(nHeadDefinition, nBaseDefinition) {
- if !equalRoutineDefinition(nHeadDefinition, otherHeadDefinition) {
- return true, fmt.Sprintf("conflict procedure definition, one is %s, the other is %s", nHeadDefinition, otherHeadDefinition)
- }
- } else {
- n.head.Definition = other.head.Definition
- }
- }
- }
-
- return false, ""
-}
-
-func (n *metadataDiffProcedureNode) applyDiffTo(target *storepb.SchemaMetadata) error {
- if target == nil {
- return errors.New("target must not be nil")
- }
-
- switch n.action {
- case diffActionCreate:
- newProcedure := &storepb.ProcedureMetadata{
- Name: n.name,
- Definition: n.head.Definition,
- }
- target.Procedures = append(target.Procedures, newProcedure)
- case diffActionDrop:
- for i, view := range target.Procedures {
- if view.Name == n.name {
- target.Procedures = append(target.Procedures[:i], target.Procedures[i+1:]...)
- break
- }
- }
- return nil
- case diffActionUpdate:
- for i, procedure := range target.Procedures {
- if procedure.Name == n.name {
- target.Procedures[i] = n.head
- break
- }
- }
- }
- return nil
-}
-
-type metadataDiffViewNode struct {
- diffBaseNode
- name string
- //nolint
- base *storepb.ViewMetadata
- head *storepb.ViewMetadata
-}
-
-func (n *metadataDiffViewNode) tryMerge(other *metadataDiffViewNode) (bool, string) {
- if other == nil {
- return true, "other node check conflict with view node must not be nil"
- }
-
- if n.name != other.name {
- return true, fmt.Sprintf("non-expected view node pair, one is %s, the other is %s", n.name, other.name)
- }
- if n.action != other.action {
- return true, fmt.Sprintf("conflict view action, one is %s, the other is %s", n.action, other.action)
- }
- if n.action == diffActionDrop {
- return false, ""
- }
- if n.action == diffActionCreate {
- if !equalViewDefinition(n.head.Definition, other.head.Definition) {
- return true, fmt.Sprintf("conflict view definition, one is %s, the other is %s", n.head.Definition, other.head.Definition)
- }
- }
-
- if n.action == diffActionUpdate {
- if !equalViewDefinition(other.base.Definition, other.head.Definition) {
- if !equalViewDefinition(n.base.Definition, n.head.Definition) {
- if !equalViewDefinition(n.head.Definition, other.head.Definition) {
- return true, fmt.Sprintf("conflict view definition, one is %s, the other is %s", n.head.Definition, other.head.Definition)
- }
- } else {
- n.head.Definition = other.head.Definition
- }
- }
- }
-
- return false, ""
-}
-
-func equalRoutineDefinition(a, b string) bool {
- ignoreTokens := []string{
- "`", " ", "\t", "\n", "\r",
- }
- for _, token := range ignoreTokens {
- a = strings.ReplaceAll(a, token, "")
- b = strings.ReplaceAll(b, token, "")
- }
- return strings.EqualFold(a, b)
-}
-
-func equalViewDefinition(a, b string) bool {
- a = normalizeMySQLViewDefinition(a)
- b = normalizeMySQLViewDefinition(b)
- ignoreTokens := []string{
- "`", " ", "(", ")", "\t", "\n", "\r",
- }
- for _, token := range ignoreTokens {
- a = strings.ReplaceAll(a, token, "")
- b = strings.ReplaceAll(b, token, "")
- }
- return strings.EqualFold(a, b)
-}
-
-var qualifiedRe = regexp.MustCompile("`" + `[^` + "`" + `]+` + "`" + `\.` + "`")
-
-func normalizeMySQLViewDefinition(query string) string {
- query = strings.TrimSpace(query)
- if !strings.HasSuffix(query, ";") {
- query += ";"
- }
- trailSymbols := []string{"` ", "`,", "`;"}
- for {
- asIdx := strings.Index(query, " AS ")
- if asIdx == -1 {
- break
- }
- var endCandidates []int
- for _, symbol := range trailSymbols {
- i := strings.Index(query[asIdx:], symbol)
- if i >= 0 {
- endCandidates = append(endCandidates, i)
- }
- }
- if len(endCandidates) == 0 {
- break
- }
- endIdx := endCandidates[0]
- for _, v := range endCandidates {
- if v < endIdx {
- endIdx = v
- }
- }
- query = query[:asIdx] + query[(asIdx+endIdx+1):]
- }
- return qualifiedRe.ReplaceAllString(query, "`")
-}
-
-func (n *metadataDiffViewNode) applyDiffTo(target *storepb.SchemaMetadata) error {
- if target == nil {
- return errors.New("target must not be nil")
- }
-
- switch n.action {
- case diffActionCreate:
- newView := &storepb.ViewMetadata{
- Name: n.name,
- Definition: n.head.Definition,
- }
- target.Views = append(target.Views, newView)
- case diffActionUpdate:
- for i, view := range target.Views {
- if view.Name == n.name {
- target.Views[i] = n.head
- break
- }
- }
- case diffActionDrop:
- for i, view := range target.Views {
- if view.Name == n.name {
- target.Views = append(target.Views[:i], target.Views[i+1:]...)
- break
- }
- }
- return nil
- }
- return nil
-}
-
-// Foreign Key related.
-type metadataDiffForeignKeyNode struct {
- diffBaseNode
- name string
- //nolint
- base *storepb.ForeignKeyMetadata
- head *storepb.ForeignKeyMetadata
-}
-
-func (n *metadataDiffForeignKeyNode) tryMerge(other *metadataDiffForeignKeyNode) (bool, string) {
- if other == nil {
- return true, "other node check conflict with column node must not be nil"
- }
-
- if n.name != other.name {
- return true, fmt.Sprintf("non-expected foreign key node pair, one is %s, the other is %s", n.name, other.name)
- }
- if n.action != other.action {
- return true, fmt.Sprintf("conflict foreign key action, one is %s, the other is %s", n.action, other.action)
- }
- if n.action == diffActionDrop {
- return false, ""
- }
- if n.action == diffActionCreate {
- if n.head.ReferencedSchema != other.head.ReferencedSchema {
- return true, fmt.Sprintf("conflict foreign key referenced schema, one is %s, the other is %s", n.head.ReferencedSchema, other.head.ReferencedSchema)
- }
- if n.head.ReferencedTable != other.head.ReferencedTable {
- return true, fmt.Sprintf("conflict foreign key referenced table, one is %s, the other is %s", n.head.ReferencedTable, other.head.ReferencedTable)
- }
- if n.head.OnDelete != other.head.OnDelete {
- return true, fmt.Sprintf("conflict foreign key on delete, one is %s, the other is %s", n.head.OnDelete, other.head.OnDelete)
- }
- if n.head.OnUpdate != other.head.OnUpdate {
- return true, fmt.Sprintf("conflict foreign key on update, one is %s, the other is %s", n.head.OnUpdate, other.head.OnUpdate)
- }
- if !slices.Equal(n.head.Columns, other.head.Columns) {
- return true, fmt.Sprintf("conflict foreign key columns, one is %v, the other is %v", n.head.Columns, other.head.Columns)
- }
- if !slices.Equal(n.head.ReferencedColumns, other.head.ReferencedColumns) {
- return true, fmt.Sprintf("conflict foreign key referenced columns, one is %v, the other is %v", n.head.ReferencedColumns, other.head.ReferencedColumns)
- }
- }
- if n.action == diffActionUpdate {
- if other.base.ReferencedSchema != other.head.ReferencedSchema {
- if n.base.ReferencedSchema != n.head.ReferencedSchema {
- if n.head.ReferencedSchema != other.head.ReferencedSchema {
- return true, fmt.Sprintf("conflict foreign key referenced schema, one is %s, the other is %s", n.head.ReferencedSchema, other.head.ReferencedSchema)
- }
- } else {
- n.head.ReferencedSchema = other.head.ReferencedSchema
- }
- }
-
- if other.base.ReferencedTable != other.head.ReferencedTable {
- if n.base.ReferencedTable != n.head.ReferencedTable {
- if n.head.ReferencedTable != other.head.ReferencedTable {
- return true, fmt.Sprintf("conflict foreign key referenced table, one is %s, the other is %s", n.head.ReferencedTable, other.head.ReferencedTable)
- }
- } else {
- n.head.ReferencedTable = other.head.ReferencedTable
- }
- }
-
- if other.base.OnDelete != other.head.OnDelete {
- if n.base.OnDelete != n.head.OnDelete {
- if n.head.OnDelete != other.head.OnDelete {
- return true, fmt.Sprintf("conflict foreign key on delete, one is %s, the other is %s", n.head.OnDelete, other.head.OnDelete)
- }
- } else {
- n.head.OnDelete = other.head.OnDelete
- }
- }
-
- if other.base.OnUpdate != other.head.OnUpdate {
- if n.base.OnUpdate != n.head.OnUpdate {
- if n.head.OnUpdate != other.head.OnUpdate {
- return true, fmt.Sprintf("conflict foreign key on update, one is %s, the other is %s", n.head.OnUpdate, other.head.OnUpdate)
- }
- } else {
- n.head.OnUpdate = other.head.OnUpdate
- }
- }
-
- if !reflect.DeepEqual(other.base.Columns, other.head.Columns) {
- if !reflect.DeepEqual(n.base.Columns, n.head.Columns) {
- if !reflect.DeepEqual(n.head.Columns, other.head.Columns) {
- return true, fmt.Sprintf("conflict foreign key columns, one is %v, the other is %v", n.head.Columns, other.head.Columns)
- }
- } else {
- n.head.Columns = other.head.Columns
- }
- }
- }
-
- return false, ""
-}
-
-func (n *metadataDiffForeignKeyNode) applyDiffTo(target *storepb.TableMetadata) error {
- switch n.action {
- case diffActionCreate:
- target.ForeignKeys = append(target.ForeignKeys, n.head)
- case diffActionDrop:
- for i, foreignKey := range target.ForeignKeys {
- if foreignKey.Name == n.name {
- target.ForeignKeys = append(target.ForeignKeys[:i], target.ForeignKeys[i+1:]...)
- break
- }
- }
- case diffActionUpdate:
- for i, foreignKey := range target.ForeignKeys {
- if foreignKey.Name == n.name {
- target.ForeignKeys[i] = n.head
- break
- }
- }
- }
- return nil
-}
-
-// diffMetadata returns the diff between base and head metadata, it always returns a non-nil root node if no error occurs.
-func diffMetadata(base, head *storepb.DatabaseSchemaMetadata) (*metadataDiffRootNode, error) {
- if base == nil && head == nil {
- return nil, errors.New("from and to metadata must not be nil")
- }
-
- root := &metadataDiffRootNode{
- schemas: make(map[string]*metadataDiffSchemaNode),
- }
-
- schemaNamesMap := make(map[string]bool)
- baseSchemaMap := make(map[string]*storepb.SchemaMetadata)
- if base != nil {
- for _, schema := range base.Schemas {
- baseSchemaMap[schema.Name] = schema
- schemaNamesMap[schema.Name] = true
- }
- }
-
- headSchemaMap := make(map[string]*storepb.SchemaMetadata)
- if head != nil {
- for _, schema := range head.Schemas {
- headSchemaMap[schema.Name] = schema
- schemaNamesMap[schema.Name] = true
- }
- }
-
- for schemaName := range schemaNamesMap {
- baseSchema, headSchema := baseSchemaMap[schemaName], headSchemaMap[schemaName]
- diffNode, err := diffSchemaMetadata(baseSchema, headSchema)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to diff schema %q", schemaName)
- }
- if diffNode != nil {
- root.schemas[schemaName] = diffNode
- }
- }
-
- return root, nil
-}
-
-func diffSchemaMetadata(base, head *storepb.SchemaMetadata) (*metadataDiffSchemaNode, error) {
- if base == nil && head == nil {
- return nil, nil
- }
- var name string
- action := diffActionUpdate
- if base == nil {
- action = diffActionCreate
- name = head.Name
- } else if head == nil {
- action = diffActionDrop
- name = base.Name
- } else {
- name = base.Name
- }
-
- schemaNode := &metadataDiffSchemaNode{
- diffBaseNode: diffBaseNode{
- action: action,
- },
- name: name,
- base: base,
- head: head,
- tables: make(map[string]*metadataDiffTableNode),
- views: make(map[string]*metadataDiffViewNode),
- functions: make(map[string]*metadataDiffFunctioNnode),
- procedures: make(map[string]*metadataDiffProcedureNode),
- }
-
- tableNamesMap := make(map[string]bool)
-
- baseTableMap := make(map[string]*storepb.TableMetadata)
- if base != nil {
- for _, table := range base.Tables {
- baseTableMap[table.Name] = table
- tableNamesMap[table.Name] = true
- }
- }
-
- headTableMap := make(map[string]*storepb.TableMetadata)
- if head != nil {
- for _, table := range head.Tables {
- headTableMap[table.Name] = table
- tableNamesMap[table.Name] = true
- }
- }
-
- for tableName := range tableNamesMap {
- baseTable, headTable := baseTableMap[tableName], headTableMap[tableName]
- diffNode, err := diffTableMetadata(baseTable, headTable)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to diff table %q", tableName)
- }
- if diffNode != nil {
- schemaNode.tables[tableName] = diffNode
- }
- }
-
- viewNamesMap := make(map[string]bool)
- baseViewMap := make(map[string]*storepb.ViewMetadata)
- if base != nil {
- for _, view := range base.Views {
- baseViewMap[view.Name] = view
- viewNamesMap[view.Name] = true
- }
- }
-
- headViewMap := make(map[string]*storepb.ViewMetadata)
- if head != nil {
- for _, view := range head.Views {
- headViewMap[view.Name] = view
- viewNamesMap[view.Name] = true
- }
- }
-
- for viewName := range viewNamesMap {
- baseView, headView := baseViewMap[viewName], headViewMap[viewName]
- diffNode, err := diffViewMetadata(baseView, headView)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to diff view %q", viewName)
- }
- if diffNode != nil {
- schemaNode.views[viewName] = diffNode
- }
- }
-
- functionNamesMap := make(map[string]bool)
- baseFunctionMap := make(map[string]*storepb.FunctionMetadata)
- if base != nil {
- for _, function := range base.Functions {
- baseFunctionMap[function.Name] = function
- functionNamesMap[function.Name] = true
- }
- }
-
- headFunctionMap := make(map[string]*storepb.FunctionMetadata)
- if head != nil {
- for _, function := range head.Functions {
- headFunctionMap[function.Name] = function
- functionNamesMap[function.Name] = true
- }
- }
-
- for functionName := range functionNamesMap {
- baseFunction, headFunction := baseFunctionMap[functionName], headFunctionMap[functionName]
- diffNode, err := diffFunctionMetadata(baseFunction, headFunction)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to diff function %q", functionName)
- }
- if diffNode != nil {
- schemaNode.functions[functionName] = diffNode
- }
- }
-
- procedureNamesMap := make(map[string]bool)
- baseProcedureMap := make(map[string]*storepb.ProcedureMetadata)
- if base != nil {
- for _, procedure := range base.Procedures {
- baseProcedureMap[procedure.Name] = procedure
- procedureNamesMap[procedure.Name] = true
- }
- }
-
- headProcedureMap := make(map[string]*storepb.ProcedureMetadata)
- if head != nil {
- for _, procedure := range head.Procedures {
- headProcedureMap[procedure.Name] = procedure
- procedureNamesMap[procedure.Name] = true
- }
- }
-
- for procedureName := range procedureNamesMap {
- baseProcedure, headProcedure := baseProcedureMap[procedureName], headProcedureMap[procedureName]
- diffNode, err := diffProcedureMetadata(baseProcedure, headProcedure)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to diff procedure %q", procedureName)
- }
- if diffNode != nil {
- schemaNode.procedures[procedureName] = diffNode
- }
- }
-
- if action == diffActionUpdate {
- if len(schemaNode.tables) == 0 && len(schemaNode.views) == 0 && len(schemaNode.functions) == 0 && len(schemaNode.procedures) == 0 {
- return nil, nil
- }
- }
-
- return schemaNode, nil
-}
-
-func diffViewMetadata(base, head *storepb.ViewMetadata) (*metadataDiffViewNode, error) {
- if base == nil && head == nil {
- return nil, errors.New("from and to view metadata must not be nil")
- }
-
- var name string
- action := diffActionUpdate
- if base == nil {
- action = diffActionCreate
- name = head.Name
- } else if head == nil {
- action = diffActionDrop
- name = base.Name
- } else {
- name = base.Name
- }
-
- viewNode := &metadataDiffViewNode{
- diffBaseNode: diffBaseNode{
- action: action,
- },
- name: name,
- base: base,
- head: head,
- }
-
- if action == diffActionUpdate {
- if base.Definition == head.Definition {
- return nil, nil
- }
- }
-
- return viewNode, nil
-}
-
-func diffProcedureMetadata(base, head *storepb.ProcedureMetadata) (*metadataDiffProcedureNode, error) {
- if base == nil && head == nil {
- return nil, errors.New("from and to view metadata must not be nil")
- }
-
- var name string
- action := diffActionUpdate
- if base == nil {
- action = diffActionCreate
- name = head.Name
- } else if head == nil {
- action = diffActionDrop
- name = base.Name
- } else {
- name = base.Name
- }
-
- procedureNode := &metadataDiffProcedureNode{
- diffBaseNode: diffBaseNode{
- action: action,
- },
- name: name,
- base: base,
- head: head,
- }
-
- if action == diffActionUpdate {
- if base.Definition == head.Definition {
- return nil, nil
- }
- }
-
- return procedureNode, nil
-}
-
-func diffFunctionMetadata(base, head *storepb.FunctionMetadata) (*metadataDiffFunctioNnode, error) {
- if base == nil && head == nil {
- return nil, errors.New("from and to view metadata must not be nil")
- }
-
- var name string
- action := diffActionUpdate
- if base == nil {
- action = diffActionCreate
- name = head.Name
- } else if head == nil {
- action = diffActionDrop
- name = base.Name
- } else {
- name = base.Name
- }
-
- functionNode := &metadataDiffFunctioNnode{
- diffBaseNode: diffBaseNode{
- action: action,
- },
- name: name,
- base: base,
- head: head,
- }
-
- if action == diffActionUpdate {
- if base.Definition == head.Definition {
- return nil, nil
- }
- }
-
- return functionNode, nil
-}
-
-func diffTableMetadata(base, head *storepb.TableMetadata) (*metadataDiffTableNode, error) {
- if base == nil && head == nil {
- return nil, errors.New("from and to table metadata must not be nil")
- }
-
- var name string
- action := diffActionUpdate
- if base == nil {
- action = diffActionCreate
- name = head.Name
- } else if head == nil {
- action = diffActionDrop
- name = base.Name
- } else {
- name = base.Name
- }
-
- tableNode := &metadataDiffTableNode{
- diffBaseNode: diffBaseNode{
- action: action,
- },
- name: name,
- base: base,
- head: head,
- columnsMap: make(map[string]*metadataDiffColumnNode),
- foreignKeys: make(map[string]*metadataDiffForeignKeyNode),
- indexes: make(map[string]*metadataDiffIndexNode),
- partitionsMap: make(map[string]*metadataDiffPartitionNode),
- }
-
- columnNamesMap := make(map[string]bool)
- var columnNameSlice []string
-
- baseColumnMap := make(map[string]int)
- if base != nil {
- for idx, column := range base.Columns {
- baseColumnMap[column.Name] = idx
- if _, ok := columnNamesMap[column.Name]; !ok {
- columnNameSlice = append(columnNameSlice, column.Name)
- }
- columnNamesMap[column.Name] = true
- }
- }
-
- headColumnMap := make(map[string]int)
- if head != nil {
- for idx, column := range head.Columns {
- headColumnMap[column.Name] = idx
- if _, ok := columnNamesMap[column.Name]; !ok {
- columnNameSlice = append(columnNameSlice, column.Name)
- }
- columnNamesMap[column.Name] = true
- }
- }
-
- for _, columnName := range columnNameSlice {
- baseColumnIdx, baseColumnOk := baseColumnMap[columnName]
- headColumnIdx, headColumnOk := headColumnMap[columnName]
- var baseColumn, headColumn *storepb.ColumnMetadata
- if baseColumnOk {
- baseColumn = base.Columns[baseColumnIdx]
- }
- if headColumnOk {
- headColumn = head.Columns[headColumnIdx]
- }
- if baseColumnIdx != 0 {
- baseColumn = base.Columns[baseColumnIdx]
- }
- diffNode, err := diffColumnMetadata(baseColumn, headColumn)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to diff column %q", columnName)
- }
- if diffNode != nil {
- tableNode.columnsMap[columnName] = diffNode
- tableNode.columnNames = append(tableNode.columnNames, columnName)
- }
- }
-
- foreignKeyNamesMap := make(map[string]bool)
-
- baseForeignKeyMap := make(map[string]*storepb.ForeignKeyMetadata)
- if base != nil {
- for _, foreignKey := range base.ForeignKeys {
- baseForeignKeyMap[foreignKey.Name] = foreignKey
- foreignKeyNamesMap[foreignKey.Name] = true
- }
- }
-
- headForeignKeyMap := make(map[string]*storepb.ForeignKeyMetadata)
- if head != nil {
- for _, foreignKey := range head.ForeignKeys {
- headForeignKeyMap[foreignKey.Name] = foreignKey
- foreignKeyNamesMap[foreignKey.Name] = true
- }
- }
-
- for foreignKeyName := range foreignKeyNamesMap {
- baseForeignKey, headForeignKey := baseForeignKeyMap[foreignKeyName], headForeignKeyMap[foreignKeyName]
- diffNode, err := diffForeignKeyMetadata(baseForeignKey, headForeignKey)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to diff foreign key %q", foreignKeyName)
- }
- if diffNode != nil {
- tableNode.foreignKeys[foreignKeyName] = diffNode
- }
- }
-
- indexNamesMap := make(map[string]bool)
-
- baseIndexKeyMap := make(map[string]*storepb.IndexMetadata)
- if base != nil {
- for _, index := range base.Indexes {
- baseIndexKeyMap[index.Name] = index
- indexNamesMap[index.Name] = true
- }
- }
-
- headIndexKeyMap := make(map[string]*storepb.IndexMetadata)
- if head != nil {
- for _, index := range head.Indexes {
- headIndexKeyMap[index.Name] = index
- indexNamesMap[index.Name] = true
- }
- }
-
- for indexName := range indexNamesMap {
- baseIndex, headIndex := baseIndexKeyMap[indexName], headIndexKeyMap[indexName]
- diffNode, err := diffIndexMetadata(baseIndex, headIndex)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to diff index %q", indexName)
- }
- if diffNode != nil {
- tableNode.indexes[indexName] = diffNode
- }
- }
-
- partitionNamesMap := make(map[string]bool)
- var partitionNameSlice []string
-
- basePartitionMap := make(map[string]int)
- if base != nil {
- for idx, partition := range base.Partitions {
- basePartitionMap[partition.Name] = idx
- if _, ok := partitionNamesMap[partition.Name]; !ok {
- partitionNameSlice = append(partitionNameSlice, partition.Name)
- }
- partitionNamesMap[partition.Name] = true
- }
- }
-
- headPartitionMap := make(map[string]int)
- if head != nil {
- for idx, partition := range head.Partitions {
- headPartitionMap[partition.Name] = idx
- if _, ok := partitionNamesMap[partition.Name]; !ok {
- partitionNameSlice = append(partitionNameSlice, partition.Name)
- }
- partitionNamesMap[partition.Name] = true
- }
- }
-
- for _, partitionName := range partitionNameSlice {
- basePartitionIdx, basePartitionOk := basePartitionMap[partitionName]
- headPartitionIdx, headPartitionOk := headPartitionMap[partitionName]
- var basePartition, headPartition *storepb.TablePartitionMetadata
- if basePartitionOk {
- basePartition = base.Partitions[basePartitionIdx]
- }
- if headPartitionOk {
- headPartition = head.Partitions[headPartitionIdx]
- }
- if basePartitionIdx != 0 {
- basePartition = base.Partitions[basePartitionIdx]
- }
- diffNode, err := diffPartitionMetadata(basePartition, headPartition)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to diff partition %q", partitionName)
- }
- if diffNode != nil {
- tableNode.partitionsMap[partitionName] = diffNode
- tableNode.partitionNames = append(tableNode.partitionNames, partitionName)
- }
- }
-
- if action == diffActionUpdate {
- if len(tableNode.columnsMap) == 0 &&
- len(tableNode.foreignKeys) == 0 &&
- len(tableNode.indexes) == 0 &&
- len(tableNode.partitionsMap) == 0 &&
- !(tableNode.base.GetComment() != tableNode.head.GetComment()) &&
- !(tableNode.base.GetUserComment() != tableNode.head.GetUserComment()) {
- return nil, nil
- }
- }
-
- return tableNode, nil
-}
-
-func diffColumnMetadata(base, head *storepb.ColumnMetadata) (*metadataDiffColumnNode, error) {
- if base == nil && head == nil {
- return nil, errors.New("base and head column metadata cannot be nil both")
- }
-
- var name string
- action := diffActionUpdate
- if base == nil {
- action = diffActionCreate
- name = head.Name
- } else if head == nil {
- action = diffActionDrop
- name = base.Name
- } else {
- name = base.Name
- }
-
- columnNode := &metadataDiffColumnNode{
- diffBaseNode: diffBaseNode{
- action: action,
- },
- name: name,
- base: base,
- head: head,
- }
-
- if action == diffActionUpdate {
- if !proto.Equal(base, head) {
- return columnNode, nil
- }
- return nil, nil
- }
- return columnNode, nil
-}
-
-func diffForeignKeyMetadata(base, head *storepb.ForeignKeyMetadata) (*metadataDiffForeignKeyNode, error) {
- if base == nil && head == nil {
- return nil, errors.New("base and head foreign key metadata cannot be nil both")
- }
-
- var name string
- action := diffActionUpdate
- if base == nil {
- action = diffActionCreate
- name = head.Name
- } else if head == nil {
- action = diffActionDrop
- name = base.Name
- } else {
- name = base.Name
- }
-
- fkNode := &metadataDiffForeignKeyNode{
- diffBaseNode: diffBaseNode{
- action: action,
- },
- name: name,
- base: base,
- head: head,
- }
-
- if action == diffActionUpdate {
- if !proto.Equal(base, head) {
- return fkNode, nil
- }
- return nil, nil
- }
- return fkNode, nil
-}
-
-func diffIndexMetadata(base, head *storepb.IndexMetadata) (*metadataDiffIndexNode, error) {
- if base == nil && head == nil {
- return nil, errors.New("base and head index metadata cannot be nil both")
- }
-
- var name string
- action := diffActionUpdate
- if base == nil {
- action = diffActionCreate
- name = head.Name
- } else if head == nil {
- action = diffActionDrop
- name = base.Name
- } else {
- name = base.Name
- }
-
- indexNode := &metadataDiffIndexNode{
- diffBaseNode: diffBaseNode{
- action: action,
- },
- name: name,
- base: base,
- head: head,
- }
-
- if action == diffActionUpdate {
- if !proto.Equal(base, head) {
- return indexNode, nil
- }
- return nil, nil
- }
- return indexNode, nil
-}
-
-func diffPartitionMetadata(base, head *storepb.TablePartitionMetadata) (*metadataDiffPartitionNode, error) {
- if base == nil && head == nil {
- return nil, errors.New("base and head partition metadata cannot be nil both")
- }
-
- var name string
- action := diffActionUpdate
- if base == nil {
- action = diffActionCreate
- name = head.Name
- } else if head == nil {
- action = diffActionDrop
- name = base.Name
- } else {
- name = base.Name
- }
-
- partitionNode := &metadataDiffPartitionNode{
- diffBaseNode: diffBaseNode{
- action: action,
- },
- name: name,
- base: base,
- head: head,
- subpartitions: make(map[string]*metadataDiffPartitionNode),
- }
-
- baseSubpartitionMap := make(map[string]*storepb.TablePartitionMetadata)
- if base != nil {
- for _, partition := range base.Subpartitions {
- baseSubpartitionMap[partition.Name] = partition
- }
- }
-
- headSubpartitionMap := make(map[string]*storepb.TablePartitionMetadata)
- if head != nil {
- for _, partition := range head.Subpartitions {
- headSubpartitionMap[partition.Name] = partition
- }
- }
-
- subpartitionNamesMap := make(map[string]bool)
- var subpartitionNamesSlice []string
-
- for subpartitionName := range baseSubpartitionMap {
- subpartitionNamesMap[subpartitionName] = true
- subpartitionNamesSlice = append(subpartitionNamesSlice, subpartitionName)
- }
-
- for subpartitionName := range headSubpartitionMap {
- if _, ok := subpartitionNamesMap[subpartitionName]; !ok {
- subpartitionNamesSlice = append(subpartitionNamesSlice, subpartitionName)
- }
- subpartitionNamesMap[subpartitionName] = true
- }
-
- for _, subpartitionName := range subpartitionNamesSlice {
- baseSubpartition, headSubpartition := baseSubpartitionMap[subpartitionName], headSubpartitionMap[subpartitionName]
- diffNode, err := diffPartitionMetadata(baseSubpartition, headSubpartition)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to diff subpartition %q", subpartitionName)
- }
- if diffNode != nil {
- partitionNode.subpartitions[subpartitionName] = diffNode
- partitionNode.subpartitionNames = append(partitionNode.subpartitionNames, subpartitionName)
- }
- }
-
- if action == diffActionUpdate {
- if len(partitionNode.subpartitions) > 0 || !proto.Equal(base, head) {
- return partitionNode, nil
- }
- return nil, nil
- }
-
- return partitionNode, nil
-}
-
-func isColumnTypeEqual(a, b string, engine storepb.Engine) bool {
- switch engine {
- case storepb.Engine_MYSQL:
- canonicalA := mysql.GetColumnTypeCanonicalSynonym(a)
- canonicalB := mysql.GetColumnTypeCanonicalSynonym(b)
- return strings.EqualFold(canonicalA, canonicalB)
- case storepb.Engine_TIDB:
- canonicalA := tidb.GetColumnTypeCanonicalSynonym(a)
- canonicalB := tidb.GetColumnTypeCanonicalSynonym(b)
- return strings.EqualFold(canonicalA, canonicalB)
- default:
- return strings.EqualFold(a, b)
- }
-}
-
-type updateInfo struct {
- lastUpdatedTime *timestamppb.Timestamp
- lastUpdater string
- sourceBranch string
-}
-
-func (u *updateInfo) clone() *updateInfo {
- if u == nil {
- return nil
- }
- return &updateInfo{
- //nolint
- lastUpdatedTime: proto.Clone(u.lastUpdatedTime).(*timestamppb.Timestamp),
- lastUpdater: u.lastUpdater,
- sourceBranch: u.sourceBranch,
- }
-}
-
-type updateInfoDiffRootNode struct {
- schemas map[string]*updateInfoDiffSchemaNode
-}
-
-type updateInfoDiffSchemaNode struct {
- diffBaseNode
- name string
- tables map[string]*updateInfoDiffTableNode
- views map[string]*updateInfoDiffViewNode
- functions map[string]*updateInfoDiffFunctionNode
- procedures map[string]*updateInfoDiffProcedureNode
-}
-
-type updateInfoDiffTableNode struct {
- diffBaseNode
- name string
- // If the action is diffActionDelete, the updateInfo should be nil.
- updateInfo *updateInfo
-}
-
-type updateInfoDiffViewNode struct {
- diffBaseNode
- name string
- // If the action is diffActionDelete, the updateInfo should be nil.
- updateInfo *updateInfo
-}
-
-type updateInfoDiffFunctionNode struct {
- diffBaseNode
- name string
- // If the action is diffActionDelete, the updateInfo should be nil.
- updateInfo *updateInfo
-}
-
-type updateInfoDiffProcedureNode struct {
- diffBaseNode
- name string
- // If the action is diffActionDelete, the updateInfo should be nil.
- updateInfo *updateInfo
-}
-
-// deriveUpdateInfoFromMetadataDiff derives the update info diff from the metadata diff.
-func deriveUpdateInfoFromMetadataDiff(metadataDiff *metadataDiffRootNode, headDatabaseConfig *storepb.DatabaseConfig) *updateInfoDiffRootNode {
- if metadataDiff == nil {
- return nil
- }
- rootNode := &updateInfoDiffRootNode{
- schemas: make(map[string]*updateInfoDiffSchemaNode),
- }
-
- schemaConfigMap := buildMap(headDatabaseConfig.GetSchemas(), func(schemaConfig *storepb.SchemaCatalog) string {
- return schemaConfig.GetName()
- })
- for _, metadataSchemaDiff := range metadataDiff.schemas {
- action := metadataSchemaDiff.action
- updateInfoSchemaDiff := &updateInfoDiffSchemaNode{
- diffBaseNode: diffBaseNode{
- action: action,
- },
- name: metadataSchemaDiff.name,
- tables: make(map[string]*updateInfoDiffTableNode),
- views: make(map[string]*updateInfoDiffViewNode),
- functions: make(map[string]*updateInfoDiffFunctionNode),
- procedures: make(map[string]*updateInfoDiffProcedureNode),
- }
- schemaConfig := schemaConfigMap[metadataSchemaDiff.name]
- tableConfigMap := buildMap(schemaConfig.GetTables(), func(tableConfig *storepb.TableCatalog) string {
- return tableConfig.GetName()
- })
- for tableName, table := range metadataSchemaDiff.tables {
- action := table.action
- updateInfoSchemaDiff.tables[tableName] = &updateInfoDiffTableNode{
- diffBaseNode: diffBaseNode{
- action: action,
- },
- name: tableName,
- }
- if action != diffActionDrop {
- tableConfig := tableConfigMap[tableName]
- updateInfoSchemaDiff.tables[tableName].updateInfo = &updateInfo{
- lastUpdatedTime: tableConfig.GetUpdateTime(),
- lastUpdater: tableConfig.GetUpdater(),
- sourceBranch: tableConfig.GetSourceBranch(),
- }
- }
- }
-
- // Views
- viewConfigMap := buildMap(schemaConfig.GetViewConfigs(), func(viewConfig *storepb.ViewConfig) string {
- return viewConfig.GetName()
- })
- for viewName, view := range metadataSchemaDiff.views {
- action := view.action
- updateInfoSchemaDiff.views[viewName] = &updateInfoDiffViewNode{
- diffBaseNode: diffBaseNode{
- action: action,
- },
- name: viewName,
- }
- if action != diffActionDrop {
- viewConfig := viewConfigMap[viewName]
- updateInfoSchemaDiff.views[viewName].updateInfo = &updateInfo{
- lastUpdatedTime: viewConfig.GetUpdateTime(),
- lastUpdater: viewConfig.GetUpdater(),
- sourceBranch: viewConfig.GetSourceBranch(),
- }
- }
- }
-
- // Functions
- functionConfigMap := buildMap(schemaConfig.GetFunctionConfigs(), func(functionConfig *storepb.FunctionConfig) string {
- return functionConfig.GetName()
- })
- for functionName, function := range metadataSchemaDiff.functions {
- action := function.action
- updateInfoSchemaDiff.functions[functionName] = &updateInfoDiffFunctionNode{
- diffBaseNode: diffBaseNode{
- action: action,
- },
- name: functionName,
- }
- if action != diffActionDrop {
- functionConfig := functionConfigMap[functionName]
- updateInfoSchemaDiff.functions[functionName].updateInfo = &updateInfo{
- lastUpdatedTime: functionConfig.GetUpdateTime(),
- lastUpdater: functionConfig.GetUpdater(),
- sourceBranch: functionConfig.GetSourceBranch(),
- }
- }
- }
-
- // Procedures
- procedureConfigMap := buildMap(schemaConfig.GetProcedureConfigs(), func(procedureConfig *storepb.ProcedureConfig) string {
- return procedureConfig.GetName()
- })
- for procedureName, procedure := range metadataSchemaDiff.procedures {
- action := procedure.action
- updateInfoSchemaDiff.procedures[procedureName] = &updateInfoDiffProcedureNode{
- diffBaseNode: diffBaseNode{
- action: action,
- },
- name: procedureName,
- }
- if action != diffActionDrop {
- procedureConfig := procedureConfigMap[procedureName]
- updateInfoSchemaDiff.procedures[procedureName].updateInfo = &updateInfo{
- lastUpdatedTime: procedureConfig.GetUpdateTime(),
- lastUpdater: procedureConfig.GetUpdater(),
- sourceBranch: procedureConfig.GetSourceBranch(),
- }
- }
- }
- rootNode.schemas[metadataSchemaDiff.name] = updateInfoSchemaDiff
- }
-
- return rootNode
-}
-
-func mergeUpdateInfoDiffRooNode(a, b *updateInfoDiffRootNode) (*updateInfoDiffRootNode, error) {
- if a == nil && b == nil {
- return nil, nil
- }
- if a == nil {
- return b, nil
- }
- if b == nil {
- return a, nil
- }
- rootNode := &updateInfoDiffRootNode{
- schemas: make(map[string]*updateInfoDiffSchemaNode),
- }
-
- schemaNamesMap := make(map[string]bool)
- for schemaName := range a.schemas {
- schemaNamesMap[schemaName] = true
- }
- for schemaName := range b.schemas {
- schemaNamesMap[schemaName] = true
- }
-
- for schemaName := range schemaNamesMap {
- aSchema, aOk := a.schemas[schemaName]
- bSchema, bOk := b.schemas[schemaName]
- if aOk && bOk {
- mergedSchema, err := mergeUpdateInfoDiffSchemaNode(aSchema, bSchema)
- if err != nil {
- return nil, err
- }
- rootNode.schemas[schemaName] = mergedSchema
- continue
- }
- if aOk {
- rootNode.schemas[schemaName] = aSchema
- continue
- }
- if bOk {
- rootNode.schemas[schemaName] = bSchema
- continue
- }
- }
-
- return rootNode, nil
-}
-
-func mergeUpdateInfoDiffSchemaNode(a, b *updateInfoDiffSchemaNode) (*updateInfoDiffSchemaNode, error) {
- if a == nil && b == nil {
- return nil, nil
- }
- if a == nil {
- return b, nil
- }
- if b == nil {
- return a, nil
- }
-
- if a.action != b.action {
- return nil, errors.Errorf("conflict schema config action, one is %s, the other is %s", a.action, b.action)
- }
- schemaNode := &updateInfoDiffSchemaNode{
- diffBaseNode: diffBaseNode{
- action: b.action,
- },
- name: b.name,
- tables: make(map[string]*updateInfoDiffTableNode),
- views: make(map[string]*updateInfoDiffViewNode),
- functions: make(map[string]*updateInfoDiffFunctionNode),
- procedures: make(map[string]*updateInfoDiffProcedureNode),
- }
-
- tableNameMap := make(map[string]bool)
- for tableName := range a.tables {
- tableNameMap[tableName] = true
- }
- for tableName := range b.tables {
- tableNameMap[tableName] = true
- }
- for tableName := range tableNameMap {
- aTable, aOk := a.tables[tableName]
- bTable, bOk := b.tables[tableName]
- if aOk && bOk {
- mergedTable, err := mergeUpdateInfoDiffTableNode(aTable, bTable)
- if err != nil {
- return nil, err
- }
- schemaNode.tables[tableName] = mergedTable
- continue
- }
- if aOk {
- schemaNode.tables[tableName] = aTable
- continue
- }
- if bOk {
- schemaNode.tables[tableName] = bTable
- continue
- }
- }
-
- viewNameMap := make(map[string]bool)
- for viewName := range a.views {
- viewNameMap[viewName] = true
- }
- for viewName := range b.views {
- viewNameMap[viewName] = true
- }
- for viewName := range viewNameMap {
- aView, aOk := a.views[viewName]
- bView, bOk := b.views[viewName]
- if aOk && bOk {
- mergedView, err := mergeUpdateInfoDiffViewNode(aView, bView)
- if err != nil {
- return nil, err
- }
- schemaNode.views[viewName] = mergedView
- continue
- }
- if aOk {
- schemaNode.views[viewName] = aView
- continue
- }
- if bOk {
- schemaNode.views[viewName] = bView
- continue
- }
- }
-
- procedureNameMap := make(map[string]bool)
- for procedureName := range a.procedures {
- procedureNameMap[procedureName] = true
- }
- for procedureName := range b.procedures {
- procedureNameMap[procedureName] = true
- }
- for procedureName := range procedureNameMap {
- aProcedure, aOk := a.procedures[procedureName]
- bProcedure, bOk := b.procedures[procedureName]
- if aOk && bOk {
- mergedProcedure, err := mergeUpdateInfoDiffProcedureNode(aProcedure, bProcedure)
- if err != nil {
- return nil, err
- }
- schemaNode.procedures[procedureName] = mergedProcedure
- continue
- }
- if aOk {
- schemaNode.procedures[procedureName] = aProcedure
- continue
- }
- if bOk {
- schemaNode.procedures[procedureName] = bProcedure
- continue
- }
- }
-
- functionNameMap := make(map[string]bool)
- for functionName := range a.functions {
- functionNameMap[functionName] = true
- }
- for functionName := range b.functions {
- functionNameMap[functionName] = true
- }
- for functionName := range functionNameMap {
- aFunction, aOk := a.functions[functionName]
- bFunction, bOk := b.functions[functionName]
- if aOk && bOk {
- mergedFunction, err := mergeUpdateInfoDiffFunctionNode(aFunction, bFunction)
- if err != nil {
- return nil, err
- }
- schemaNode.functions[functionName] = mergedFunction
- continue
- }
- if aOk {
- schemaNode.functions[functionName] = aFunction
- continue
- }
- if bOk {
- schemaNode.functions[functionName] = bFunction
- continue
- }
- }
-
- return schemaNode, nil
-}
-
-func mergeUpdateInfoDiffTableNode(a, b *updateInfoDiffTableNode) (*updateInfoDiffTableNode, error) {
- if a == nil && b == nil {
- return nil, nil
- }
- if a == nil {
- return b, nil
- }
- if b == nil {
- return a, nil
- }
-
- if a.action != b.action {
- return nil, errors.Errorf("conflict table config action, one is %s, the other is %s", a.action, b.action)
- }
-
- return &updateInfoDiffTableNode{
- diffBaseNode: diffBaseNode{
- action: b.action,
- },
- name: b.name,
- updateInfo: b.updateInfo.clone(),
- }, nil
-}
-
-func mergeUpdateInfoDiffViewNode(a, b *updateInfoDiffViewNode) (*updateInfoDiffViewNode, error) {
- if a == nil && b == nil {
- return nil, nil
- }
- if a == nil {
- return b, nil
- }
- if b == nil {
- return a, nil
- }
-
- if a.action != b.action {
- return nil, errors.Errorf("conflict view config action, one is %s, the other is %s", a.action, b.action)
- }
-
- return &updateInfoDiffViewNode{
- diffBaseNode: diffBaseNode{
- action: b.action,
- },
- name: b.name,
- updateInfo: b.updateInfo.clone(),
- }, nil
-}
-
-func mergeUpdateInfoDiffProcedureNode(a, b *updateInfoDiffProcedureNode) (*updateInfoDiffProcedureNode, error) {
- if a == nil && b == nil {
- return nil, nil
- }
- if a == nil {
- return b, nil
- }
- if b == nil {
- return a, nil
- }
-
- if a.action != b.action {
- return nil, errors.Errorf("conflict procedure config action, one is %s, the other is %s", a.action, b.action)
- }
-
- return &updateInfoDiffProcedureNode{
- diffBaseNode: diffBaseNode{
- action: b.action,
- },
- name: b.name,
- updateInfo: b.updateInfo.clone(),
- }, nil
-}
-
-func mergeUpdateInfoDiffFunctionNode(a, b *updateInfoDiffFunctionNode) (*updateInfoDiffFunctionNode, error) {
- if a == nil && b == nil {
- return nil, nil
- }
- if a == nil {
- return b, nil
- }
- if b == nil {
- return a, nil
- }
-
- if a.action != b.action {
- return nil, errors.Errorf("conflict function config action, one is %s, the other is %s", a.action, b.action)
- }
-
- return &updateInfoDiffFunctionNode{
- diffBaseNode: diffBaseNode{
- action: b.action,
- },
- name: b.name,
- updateInfo: b.updateInfo.clone(),
- }, nil
-}
-
-func applyUpdateInfoDiffRootNode(a *updateInfoDiffRootNode, target *storepb.DatabaseConfig) *storepb.DatabaseConfig {
- if a == nil {
- //nolint
- return proto.Clone(target).(*storepb.DatabaseConfig)
- }
-
- schemaConfigMap := buildMap(target.GetSchemas(), func(schemaConfig *storepb.SchemaCatalog) string {
- return schemaConfig.GetName()
- })
-
- var schemaConfigs []*storepb.SchemaCatalog
- for schemaName, schema := range a.schemas {
- switch schema.action {
- case diffActionDrop:
- continue
- default:
- schemaConfig := schemaConfigMap[schemaName]
- if schemaConfig == nil {
- schemaConfig = &storepb.SchemaCatalog{
- Name: schema.name,
- }
- }
- appliedSchema := applyUpdateInfoDiffSchemaNode(schema, schemaConfig)
- schemaConfigs = append(schemaConfigs, appliedSchema)
- }
- }
-
- return &storepb.DatabaseConfig{
- Name: target.GetName(),
- Schemas: schemaConfigs,
- }
-}
-
-func applyUpdateInfoDiffSchemaNode(a *updateInfoDiffSchemaNode, target *storepb.SchemaCatalog) *storepb.SchemaCatalog {
- if a == nil {
- //nolint
- return proto.Clone(target).(*storepb.SchemaCatalog)
- }
-
- tableCatalogMap := buildMap(target.GetTables(), func(tableConfig *storepb.TableCatalog) string {
- return tableConfig.GetName()
- })
- var tableCatalogs []*storepb.TableCatalog
- for tableName, table := range a.tables {
- switch table.action {
- case diffActionDrop:
- delete(tableCatalogMap, tableName)
- continue
- default:
- tableCatalog := tableCatalogMap[tableName]
- if tableCatalog == nil {
- tableCatalog = &storepb.TableCatalog{
- Name: tableName,
- }
- }
- tableCatalog.UpdateTime = table.updateInfo.lastUpdatedTime
- tableCatalog.Updater = table.updateInfo.lastUpdater
- tableCatalog.SourceBranch = table.updateInfo.sourceBranch
- tableCatalogs = append(tableCatalogs, tableCatalog)
- delete(tableCatalogMap, tableName)
- }
- }
- // Add the remaining table configs in the target schema config.
- for _, tableCatalog := range tableCatalogMap {
- tableCatalogs = append(tableCatalogs, tableCatalog)
- }
-
- viewConfigMap := buildMap(target.GetViewConfigs(), func(viewConfig *storepb.ViewConfig) string {
- return viewConfig.GetName()
- })
- var viewConfigs []*storepb.ViewConfig
- for viewName, view := range a.views {
- switch view.action {
- case diffActionDrop:
- delete(viewConfigMap, viewName)
- continue
- default:
- viewConfig := viewConfigMap[viewName]
- if viewConfig == nil {
- viewConfig = &storepb.ViewConfig{
- Name: viewName,
- }
- }
- viewConfig.UpdateTime = view.updateInfo.lastUpdatedTime
- viewConfig.Updater = view.updateInfo.lastUpdater
- viewConfig.SourceBranch = view.updateInfo.sourceBranch
- viewConfigs = append(viewConfigs, viewConfig)
- delete(viewConfigMap, viewName)
- }
- }
- // Add the remaining view configs in the target schema config.
- for _, viewConfig := range viewConfigMap {
- viewConfigs = append(viewConfigs, viewConfig)
- }
-
- procedureConfigMap := buildMap(target.GetProcedureConfigs(), func(procedureConfig *storepb.ProcedureConfig) string {
- return procedureConfig.GetName()
- })
- var procedureConfigs []*storepb.ProcedureConfig
- for procedureName, procedure := range a.procedures {
- switch procedure.action {
- case diffActionDrop:
- delete(procedureConfigMap, procedureName)
- continue
- default:
- procedureConfig := procedureConfigMap[procedureName]
- if procedureConfig == nil {
- procedureConfig = &storepb.ProcedureConfig{
- Name: procedureName,
- }
- }
- procedureConfig.UpdateTime = procedure.updateInfo.lastUpdatedTime
- procedureConfig.Updater = procedure.updateInfo.lastUpdater
- procedureConfig.SourceBranch = procedure.updateInfo.sourceBranch
- procedureConfigs = append(procedureConfigs, procedureConfig)
- delete(procedureConfigMap, procedureName)
- }
- }
- // Add the remaining procedure configs in the target schema config.
- for _, procedureConfig := range procedureConfigMap {
- procedureConfigs = append(procedureConfigs, procedureConfig)
- }
-
- functionConfigMap := buildMap(target.GetFunctionConfigs(), func(functionConfig *storepb.FunctionConfig) string {
- return functionConfig.GetName()
- })
- var functionConfigs []*storepb.FunctionConfig
- for functionName, function := range a.functions {
- switch function.action {
- case diffActionDrop:
- delete(functionConfigMap, functionName)
- continue
- default:
- functionConfig := functionConfigMap[functionName]
- if functionConfig == nil {
- functionConfig = &storepb.FunctionConfig{
- Name: functionName,
- }
- }
- functionConfig.UpdateTime = function.updateInfo.lastUpdatedTime
- functionConfig.Updater = function.updateInfo.lastUpdater
- functionConfig.SourceBranch = function.updateInfo.sourceBranch
- functionConfigs = append(functionConfigs, functionConfig)
- delete(functionConfigMap, functionName)
- }
- }
- // Add the remaining function configs in the target schema config.
- for _, functionConfig := range functionConfigMap {
- functionConfigs = append(functionConfigs, functionConfig)
- }
-
- return &storepb.SchemaCatalog{
- Name: target.GetName(),
- Tables: tableCatalogs,
- ViewConfigs: viewConfigs,
- FunctionConfigs: functionConfigs,
- ProcedureConfigs: procedureConfigs,
- }
-}
diff --git a/backend/api/v1/branch_merge_test.go b/backend/api/v1/branch_merge_test.go
deleted file mode 100644
index fa1918d356..0000000000
--- a/backend/api/v1/branch_merge_test.go
+++ /dev/null
@@ -1,336 +0,0 @@
-package v1
-
-import (
- "os"
- "strings"
- "testing"
- "time"
-
- "github.com/google/go-cmp/cmp"
- "github.com/stretchr/testify/require"
- "google.golang.org/protobuf/encoding/protojson"
- "google.golang.org/protobuf/testing/protocmp"
- "google.golang.org/protobuf/types/known/timestamppb"
- "gopkg.in/yaml.v3"
-
- "github.com/bytebase/bytebase/backend/common"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
-)
-
-func TestTryMerge(t *testing.T) {
- type testCase struct {
- Description string `yaml:"description"`
- // Merge Head to Base with Ancestor as the common ancestor.
- // Base is the base storepb.DatabaseSchemaMetadata protojson marshalled string.
- Ancestor string `yaml:"ancestor"`
- // Head is the head storepb.DatabaseSchemaMetadata protojson marshalled string.
- Head string `yaml:"head"`
- // Ancestor is the ancestor storepb.DatabaseSchemaMetadata protojson marshalled string.
- Base string `yaml:"base"`
- // Expected is the expected storepb.DatabaseSchemaMetadata protojson marshalled string.
- Expected string `yaml:"expected"`
- }
-
- const record = false
-
- a := require.New(t)
-
- testFilepath := "testdata/branch_merge/try_merge.yaml"
- content, err := os.ReadFile(testFilepath)
- a.NoError(err)
- var testCases []testCase
- err = yaml.Unmarshal(content, &testCases)
- a.NoError(err)
-
- for idx, tc := range testCases {
- ancestorSchemaMetadata := new(storepb.DatabaseSchemaMetadata)
- err = common.ProtojsonUnmarshaler.Unmarshal([]byte(tc.Ancestor), ancestorSchemaMetadata)
- a.NoErrorf(err, "test case %d: %s", idx, tc.Description)
- headSchemaMetadata := new(storepb.DatabaseSchemaMetadata)
- err = common.ProtojsonUnmarshaler.Unmarshal([]byte(tc.Head), headSchemaMetadata)
- a.NoErrorf(err, "test case %d: %s", idx, tc.Description)
- baseSchemaMetadata := new(storepb.DatabaseSchemaMetadata)
- err := common.ProtojsonUnmarshaler.Unmarshal([]byte(tc.Base), baseSchemaMetadata)
- a.NoErrorf(err, "test case %d: %s", idx, tc.Description)
- mergedSchemaMetadata, _, err := tryMerge(ancestorSchemaMetadata, headSchemaMetadata, baseSchemaMetadata, nil, nil, nil /* TODO(zp): fix test */, storepb.Engine_MYSQL)
- a.NoErrorf(err, "test case %d: %s", idx, tc.Description)
- a.NotNil(mergedSchemaMetadata, "test case %d: %s, mergedSchemaMetadata should not be nil if there is no error", idx, tc.Description)
-
- s := protojson.MarshalOptions{Multiline: true, Indent: " "}.Format(mergedSchemaMetadata)
- a.NoErrorf(err, "test case %d: %s", idx, tc.Description)
- if record {
- testCases[idx].Expected = strings.TrimSpace(s)
- } else {
- expectedSchemaMetadata := new(storepb.DatabaseSchemaMetadata)
- err = common.ProtojsonUnmarshaler.Unmarshal([]byte(tc.Expected), expectedSchemaMetadata)
- a.NoErrorf(err, "test case %d: %s", idx, tc.Description)
- diff := cmp.Diff(expectedSchemaMetadata, mergedSchemaMetadata, protocmp.Transform())
- a.Empty(diff)
- }
- }
-
- if record {
- f, err := os.OpenFile(testFilepath, os.O_WRONLY|os.O_TRUNC, 0644)
- a.NoError(err)
- defer f.Close()
- content, err := yaml.Marshal(testCases)
- a.NoError(err)
- _, err = f.Write(content)
- a.NoError(err)
- }
-}
-
-func TestNormalizeMySQLViewDefinition(t *testing.T) {
- for i, test := range []struct {
- query string
- want string
- }{
- {
- query: "select `p`.`id` AS `id`,extract(year_month from `p`.`yyy`) AS `extract(year_month from ``yyy``)` from `p` order by `p`.`id` limit 1000000000000",
- want: "select `id`,extract(year_month from `yyy`) from `p` order by `id` limit 1000000000000;",
- },
- {
- query: "select 12 AS `12`",
- want: "select 12;",
- },
- {
- query: "select 12 AS `12`; ",
- want: "select 12;",
- },
- {
- query: "select `t1`.`id` AS `id` from `t1`;",
- want: "select `id` from `t1`;",
- },
- } {
- got := normalizeMySQLViewDefinition(test.query)
- require.Equal(t, test.want, got, i)
- }
-}
-
-func TestAutoRandomEqual(t *testing.T) {
- testCases := []struct {
- aExpr string
- bExpr string
- equal bool
- }{
- {
- aExpr: "AUTO_RANDOM",
- bExpr: "auto_random(5, 64)",
- equal: true,
- },
- {
- aExpr: "AUTO_RANDOM(5)",
- bExpr: "auto_random(5, 64)",
- equal: true,
- },
- {
- aExpr: "AUTO_RANDOM(10, 32)",
- bExpr: "auto_random",
- equal: false,
- },
- }
-
- for _, tc := range testCases {
- a := buildAutoRandomDefaultValue(tc.aExpr)
- require.NotNil(t, a)
- b := buildAutoRandomDefaultValue(tc.bExpr)
- require.NotNil(t, b)
- got := isAutoRandomEquivalent(a, b)
- require.Equal(t, tc.equal, got)
- }
-}
-
-func TestDeriveUpdateInfoFromMetadataDiff(t *testing.T) {
- time1 := timestamppb.Now()
- time2 := timestamppb.New(time1.AsTime().Add(1 * time.Second))
- testCases := []struct {
- metadataDiff *metadataDiffRootNode
- config *storepb.DatabaseConfig
- want *updateInfoDiffRootNode
- }{
- {
- metadataDiff: &metadataDiffRootNode{
- schemas: map[string]*metadataDiffSchemaNode{
- "": {
- tables: map[string]*metadataDiffTableNode{
- "t1": {
- diffBaseNode: diffBaseNode{
- action: diffActionCreate,
- },
- },
- "t2": {
- diffBaseNode: diffBaseNode{
- action: diffActionUpdate,
- },
- },
- "t3": {
- diffBaseNode: diffBaseNode{
- action: diffActionDrop,
- },
- },
- },
- },
- },
- },
- config: &storepb.DatabaseConfig{
- Schemas: []*storepb.SchemaCatalog{
- {
- Name: "",
- Tables: []*storepb.TableCatalog{
- {
- Name: "t1",
- Updater: "[email protected]",
- UpdateTime: time1,
- SourceBranch: "feat/01",
- },
- {
- Name: "t2",
- Updater: "[email protected]",
- UpdateTime: time2,
- SourceBranch: "feat/02",
- },
- },
- },
- },
- },
- want: &updateInfoDiffRootNode{
- schemas: map[string]*updateInfoDiffSchemaNode{
- "": {
- tables: map[string]*updateInfoDiffTableNode{
- "t1": {
- name: "t1",
- diffBaseNode: diffBaseNode{
- action: diffActionCreate,
- },
- updateInfo: &updateInfo{
- lastUpdatedTime: time1,
- lastUpdater: "[email protected]",
- sourceBranch: "feat/01",
- },
- },
- "t2": {
- name: "t2",
- diffBaseNode: diffBaseNode{
- action: diffActionUpdate,
- },
- updateInfo: &updateInfo{
- lastUpdatedTime: time2,
- lastUpdater: "[email protected]",
- sourceBranch: "feat/02",
- },
- },
- "t3": {
- name: "t3",
- diffBaseNode: diffBaseNode{
- action: diffActionDrop,
- },
- updateInfo: nil,
- },
- },
- views: map[string]*updateInfoDiffViewNode{},
- functions: map[string]*updateInfoDiffFunctionNode{},
- procedures: map[string]*updateInfoDiffProcedureNode{},
- },
- },
- },
- },
- }
-
- for _, tc := range testCases {
- got := deriveUpdateInfoFromMetadataDiff(tc.metadataDiff, tc.config)
- require.Equal(t, tc.want, got)
- }
-}
-
-func TestApplyUpdateInfoDiffRootNode(t *testing.T) {
- time1 := timestamppb.Now()
- time2 := timestamppb.New(time1.AsTime().Add(1 * time.Second))
- testCases := []struct {
- updateInfoDiffRootNode *updateInfoDiffRootNode
- config *storepb.DatabaseConfig
- want *storepb.DatabaseConfig
- }{
- {
- updateInfoDiffRootNode: &updateInfoDiffRootNode{
- schemas: map[string]*updateInfoDiffSchemaNode{
- "": {
- tables: map[string]*updateInfoDiffTableNode{
- "t1": {
- name: "t1",
- diffBaseNode: diffBaseNode{
- action: diffActionCreate,
- },
- updateInfo: &updateInfo{
- lastUpdatedTime: time2,
- lastUpdater: "[email protected]",
- sourceBranch: "feat/01",
- },
- },
- "t2": {
- name: "t2",
- diffBaseNode: diffBaseNode{
- action: diffActionDrop,
- },
- updateInfo: nil,
- },
- },
- views: map[string]*updateInfoDiffViewNode{},
- functions: map[string]*updateInfoDiffFunctionNode{},
- procedures: map[string]*updateInfoDiffProcedureNode{},
- },
- },
- },
- config: &storepb.DatabaseConfig{
- Schemas: []*storepb.SchemaCatalog{
- {
- Name: "",
- Tables: []*storepb.TableCatalog{
- {
- Name: "t1",
- Updater: "my",
- UpdateTime: time1,
- Columns: []*storepb.ColumnCatalog{
- {
- Name: "t",
- Classification: "1-1-1",
- },
- },
- },
- {
- Name: "t2",
- Updater: "my",
- UpdateTime: time1,
- },
- },
- },
- },
- },
- want: &storepb.DatabaseConfig{
- Schemas: []*storepb.SchemaCatalog{
- {
- Name: "",
- Tables: []*storepb.TableCatalog{
- {
- Name: "t1",
- UpdateTime: time2,
- Updater: "[email protected]",
- SourceBranch: "feat/01",
- Columns: []*storepb.ColumnCatalog{
- {
- Name: "t",
- Classification: "1-1-1",
- },
- },
- },
- },
- },
- },
- },
- },
- }
-
- for _, tc := range testCases {
- got := applyUpdateInfoDiffRootNode(tc.updateInfoDiffRootNode, tc.config)
- require.Equal(t, tc.want, got)
- }
-}
diff --git a/backend/api/v1/branch_service.go b/backend/api/v1/branch_service.go
index c7371d10aa..78bc3266fc 100644
--- a/backend/api/v1/branch_service.go
+++ b/backend/api/v1/branch_service.go
@@ -1,37 +1,15 @@
package v1
import (
- "bytes"
"context"
- "fmt"
- "io"
- "log/slog"
- "slices"
- "strconv"
- "strings"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
- "google.golang.org/protobuf/testing/protocmp"
- "google.golang.org/protobuf/types/known/emptypb"
- "google.golang.org/protobuf/types/known/timestamppb"
-
- "github.com/epiclabs-io/diff3"
- "github.com/google/go-cmp/cmp"
"github.com/bytebase/bytebase/backend/common"
- "github.com/bytebase/bytebase/backend/common/log"
- "github.com/bytebase/bytebase/backend/component/config"
- "github.com/bytebase/bytebase/backend/component/iam"
- enterprise "github.com/bytebase/bytebase/backend/enterprise/api"
- mysqldb "github.com/bytebase/bytebase/backend/plugin/db/mysql"
- tidbdb "github.com/bytebase/bytebase/backend/plugin/db/tidb"
"github.com/bytebase/bytebase/backend/plugin/parser/base"
- "github.com/bytebase/bytebase/backend/plugin/parser/mysql"
"github.com/bytebase/bytebase/backend/plugin/schema"
- "github.com/bytebase/bytebase/backend/store"
"github.com/bytebase/bytebase/backend/store/model"
- "github.com/bytebase/bytebase/backend/utils"
storepb "github.com/bytebase/bytebase/proto/generated-go/store"
v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
)
@@ -39,764 +17,11 @@ import (
// NewBranchService implements BranchServiceServer interface.
type BranchService struct {
v1pb.UnimplementedBranchServiceServer
- store *store.Store
- licenseService enterprise.LicenseService
- profile *config.Profile
- iamManager *iam.Manager
}
// NewBranchService creates a new BranchService.
-func NewBranchService(store *store.Store, licenseService enterprise.LicenseService, profile *config.Profile, iamManager *iam.Manager) *BranchService {
- return &BranchService{
- store: store,
- licenseService: licenseService,
- profile: profile,
- iamManager: iamManager,
- }
-}
-
-// GetBranch gets the branch.
-func (s *BranchService) GetBranch(ctx context.Context, request *v1pb.GetBranchRequest) (*v1pb.Branch, error) {
- projectID, branchID, err := common.GetProjectAndBranchID(request.Name)
- if err != nil {
- return nil, status.Error(codes.InvalidArgument, err.Error())
- }
- project, err := s.getProject(ctx, projectID)
- if err != nil {
- return nil, status.Error(codes.Internal, err.Error())
- }
-
- branch, err := s.store.GetBranch(ctx, &store.FindBranchMessage{ProjectID: &project.ResourceID, ResourceID: &branchID, LoadFull: true})
- if err != nil {
- return nil, err
- }
- if branch == nil {
- return nil, status.Errorf(codes.NotFound, "branch %q not found", branchID)
- }
-
- branchV1, err := s.convertBranchToBranch(ctx, project, branch, v1pb.BranchView_BRANCH_VIEW_FULL)
- if err != nil {
- return nil, err
- }
- return branchV1, nil
-}
-
-// ListBranches lists branches.
-func (s *BranchService) ListBranches(ctx context.Context, request *v1pb.ListBranchesRequest) (*v1pb.ListBranchesResponse, error) {
- projectID, err := common.GetProjectID(request.Parent)
- if err != nil {
- return nil, status.Error(codes.InvalidArgument, err.Error())
- }
- project, err := s.getProject(ctx, projectID)
- if err != nil {
- return nil, err
- }
-
- branchFind := &store.FindBranchMessage{
- ProjectID: &project.ResourceID,
- }
- if request.View == v1pb.BranchView_BRANCH_VIEW_FULL {
- branchFind.LoadFull = true
- }
- branches, err := s.store.ListBranches(ctx, branchFind)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to list branches, error %v", err)
- }
-
- var v1Branches []*v1pb.Branch
- for _, branch := range branches {
- v1Branch, err := s.convertBranchToBranch(ctx, project, branch, request.View)
- if err != nil {
- return nil, err
- }
- v1Branches = append(v1Branches, v1Branch)
- }
- response := &v1pb.ListBranchesResponse{
- Branches: v1Branches,
- }
- return response, nil
-}
-
-// CreateBranch creates a new branch.
-func (s *BranchService) CreateBranch(ctx context.Context, request *v1pb.CreateBranchRequest) (*v1pb.Branch, error) {
- branchID := request.BranchId
- // TODO(d): regex check.
- if branchID == "" {
- return nil, status.Errorf(codes.InvalidArgument, "branch ID is empty")
- }
- projectID, err := common.GetProjectID(request.Parent)
- if err != nil {
- return nil, status.Error(codes.InvalidArgument, err.Error())
- }
- project, err := s.getProject(ctx, projectID)
- if err != nil {
- return nil, err
- }
-
- branch, err := s.store.GetBranch(ctx, &store.FindBranchMessage{ProjectID: &project.ResourceID, ResourceID: &branchID, LoadFull: false})
- if err != nil {
- return nil, err
- }
- if branch != nil {
- return nil, status.Errorf(codes.FailedPrecondition, "branch %q has already existed", branchID)
- }
- user, ok := ctx.Value(common.UserContextKey).(*store.UserMessage)
- if !ok {
- return nil, status.Errorf(codes.Internal, "user not found")
- }
- // Main branch IAM admin check.
- if request.GetBranch().GetParentBranch() == "" {
- ok, err := s.iamManager.CheckPermission(ctx, iam.PermissionBranchesAdmin, user, project.ResourceID)
- if err != nil {
- return nil, err
- }
- if !ok {
- return nil, status.Errorf(codes.InvalidArgument, "only users with %s permission can create a main branch", iam.PermissionBranchesAdmin)
- }
- }
-
- var createdBranch *store.BranchMessage
- if request.Branch.ParentBranch != "" {
- parentProjectID, parentBranchID, err := common.GetProjectAndBranchID(request.Branch.ParentBranch)
- if err != nil {
- return nil, status.Error(codes.InvalidArgument, err.Error())
- }
- parentBranch, err := s.store.GetBranch(ctx, &store.FindBranchMessage{ProjectID: &parentProjectID, ResourceID: &parentBranchID, LoadFull: true})
- if err != nil {
- return nil, err
- }
- if parentBranch == nil {
- return nil, status.Errorf(codes.NotFound, "parent branch %q not found", parentBranchID)
- }
- parentBranchHeadConfig := parentBranch.Head.GetDatabaseConfig()
- created, err := s.store.CreateBranch(ctx, &store.BranchMessage{
- ProjectID: project.ResourceID,
- ResourceID: branchID,
- Engine: parentBranch.Engine,
- Base: &storepb.BranchSnapshot{
- Metadata: parentBranch.Head.Metadata,
- DatabaseConfig: parentBranchHeadConfig,
- },
- Head: &storepb.BranchSnapshot{
- Metadata: parentBranch.Head.Metadata,
- DatabaseConfig: parentBranchHeadConfig,
- },
- BaseSchema: parentBranch.HeadSchema,
- HeadSchema: parentBranch.HeadSchema,
- Config: &storepb.BranchConfig{
- SourceBranch: request.Branch.ParentBranch,
- SourceDatabase: parentBranch.Config.GetSourceDatabase(),
- },
- CreatorID: user.ID,
- })
- if err != nil {
- return nil, err
- }
- createdBranch = created
- } else if request.Branch.BaselineDatabase != "" {
- instanceID, databaseName, err := common.GetInstanceDatabaseID(request.Branch.BaselineDatabase)
- if err != nil {
- return nil, status.Error(codes.InvalidArgument, err.Error())
- }
- instance, err := s.store.GetInstanceV2(ctx, &store.FindInstanceMessage{ResourceID: &instanceID})
- if err != nil {
- return nil, status.Error(codes.InvalidArgument, err.Error())
- }
- database, err := s.store.GetDatabaseV2(ctx, &store.FindDatabaseMessage{
- InstanceID: &instanceID,
- DatabaseName: &databaseName,
- IgnoreCaseSensitive: store.IgnoreDatabaseAndTableCaseSensitive(instance),
- })
- if err != nil {
- return nil, status.Error(codes.Internal, err.Error())
- }
- if database == nil {
- return nil, status.Errorf(codes.NotFound, "database %q not found", databaseName)
- }
- databaseSchema, err := s.store.GetDBSchema(ctx, database.UID)
- if err != nil {
- return nil, status.Error(codes.Internal, err.Error())
- }
- if databaseSchema == nil {
- return nil, status.Errorf(codes.NotFound, "database schema %q not found", databaseName)
- }
- filteredBaseSchemaMetadata := filterDatabaseMetadataByEngine(databaseSchema.GetMetadata(), instance.Engine)
- baseSchema, err := schema.GetDesignSchema(instance.Engine, filteredBaseSchemaMetadata)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to create branch: %v", err)
- }
-
- classificationConfig, err := s.store.GetDataClassificationConfigByID(ctx, project.DataClassificationConfigID)
- if err != nil {
- return nil, status.Errorf(codes.Internal, `failed to get classification config by id "%s" with error: %v`, project.DataClassificationConfigID, err)
- }
-
- config := databaseSchema.GetConfig()
- sanitizeCommentForSchemaMetadata(filteredBaseSchemaMetadata, model.NewDatabaseConfig(config), classificationConfig.ClassificationFromConfig)
- initBranchLastUpdateInfoConfig(filteredBaseSchemaMetadata, config)
- config = alignDatabaseConfig(filteredBaseSchemaMetadata, config)
- created, err := s.store.CreateBranch(ctx, &store.BranchMessage{
- ProjectID: project.ResourceID,
- ResourceID: branchID,
- Engine: instance.Engine,
- Base: &storepb.BranchSnapshot{
- Metadata: filteredBaseSchemaMetadata,
- DatabaseConfig: config,
- },
- Head: &storepb.BranchSnapshot{
- Metadata: filteredBaseSchemaMetadata,
- DatabaseConfig: config,
- },
- BaseSchema: []byte(baseSchema),
- HeadSchema: []byte(baseSchema),
- Config: &storepb.BranchConfig{
- SourceDatabase: request.Branch.BaselineDatabase,
- },
- CreatorID: user.ID,
- })
- if err != nil {
- return nil, err
- }
- createdBranch = created
- } else {
- return nil, status.Errorf(codes.InvalidArgument, "either baseline database or parent branch must be specified")
- }
-
- v1Branch, err := s.convertBranchToBranch(ctx, project, createdBranch, v1pb.BranchView_BRANCH_VIEW_FULL)
- if err != nil {
- return nil, err
- }
- return v1Branch, nil
-}
-
-// UpdateBranch updates an existing branch.
-func (s *BranchService) UpdateBranch(ctx context.Context, request *v1pb.UpdateBranchRequest) (*v1pb.Branch, error) {
- projectID, branchID, err := common.GetProjectAndBranchID(request.Branch.Name)
- if err != nil {
- return nil, status.Errorf(codes.InvalidArgument, "invalid branch name: %v", err)
- }
- if request.UpdateMask == nil || len(request.UpdateMask.Paths) == 0 {
- return nil, status.Errorf(codes.InvalidArgument, "update_mask is required")
- }
- project, err := s.getProject(ctx, projectID)
- if err != nil {
- return nil, err
- }
-
- branch, err := s.store.GetBranch(ctx, &store.FindBranchMessage{ProjectID: &project.ResourceID, ResourceID: &branchID, LoadFull: true})
- if err != nil {
- return nil, err
- }
- if branch == nil {
- return nil, status.Errorf(codes.NotFound, "branch %q not found", branchID)
- }
- user, ok := ctx.Value(common.UserContextKey).(*store.UserMessage)
- if !ok {
- return nil, status.Errorf(codes.Internal, "user not found")
- }
- ok, err = func() (bool, error) {
- if branch.CreatorID == user.ID {
- return true, nil
- }
- return s.iamManager.CheckPermission(ctx, iam.PermissionBranchesUpdate, user, project.ResourceID)
- }()
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to check permission, error: %v", err)
- }
- if !ok {
- return nil, status.Errorf(codes.PermissionDenied, "permission denied to update branch")
- }
-
- if request.Etag != "" && request.Etag != fmt.Sprintf("%d", branch.UpdatedTime.UnixMilli()) {
- return nil, status.Errorf(codes.Aborted, "there is concurrent update to the branch, please refresh and try again.")
- }
-
- // Handle branch ID update.
- if slices.Contains(request.UpdateMask.Paths, "branch_id") {
- if len(request.UpdateMask.Paths) > 1 {
- return nil, status.Errorf(codes.InvalidArgument, "cannot update branch_id with other types of updates")
- }
- updateBranchMessage := &store.UpdateBranchMessage{ProjectID: project.ResourceID, ResourceID: branchID, UpdaterID: user.ID, UpdateResourceID: &request.Branch.BranchId}
- if err := s.store.UpdateBranch(ctx, updateBranchMessage); err != nil {
- return nil, status.Errorf(codes.Internal, "failed to update branch, error %v", err)
- }
- // Update the branchID for getting branch in the end.
- branchID = request.Branch.BranchId
- }
-
- if slices.Contains(request.UpdateMask.Paths, "schema_metadata") {
- metadata, err := convertV1DatabaseMetadata(request.Branch.GetSchemaMetadata())
- if err != nil {
- return nil, err
- }
- config := convertV1DatabaseConfig(
- ctx,
- &v1pb.DatabaseConfig{
- Name: metadata.Name,
- SchemaConfigs: request.Branch.GetSchemaMetadata().SchemaConfigs,
- },
- s.store,
- )
-
- classificationConfig, err := s.store.GetDataClassificationConfigByID(ctx, project.DataClassificationConfigID)
- if err != nil {
- return nil, status.Errorf(codes.Internal, `failed to get classification config by id "%s" with error: %v`, project.DataClassificationConfigID, err)
- }
- sanitizeCommentForSchemaMetadata(metadata, model.NewDatabaseConfig(config), classificationConfig.ClassificationFromConfig)
-
- reconcileMetadata(metadata, branch.Engine)
- filteredMetadata := filterDatabaseMetadataByEngine(metadata, branch.Engine)
- config = updateConfigBranchUpdateInfoForUpdate(branch.Head.Metadata, filteredMetadata, config, common.FormatUserUID(user.ID), common.FormatBranchResourceID(projectID, branchID))
- schema, err := schema.GetDesignSchema(branch.Engine, filteredMetadata)
- if err != nil {
- return nil, err
- }
- schemaBytes := []byte(schema)
- headUpdate := &storepb.BranchSnapshot{
- Metadata: filteredMetadata,
- DatabaseConfig: config,
- }
- updateBranchMessage := &store.UpdateBranchMessage{ProjectID: project.ResourceID, ResourceID: branchID, UpdaterID: user.ID}
- updateBranchMessage.Head = headUpdate
- updateBranchMessage.HeadSchema = &schemaBytes
- if err := s.store.UpdateBranch(ctx, updateBranchMessage); err != nil {
- return nil, status.Errorf(codes.Internal, "failed to update branch, error %v", err)
- }
- }
-
- branch, err = s.store.GetBranch(ctx, &store.FindBranchMessage{ProjectID: &project.ResourceID, ResourceID: &branchID, LoadFull: true})
- if err != nil {
- return nil, err
- }
- v1Branch, err := s.convertBranchToBranch(ctx, project, branch, v1pb.BranchView_BRANCH_VIEW_FULL)
- if err != nil {
- return nil, err
- }
- return v1Branch, nil
-}
-
-// MergeBranch merges a personal draft branch to the target branch.
-func (s *BranchService) MergeBranch(ctx context.Context, request *v1pb.MergeBranchRequest) (*v1pb.Branch, error) {
- projectID, baseBranchID, err := common.GetProjectAndBranchID(request.Name)
- if err != nil {
- return nil, status.Error(codes.InvalidArgument, err.Error())
- }
- project, err := s.getProject(ctx, projectID)
- if err != nil {
- return nil, err
- }
- baseBranch, err := s.store.GetBranch(ctx, &store.FindBranchMessage{ProjectID: &project.ResourceID, ResourceID: &baseBranchID, LoadFull: true})
- if err != nil {
- return nil, err
- }
- if baseBranch == nil {
- return nil, status.Errorf(codes.NotFound, "branch %q not found", baseBranchID)
- }
- if request.Etag != "" && request.Etag != fmt.Sprintf("%d", baseBranch.UpdatedTime.UnixMilli()) {
- return nil, status.Errorf(codes.Aborted, "there is concurrent update to the branch, please refresh and try again.")
- }
-
- user, ok := ctx.Value(common.UserContextKey).(*store.UserMessage)
- if !ok {
- return nil, status.Errorf(codes.Internal, "user not found")
- }
-
- headProjectID, headBranchID, err := common.GetProjectAndBranchID(request.HeadBranch)
- if err != nil {
- return nil, status.Error(codes.InvalidArgument, err.Error())
- }
- _, err = s.getProject(ctx, headProjectID)
- if err != nil {
- return nil, err
- }
- ok, err = s.iamManager.CheckPermission(ctx, iam.PermissionBranchesGet, user, headProjectID)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to check permission, error: %v", err)
- }
- if !ok {
- return nil, status.Errorf(codes.PermissionDenied, "permission denied to get head branch")
- }
- headBranch, err := s.store.GetBranch(ctx, &store.FindBranchMessage{ProjectID: &headProjectID, ResourceID: &headBranchID, LoadFull: true})
- if err != nil {
- return nil, err
- }
- if headBranch == nil {
- return nil, status.Errorf(codes.NotFound, "branch %q not found", headBranchID)
- }
-
- ok, err = func() (bool, error) {
- if baseBranch.CreatorID == user.ID {
- return true, nil
- }
- if headBranch.CreatorID == user.ID {
- return true, nil
- }
- return s.iamManager.CheckPermission(ctx, iam.PermissionBranchesUpdate, user, project.ResourceID)
- }()
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to check permission, error: %v", err)
- }
- if !ok {
- return nil, status.Errorf(codes.PermissionDenied, "permission denied to merge branch")
- }
-
- // Restrict merging only when the head branch is not updated.
- // Maybe we can support auto-merging in the future.
-
- classificationConfig, err := s.store.GetDataClassificationConfigByID(ctx, project.DataClassificationConfigID)
- if err != nil {
- return nil, status.Errorf(codes.Internal, `failed to get classification config by id "%s" with error: %v`, project.DataClassificationConfigID, err)
- }
-
- // The first crazy night in 2024.
- sanitizeCommentForSchemaMetadata(headBranch.Base.Metadata, model.NewDatabaseConfig(headBranch.Base.DatabaseConfig), classificationConfig.ClassificationFromConfig)
- sanitizeCommentForSchemaMetadata(headBranch.Head.Metadata, model.NewDatabaseConfig(headBranch.Head.DatabaseConfig), classificationConfig.ClassificationFromConfig)
- sanitizeCommentForSchemaMetadata(baseBranch.Head.Metadata, model.NewDatabaseConfig(baseBranch.Head.DatabaseConfig), classificationConfig.ClassificationFromConfig)
-
- adHead, adConfig, err := tryMerge(headBranch.Base.Metadata, headBranch.Head.Metadata, baseBranch.Head.Metadata, headBranch.Base.DatabaseConfig, headBranch.Head.DatabaseConfig, baseBranch.Head.DatabaseConfig, baseBranch.Engine)
- if err != nil {
- slog.Info("cannot merge branches", log.BBError(err))
- return nil, status.Errorf(codes.Aborted, "cannot merge branches without conflict, error: %v", err)
- }
- mergedMetadata, mergedConfig, err := tryMerge(baseBranch.Head.Metadata, adHead, baseBranch.Head.Metadata, baseBranch.Head.DatabaseConfig, adConfig, baseBranch.Head.DatabaseConfig, baseBranch.Engine)
- if err != nil {
- slog.Info("cannot merge branches", log.BBError(err))
- return nil, status.Errorf(codes.Aborted, "cannot merge branches without conflict, error: %v", err)
- }
- if mergedMetadata == nil {
- return nil, status.Errorf(codes.Internal, "merged metadata should not be nil if there is no error while merging (%+v, %+v, %+v)", headBranch.Base.Metadata, headBranch.Head.Metadata, baseBranch.Head.Metadata)
- }
- mergedSchema, err := schema.GetDesignSchema(storepb.Engine(baseBranch.Engine), mergedMetadata)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to convert merged metadata to schema string, %v", err)
- }
- // XXX(zp): We only try to merge the schema config while the schema could be merged successfully. Otherwise, users manually merge the
- // metadata in the frontend, and config would be ignored.
- classificationIDSource := utils.MergeDatabaseConfig(baseBranch.Head.GetDatabaseConfig(), headBranch.Base.GetDatabaseConfig(), headBranch.Head.GetDatabaseConfig())
- setClassificationIDToConfig(classificationIDSource, mergedConfig)
-
- mergedSchemaBytes := []byte(mergedSchema)
-
- reconcileMetadata(mergedMetadata, baseBranch.Engine)
- filteredMergedMetadata := filterDatabaseMetadataByEngine(mergedMetadata, baseBranch.Engine)
- baseBranchNewHead := &storepb.BranchSnapshot{
- Metadata: filteredMergedMetadata,
- DatabaseConfig: mergedConfig,
- }
- baseBranchNewHeadSchema := mergedSchemaBytes
-
- if request.ValidateOnly {
- baseBranch.Head = baseBranchNewHead
- baseBranch.HeadSchema = baseBranchNewHeadSchema
- } else {
- if err := s.store.UpdateBranch(ctx, &store.UpdateBranchMessage{
- ProjectID: project.ResourceID,
- ResourceID: baseBranchID,
- UpdaterID: user.ID,
- Head: baseBranchNewHead,
- HeadSchema: &baseBranchNewHeadSchema,
- }); err != nil {
- return nil, status.Errorf(codes.Internal, "failed update branch, error %v", err)
- }
- baseBranch, err = s.store.GetBranch(ctx, &store.FindBranchMessage{ProjectID: &project.ResourceID, ResourceID: &baseBranchID, LoadFull: true})
- if err != nil {
- return nil, err
- }
- }
-
- v1Branch, err := s.convertBranchToBranch(ctx, project, baseBranch, v1pb.BranchView_BRANCH_VIEW_FULL)
- if err != nil {
- return nil, err
- }
- return v1Branch, nil
-}
-
-// RebaseBranch rebases a branch to the target branch.
-func (s *BranchService) RebaseBranch(ctx context.Context, request *v1pb.RebaseBranchRequest) (*v1pb.RebaseBranchResponse, error) {
- baseProjectID, baseBranchID, err := common.GetProjectAndBranchID(request.Name)
- if err != nil {
- return nil, status.Error(codes.InvalidArgument, err.Error())
- }
- baseProject, err := s.getProject(ctx, baseProjectID)
- if err != nil {
- return nil, err
- }
- baseBranch, err := s.store.GetBranch(ctx, &store.FindBranchMessage{ProjectID: &baseProject.ResourceID, ResourceID: &baseBranchID, LoadFull: true})
- if err != nil {
- return nil, err
- }
- if baseBranch == nil {
- return nil, status.Errorf(codes.NotFound, "branch %q not found", baseBranchID)
- }
- if request.Etag != "" && request.Etag != fmt.Sprintf("%d", baseBranch.UpdatedTime.UnixMilli()) {
- return nil, status.Errorf(codes.Aborted, "there is concurrent update to the branch, please refresh and try again.")
- }
-
- user, ok := ctx.Value(common.UserContextKey).(*store.UserMessage)
- if !ok {
- return nil, status.Errorf(codes.Internal, "user not found")
- }
- ok, err = func() (bool, error) {
- if baseBranch.CreatorID == user.ID {
- return true, nil
- }
- return s.iamManager.CheckPermission(ctx, iam.PermissionBranchesUpdate, user, baseProject.ResourceID)
- }()
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to check permission, error: %v", err)
- }
- if !ok {
- return nil, status.Errorf(codes.PermissionDenied, "permission denied to rebase branch")
- }
- // Main branch IAM admin check.
- if baseBranch.Config.GetSourceBranch() == "" {
- ok, err := s.iamManager.CheckPermission(ctx, iam.PermissionBranchesAdmin, user, baseProject.ResourceID)
- if err != nil {
- return nil, err
- }
- if !ok {
- return nil, status.Errorf(codes.InvalidArgument, "only users with %s permission can rebase a main branch", iam.PermissionBranchesAdmin)
- }
- }
-
- filteredNewBaseMetadata, newBaseSchema, newBaseConfig, err := s.getFilteredNewBaseFromRebaseRequest(ctx, request)
- if err != nil {
- return nil, err
- }
-
- var newHeadMetadata *storepb.DatabaseSchemaMetadata
- var newHeadConfig *storepb.DatabaseConfig
- if request.MergedSchema != "" {
- newHeadMetadata, err = schema.ParseToMetadata(baseBranch.Engine, "" /* defaultSchemaName */, request.MergedSchema)
- if err != nil {
- return nil, status.Errorf(codes.InvalidArgument, "failed to convert merged schema to metadata, %v", err)
- }
- newHeadMetadata = filterDatabaseMetadataByEngine(newHeadMetadata, baseBranch.Engine)
- newHeadConfig = baseBranch.Head.GetDatabaseConfig()
- // While users manually merge the metadata in the frontend, the config is stale.
- // We should align the config with the merged metadata.
- classificationConfig, err := s.store.GetDataClassificationConfigByID(ctx, baseProject.DataClassificationConfigID)
- if err != nil {
- return nil, status.Errorf(codes.Internal, `failed to get classification config by id "%s" with error: %v`, baseProject.DataClassificationConfigID, err)
- }
- newHeadConfig = alignDatabaseConfig(newHeadMetadata, newHeadConfig)
- // String-based rebase operation do not include the structural information, such as classification, so we need to sanitize the user comment,
- // trim the classification in user comment if the classification is not from the config.
- trimClassificationIDFromCommentIfNeeded(newHeadMetadata, classificationConfig)
- modelNewHeadConfig := model.NewDatabaseConfig(newHeadConfig)
- sanitizeCommentForSchemaMetadata(newHeadMetadata, modelNewHeadConfig, classificationConfig.ClassificationFromConfig)
-
- // If users solve the conflict manually, it is equivalent to them updating HEAD on the branch first.
- newHeadConfig = updateConfigBranchUpdateInfoForUpdate(baseBranch.Head.Metadata, newHeadMetadata, newHeadConfig, common.FormatUserUID(user.ID), common.FormatBranchResourceID(baseProjectID, baseBranchID))
- newHeadConfig = alignDatabaseConfig(newHeadMetadata, newHeadConfig)
- } else {
- newHeadMetadata, newHeadConfig, err = tryMerge(baseBranch.Base.Metadata, baseBranch.Head.Metadata, filteredNewBaseMetadata, baseBranch.Base.DatabaseConfig, baseBranch.Head.DatabaseConfig, newBaseConfig, baseBranch.Engine)
- if err != nil {
- slog.Info("cannot rebase branches", log.BBError(err))
- conflictSchema, err := diff3.Merge(
- strings.NewReader(newBaseSchema),
- bytes.NewReader(baseBranch.BaseSchema),
- bytes.NewReader(baseBranch.HeadSchema),
- true,
- "HEAD",
- baseBranch.ResourceID,
- )
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to compute conflict schema, %v", err)
- }
- sb, err := io.ReadAll(conflictSchema.Result)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to read conflict schema, %v", err)
- }
- if strings.HasSuffix(newBaseSchema, "\n") && bytes.HasSuffix(baseBranch.BaseSchema, []byte("\n")) && bytes.HasSuffix(baseBranch.HeadSchema, []byte("\n")) {
- sb = append(sb, []byte("\n")...)
- }
- conflictSchemaString := string(sb)
- return &v1pb.RebaseBranchResponse{Result: &v1pb.RebaseBranchResponse_ConflictSchema{ConflictSchema: conflictSchemaString}}, nil
- }
- if newHeadMetadata == nil {
- return nil, status.Errorf(codes.Internal, "merged metadata should not be nil if there is no error while merging (%+v, %+v, %+v)", baseBranch.Base.Metadata, baseBranch.Head.Metadata, filteredNewBaseMetadata)
- }
- alignDatabaseConfig(newHeadMetadata, newHeadConfig)
- // XXX(zp): We only try to merge the schema config while the schema could be merged successfully. Otherwise, users manually merge the
- // metadata in the frontend, and config would be ignored.
- classificationIDSource := utils.MergeDatabaseConfig(newBaseConfig, baseBranch.Base.GetDatabaseConfig(), baseBranch.Head.GetDatabaseConfig())
- setClassificationIDToConfig(classificationIDSource, newHeadConfig)
- }
-
- reconcileMetadata(newHeadMetadata, baseBranch.Engine)
- filteredNewHeadMetadata := filterDatabaseMetadataByEngine(newHeadMetadata, baseBranch.Engine)
- newHeadSchema, err := schema.GetDesignSchema(storepb.Engine(baseBranch.Engine), filteredNewHeadMetadata)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to convert new head metadata to schema string, %v", err)
- }
- newBaseSchemaBytes := []byte(newBaseSchema)
- newHeadSchemaBytes := []byte(newHeadSchema)
- if request.ValidateOnly {
- baseBranch.Base = &storepb.BranchSnapshot{
- Metadata: filteredNewBaseMetadata,
- DatabaseConfig: newBaseConfig,
- }
- baseBranch.BaseSchema = newBaseSchemaBytes
- baseBranch.Head = &storepb.BranchSnapshot{
- Metadata: filteredNewHeadMetadata,
- DatabaseConfig: newHeadConfig,
- }
- baseBranch.HeadSchema = newHeadSchemaBytes
- } else {
- if err := s.store.UpdateBranch(ctx, &store.UpdateBranchMessage{
- ProjectID: baseProject.ResourceID,
- ResourceID: baseBranchID,
- UpdaterID: user.ID,
- Base: &storepb.BranchSnapshot{
- Metadata: filteredNewBaseMetadata,
- DatabaseConfig: newBaseConfig,
- },
- BaseSchema: &newBaseSchemaBytes,
- Head: &storepb.BranchSnapshot{
- Metadata: filteredNewHeadMetadata,
- // TODO(d): handle config.
- DatabaseConfig: newHeadConfig,
- },
- HeadSchema: &newHeadSchemaBytes,
- }); err != nil {
- return nil, status.Errorf(codes.Internal, "failed update branch, error %v", err)
- }
- baseBranch, err = s.store.GetBranch(ctx, &store.FindBranchMessage{ProjectID: &baseProject.ResourceID, ResourceID: &baseBranchID, LoadFull: true})
- if err != nil {
- return nil, err
- }
- }
- v1Branch, err := s.convertBranchToBranch(ctx, baseProject, baseBranch, v1pb.BranchView_BRANCH_VIEW_FULL)
- if err != nil {
- return nil, err
- }
- return &v1pb.RebaseBranchResponse{Result: &v1pb.RebaseBranchResponse_Branch{Branch: v1Branch}}, nil
-}
-
-func (s *BranchService) getFilteredNewBaseFromRebaseRequest(ctx context.Context, request *v1pb.RebaseBranchRequest) (*storepb.DatabaseSchemaMetadata, string, *storepb.DatabaseConfig, error) {
- if request.SourceDatabase != "" {
- instanceID, databaseName, err := common.GetInstanceDatabaseID(request.SourceDatabase)
- if err != nil {
- return nil, "", nil, status.Error(codes.InvalidArgument, err.Error())
- }
- instance, err := s.store.GetInstanceV2(ctx, &store.FindInstanceMessage{ResourceID: &instanceID})
- if err != nil {
- return nil, "", nil, status.Error(codes.InvalidArgument, err.Error())
- }
- if instance == nil {
- return nil, "", nil, status.Errorf(codes.NotFound, "instance %q not found or had been deleted", instanceID)
- }
- database, err := s.store.GetDatabaseV2(ctx, &store.FindDatabaseMessage{
- InstanceID: &instanceID,
- DatabaseName: &databaseName,
- IgnoreCaseSensitive: store.IgnoreDatabaseAndTableCaseSensitive(instance),
- })
- if err != nil {
- return nil, "", nil, status.Error(codes.Internal, err.Error())
- }
- if database == nil {
- return nil, "", nil, status.Errorf(codes.NotFound, "database %q not found or had been archive", databaseName)
- }
- databaseSchema, err := s.store.GetDBSchema(ctx, database.UID)
- if err != nil {
- return nil, "", nil, status.Error(codes.Internal, err.Error())
- }
- if databaseSchema == nil {
- return nil, "", nil, status.Errorf(codes.NotFound, "database schema %q not found", databaseName)
- }
- databaseMetadata := databaseSchema.GetMetadata()
- filteredNewBaseMetadata := filterDatabaseMetadataByEngine(databaseMetadata, instance.Engine)
- sourceSchema, err := schema.GetDesignSchema(instance.Engine, filteredNewBaseMetadata)
- if err != nil {
- return nil, "", nil, status.Error(codes.Internal, err.Error())
- }
-
- alignedDatabaseConfig := alignDatabaseConfig(filteredNewBaseMetadata, databaseSchema.GetConfig())
- return filteredNewBaseMetadata, sourceSchema, alignedDatabaseConfig, nil
- }
-
- if request.SourceBranch != "" {
- sourceProjectID, sourceBranchID, err := common.GetProjectAndBranchID(request.SourceBranch)
- if err != nil {
- return nil, "", nil, status.Error(codes.InvalidArgument, err.Error())
- }
- sourceBranch, err := s.store.GetBranch(ctx, &store.FindBranchMessage{ProjectID: &sourceProjectID, ResourceID: &sourceBranchID, LoadFull: true})
- if err != nil {
- return nil, "", nil, err
- }
- if sourceBranch == nil {
- return nil, "", nil, status.Errorf(codes.NotFound, "branch %q not found", sourceBranchID)
- }
- return sourceBranch.Head.GetMetadata(), string(sourceBranch.HeadSchema), sourceBranch.Head.GetDatabaseConfig(), nil
- }
-
- return nil, "", nil, status.Errorf(codes.InvalidArgument, "either source_database or source_branch should be specified")
-}
-
-// DeleteBranch deletes an existing branch.
-func (s *BranchService) DeleteBranch(ctx context.Context, request *v1pb.DeleteBranchRequest) (*emptypb.Empty, error) {
- projectID, branchID, err := common.GetProjectAndBranchID(request.Name)
- if err != nil {
- return nil, status.Error(codes.InvalidArgument, err.Error())
- }
- project, err := s.getProject(ctx, projectID)
- if err != nil {
- return nil, status.Error(codes.Internal, err.Error())
- }
- branch, err := s.store.GetBranch(ctx, &store.FindBranchMessage{ProjectID: &project.ResourceID, ResourceID: &branchID, LoadFull: false})
- if err != nil {
- return nil, err
- }
- if branch == nil {
- return nil, status.Errorf(codes.NotFound, "branch %q not found", branchID)
- }
-
- user, ok := ctx.Value(common.UserContextKey).(*store.UserMessage)
- if !ok {
- return nil, status.Errorf(codes.Internal, "user not found")
- }
- ok, err = func() (bool, error) {
- if branch.CreatorID == user.ID {
- return true, nil
- }
- return s.iamManager.CheckPermission(ctx, iam.PermissionBranchesDelete, user, project.ResourceID)
- }()
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to check permission, error: %v", err)
- }
- if !ok {
- return nil, status.Errorf(codes.PermissionDenied, "permission denied to delete branch")
- }
- // Main branch IAM admin check.
- if branch.Config.GetSourceBranch() == "" {
- ok, err := s.iamManager.CheckPermission(ctx, iam.PermissionBranchesAdmin, user, project.ResourceID)
- if err != nil {
- return nil, err
- }
- if !ok {
- return nil, status.Errorf(codes.InvalidArgument, "only users with %s permission can delete a main branch", iam.PermissionBranchesAdmin)
- }
- }
-
- if !request.Force {
- childBranches, err := s.store.ListBranches(ctx, &store.FindBranchMessage{
- ProjectID: &project.ResourceID,
- LoadFull: false,
- ParentBranchResourceID: &request.Name,
- })
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to list child branches, error %v", err)
- }
- if len(childBranches) > 0 {
- return nil, status.Errorf(codes.FailedPrecondition, "branch %q has child branches, please delete them first", branchID)
- }
- }
-
- if err := s.store.DeleteBranch(ctx, project.ResourceID, branch.ResourceID); err != nil {
- return nil, status.Errorf(codes.Internal, "failed to delete branch, error %v", err)
- }
- return &emptypb.Empty{}, nil
+func NewBranchService() *BranchService {
+ return &BranchService{}
}
func (*BranchService) DiffMetadata(ctx context.Context, request *v1pb.DiffMetadataRequest) (*v1pb.DiffMetadataResponse, error) {
@@ -865,211 +90,6 @@ func (*BranchService) DiffMetadata(ctx context.Context, request *v1pb.DiffMetada
Diff: diff,
}, nil
}
-
-func (s *BranchService) getProject(ctx context.Context, projectID string) (*store.ProjectMessage, error) {
- project, err := s.store.GetProjectV2(ctx, &store.FindProjectMessage{
- ResourceID: &projectID,
- })
- if err != nil {
- return nil, status.Error(codes.Internal, err.Error())
- }
- if project == nil {
- return nil, status.Errorf(codes.NotFound, "project %q not found", projectID)
- }
- if project.Deleted {
- return nil, status.Errorf(codes.NotFound, "project %q has been deleted", projectID)
- }
- return project, nil
-}
-
-func (s *BranchService) convertBranchToBranch(ctx context.Context, project *store.ProjectMessage, branch *store.BranchMessage, view v1pb.BranchView) (*v1pb.Branch, error) {
- creator, err := s.store.GetUserByID(ctx, branch.CreatorID)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get creator, error %v", err)
- }
- if creator == nil {
- return nil, status.Errorf(codes.NotFound, "creator %d not found", branch.CreatorID)
- }
- updater, err := s.store.GetUserByID(ctx, branch.UpdaterID)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get updater, error %v", err)
- }
- if updater == nil {
- return nil, status.Errorf(codes.NotFound, "updater %d not found", branch.UpdaterID)
- }
-
- var baselineDatabase, baselineBranch string
- if branch.Config != nil {
- baselineDatabase = branch.Config.SourceDatabase
- if branch.Config.SourceBranch != "" {
- baselineBranch = branch.Config.SourceBranch
- }
- }
-
- v1Branch := &v1pb.Branch{
- Name: common.FormatBranchResourceID(project.ResourceID, branch.ResourceID),
- BranchId: branch.ResourceID,
- Etag: fmt.Sprintf("%d", branch.UpdatedTime.UnixMilli()),
- ParentBranch: baselineBranch,
- Engine: v1pb.Engine(branch.Engine),
- BaselineDatabase: baselineDatabase,
- Creator: common.FormatUserEmail(creator.Email),
- Updater: common.FormatUserEmail(updater.Email),
- CreateTime: timestamppb.New(branch.CreatedTime),
- UpdateTime: timestamppb.New(branch.UpdatedTime),
- }
-
- if view != v1pb.BranchView_BRANCH_VIEW_FULL {
- return v1Branch, nil
- }
-
- v1Branch.Schema = string(branch.HeadSchema)
- sm, err := convertStoreDatabaseMetadata(branch.Head.Metadata, nil /* filter */)
- if err != nil {
- return nil, err
- }
- smc := convertStoreDatabaseConfig(ctx, branch.Head.DatabaseConfig, nil /* filter */, s.store)
- if smc != nil {
- sm.SchemaConfigs = smc.SchemaConfigs
- }
-
- v1Branch.SchemaMetadata = sm
- v1Branch.BaselineSchema = string(branch.BaseSchema)
- bsm, err := convertStoreDatabaseMetadata(branch.Base.Metadata, nil /* filter */)
- if err != nil {
- return nil, err
- }
- bsmc := convertStoreDatabaseConfig(ctx, branch.Base.DatabaseConfig, nil /* filter */, s.store)
- if bsmc != nil {
- bsm.SchemaConfigs = bsmc.SchemaConfigs
- }
- v1Branch.BaselineSchemaMetadata = bsm
- return v1Branch, nil
-}
-
-func sanitizeCommentForSchemaMetadata(dbSchema *storepb.DatabaseSchemaMetadata, dbModelConfig *model.DatabaseConfig, classificationFromConfig bool) {
- for _, schema := range dbSchema.Schemas {
- schemaConfig := dbModelConfig.CreateOrGetSchemaConfig(schema.Name)
- for _, table := range schema.Tables {
- tableConfig := schemaConfig.CreateOrGetTableConfig(table.Name)
- classificationID := ""
- if !classificationFromConfig {
- classificationID = tableConfig.Classification
- }
- table.Comment = common.GetCommentFromClassificationAndUserComment(classificationID, table.UserComment)
- for _, col := range table.Columns {
- columnConfig := tableConfig.CreateOrGetColumnConfig(col.Name)
- classificationID := ""
- if !classificationFromConfig {
- classificationID = columnConfig.Classification
- }
- col.Comment = common.GetCommentFromClassificationAndUserComment(classificationID, col.UserComment)
- }
- }
- }
-}
-
-// filterDatabaseMetadata filter out the objects/attributes we do not support.
-// TODO: While supporting new objects/attributes, we should update this function.
-func filterDatabaseMetadataByEngine(metadata *storepb.DatabaseSchemaMetadata, engine storepb.Engine) *storepb.DatabaseSchemaMetadata {
- filteredDatabase := &storepb.DatabaseSchemaMetadata{
- Name: metadata.Name,
- }
- for _, schema := range metadata.Schemas {
- filteredSchema := &storepb.SchemaMetadata{
- Name: schema.Name,
- }
- for _, table := range schema.Tables {
- filteredTable := &storepb.TableMetadata{
- Name: table.Name,
- Comment: table.Comment,
- UserComment: table.UserComment,
- // For Display only.
- Collation: table.Collation,
- Engine: table.Engine,
- }
- for _, column := range table.Columns {
- filteredColumn := &storepb.ColumnMetadata{
- Name: column.Name,
- OnUpdate: column.OnUpdate,
- Comment: column.Comment,
- UserComment: column.UserComment,
- Type: column.Type,
- DefaultValue: column.DefaultValue,
- Nullable: column.Nullable,
- }
- filteredTable.Columns = append(filteredTable.Columns, filteredColumn)
- }
- for _, index := range table.Indexes {
- filteredIndex := &storepb.IndexMetadata{
- Name: index.Name,
- Definition: index.Definition,
- Primary: index.Primary,
- Unique: index.Unique,
- Comment: index.Comment,
- Expressions: index.Expressions,
- }
- filteredTable.Indexes = append(filteredTable.Indexes, filteredIndex)
- }
- for _, fk := range table.ForeignKeys {
- filteredFK := &storepb.ForeignKeyMetadata{
- Name: fk.Name,
- Columns: fk.Columns,
- ReferencedTable: fk.ReferencedTable,
- ReferencedColumns: fk.ReferencedColumns,
- ReferencedSchema: fk.ReferencedSchema,
- }
- filteredTable.ForeignKeys = append(filteredTable.ForeignKeys, filteredFK)
- }
- if engine == storepb.Engine_MYSQL || engine == storepb.Engine_TIDB {
- filteredTable.Partitions = table.Partitions
- }
- filteredSchema.Tables = append(filteredSchema.Tables, filteredTable)
- }
-
- if engine == storepb.Engine_MYSQL || engine == storepb.Engine_TIDB {
- for _, view := range schema.Views {
- filteredView := &storepb.ViewMetadata{
- Name: view.Name,
- Comment: view.Comment,
- Definition: view.Definition,
- }
- filteredSchema.Views = append(filteredSchema.Views, filteredView)
- }
- }
-
- if engine == storepb.Engine_MYSQL {
- for _, function := range schema.Functions {
- filteredFunction := &storepb.FunctionMetadata{
- Name: function.Name,
- Definition: function.Definition,
- Signature: function.Signature,
- CharacterSetClient: function.CharacterSetClient,
- CollationConnection: function.CollationConnection,
- DatabaseCollation: function.DatabaseCollation,
- SqlMode: function.SqlMode,
- }
- filteredSchema.Functions = append(filteredSchema.Functions, filteredFunction)
- }
- for _, procedure := range schema.Procedures {
- filteredProcedure := &storepb.ProcedureMetadata{
- Name: procedure.Name,
- Definition: procedure.Definition,
- Signature: procedure.Signature,
- CharacterSetClient: procedure.CharacterSetClient,
- CollationConnection: procedure.CollationConnection,
- DatabaseCollation: procedure.DatabaseCollation,
- SqlMode: procedure.SqlMode,
- }
- filteredSchema.Procedures = append(filteredSchema.Procedures, filteredProcedure)
- }
- }
- filteredDatabase.Schemas = append(filteredDatabase.Schemas, filteredSchema)
- }
-
- return filteredDatabase
-}
-
func trimDatabaseMetadata(sourceMetadata *storepb.DatabaseSchemaMetadata, targetMetadata *storepb.DatabaseSchemaMetadata) (*storepb.DatabaseSchemaMetadata, *storepb.DatabaseSchemaMetadata) {
// TODO(d): handle indexes, etc.
sourceModel, targetModel := model.NewDatabaseMetadata(sourceMetadata), model.NewDatabaseMetadata(targetMetadata)
@@ -1192,553 +212,3 @@ func trimDatabaseMetadata(sourceMetadata *storepb.DatabaseSchemaMetadata, target
return s, t
}
-
-func reconcileMetadata(metadata *storepb.DatabaseSchemaMetadata, engine storepb.Engine) {
- for _, schema := range metadata.Schemas {
- for _, table := range schema.Tables {
- if engine == storepb.Engine_MYSQL {
- reconcileMySQLPartitionMetadata(table.Partitions, "")
- }
- if engine == storepb.Engine_MYSQL {
- for _, column := range table.GetColumns() {
- // If the column can take NULL as a value, the column is defined with an explicit DEFAULT NULL clause.
- if column.Nullable && column.DefaultValue == nil {
- column.DefaultValue = &storepb.ColumnMetadata_DefaultNull{
- DefaultNull: true,
- }
- }
- column.Type = mysqldb.GetColumnTypeCanonicalSynonym(column.Type)
- }
- } else if engine == storepb.Engine_TIDB {
- for _, column := range table.GetColumns() {
- // If the column can take NULL as a value, the column is defined with an explicit DEFAULT NULL clause.
- if column.Nullable && column.DefaultValue == nil {
- column.DefaultValue = &storepb.ColumnMetadata_DefaultNull{
- DefaultNull: true,
- }
- }
- column.Type = tidbdb.GetColumnTypeCanonicalSynonym(column.Type)
- }
- }
- }
- for _, view := range schema.Views {
- if engine == storepb.Engine_MYSQL || engine == storepb.Engine_TIDB {
- view.Definition = formatViewDef(view.Definition)
- }
- }
- }
-}
-
-func reconcileMySQLPartitionMetadata(partitions []*storepb.TablePartitionMetadata, parentName string) {
- if len(partitions) == 0 {
- return
- }
- defaultParentGenerator := mysql.NewPartitionDefaultNameGenerator(parentName)
- defaultParentNames := make([]string, len(partitions))
- for i := range partitions {
- defaultParentNames[i] = defaultParentGenerator.Next()
- }
-
- if len(partitions) > 0 && partitions[0].UseDefault != "" {
- useDefault, err := strconv.Atoi(partitions[0].UseDefault)
- if err != nil {
- slog.Warn("failed to parse use default", log.BBError(err))
- return
- }
- if useDefault != 0 && useDefault != len(partitions) {
- for i := range partitions {
- partitions[i].UseDefault = strconv.Itoa(len(partitions))
- }
- }
- }
- names := make([]string, len(partitions))
- for i := range partitions {
- names[i] = partitions[i].Name
- }
- if !slices.Equal(names, defaultParentNames) {
- for i := range partitions {
- partitions[i].UseDefault = ""
- }
- }
-
- for _, partition := range partitions {
- reconcileMySQLPartitionMetadata(partition.Subpartitions, partition.Name)
- }
-}
-
-// updateConfigBranchUpdateInfoForUpdate compare the proto of old and new metadata, and update the config branch update info.
-// NOTE: this function would not delete the config of deleted objects, and it's safe because the next time adding the object
-// back will trigger the update of the config branch update info.
-func updateConfigBranchUpdateInfoForUpdate(o *storepb.DatabaseSchemaMetadata, n *storepb.DatabaseSchemaMetadata, config *storepb.DatabaseConfig, formattedUserUID string, formattedBranchResourceID string) *storepb.DatabaseConfig {
- time := timestamppb.Now()
-
- alignedConfig := alignDatabaseConfig(n, config)
- oldModel := model.NewDatabaseMetadata(o)
-
- newSchemaConfigMap := buildMap(alignedConfig.Schemas, func(s *storepb.SchemaCatalog) string {
- return s.Name
- })
- var newSchemaConfigs []*storepb.SchemaCatalog
- for _, schema := range n.Schemas {
- newSchemaConfig, ok := newSchemaConfigMap[schema.Name]
- if !ok {
- newSchemaConfigs = append(newSchemaConfigs, initSchemaConfig(schema, formattedUserUID, formattedBranchResourceID, time))
- continue
- }
- oldSchema := oldModel.GetSchema(schema.Name)
- if oldSchema == nil {
- for _, tableConfig := range newSchemaConfig.Tables {
- tableConfig.Updater = formattedUserUID
- tableConfig.UpdateTime = time
- tableConfig.SourceBranch = formattedBranchResourceID
- }
- for _, viewConfig := range newSchemaConfig.ViewConfigs {
- viewConfig.Updater = formattedUserUID
- viewConfig.UpdateTime = time
- viewConfig.SourceBranch = formattedBranchResourceID
- }
- for _, functionConfig := range newSchemaConfig.FunctionConfigs {
- functionConfig.Updater = formattedUserUID
- functionConfig.UpdateTime = time
- functionConfig.SourceBranch = formattedBranchResourceID
- }
- for _, procedureConfig := range newSchemaConfig.ProcedureConfigs {
- procedureConfig.Updater = formattedUserUID
- procedureConfig.UpdateTime = time
- procedureConfig.SourceBranch = formattedBranchResourceID
- }
- continue
- }
-
- var newTableConfig []*storepb.TableCatalog
- tableConfigMap := buildMap(newSchemaConfig.Tables, func(t *storepb.TableCatalog) string {
- return t.Name
- })
- for _, table := range schema.Tables {
- tableConfig, ok := tableConfigMap[table.Name]
- if !ok {
- newTableConfig = append(newTableConfig, initTableConfig(table, formattedUserUID, formattedBranchResourceID, time))
- continue
- }
- oldTable := oldSchema.GetTable(table.Name)
- if oldTable == nil {
- // If users delete the table first, and then add it back, we should update the config branch update info.
- tableConfig.Updater = formattedUserUID
- tableConfig.UpdateTime = time
- tableConfig.SourceBranch = formattedBranchResourceID
- continue
- }
- if diff := cmp.Diff(table, oldTable.GetProto(), protocmp.Transform()); diff != "" {
- tableConfig.Updater = formattedUserUID
- tableConfig.UpdateTime = time
- tableConfig.SourceBranch = formattedBranchResourceID
- }
- }
-
- var newViewConfig []*storepb.ViewConfig
- viewConfigMap := buildMap(newSchemaConfig.ViewConfigs, func(v *storepb.ViewConfig) string {
- return v.Name
- })
- for _, view := range schema.Views {
- viewConfig, ok := viewConfigMap[view.Name]
- if !ok {
- newViewConfig = append(newViewConfig, initViewConfig(view, formattedUserUID, formattedBranchResourceID, time))
- continue
- }
- oldView := oldSchema.GetView(view.Name)
- if oldView == nil {
- // If users delete the view first, and then add it back, we should update the config branch update info.
- viewConfig.Updater = formattedUserUID
- viewConfig.UpdateTime = time
- viewConfig.SourceBranch = formattedBranchResourceID
- continue
- }
- if diff := cmp.Diff(view, oldView.GetProto(), protocmp.Transform()); diff != "" {
- viewConfig.Updater = formattedUserUID
- viewConfig.UpdateTime = time
- viewConfig.SourceBranch = formattedBranchResourceID
- }
- }
-
- var newFunctionConfig []*storepb.FunctionConfig
- functionConfigMap := buildMap(newSchemaConfig.FunctionConfigs, func(f *storepb.FunctionConfig) string {
- return f.Name
- })
- for _, function := range schema.Functions {
- functionConfig, ok := functionConfigMap[function.Name]
- if !ok {
- newFunctionConfig = append(newFunctionConfig, initFunctionConfig(function, formattedUserUID, formattedBranchResourceID, time))
- continue
- }
- oldFunction := oldSchema.GetFunction(function.Name)
- if oldFunction == nil {
- // If users delete the function first, and then add it back, we should update the config branch update info.
- functionConfig.Updater = formattedUserUID
- functionConfig.UpdateTime = time
- functionConfig.SourceBranch = formattedBranchResourceID
- continue
- }
- if diff := cmp.Diff(function, oldFunction.GetProto(), protocmp.Transform()); diff != "" {
- functionConfig.Updater = formattedUserUID
- functionConfig.UpdateTime = time
- functionConfig.SourceBranch = formattedBranchResourceID
- }
- }
-
- var newProcedureConfig []*storepb.ProcedureConfig
- procedureConfigMap := buildMap(newSchemaConfig.ProcedureConfigs, func(p *storepb.ProcedureConfig) string {
- return p.Name
- })
- for _, procedure := range schema.Procedures {
- procedureConfig, ok := procedureConfigMap[procedure.Name]
- if !ok {
- newProcedureConfig = append(newProcedureConfig, initProcedureConfig(procedure, formattedUserUID, formattedBranchResourceID, time))
- continue
- }
- oldProcedure := oldSchema.GetProcedure(procedure.Name)
- if oldProcedure == nil {
- // If users delete the procedure first, and then add it back, we should update the config branch update info.
- procedureConfig.Updater = formattedUserUID
- procedureConfig.UpdateTime = time
- procedureConfig.SourceBranch = formattedBranchResourceID
- continue
- }
- if diff := cmp.Diff(procedure, oldProcedure.GetProto(), protocmp.Transform()); diff != "" {
- procedureConfig.Updater = formattedUserUID
- procedureConfig.UpdateTime = time
- procedureConfig.SourceBranch = formattedBranchResourceID
- }
- }
-
- newSchemaConfig.Tables = append(newSchemaConfig.Tables, newTableConfig...)
- newSchemaConfig.ViewConfigs = append(newSchemaConfig.ViewConfigs, newViewConfig...)
- newSchemaConfig.FunctionConfigs = append(newSchemaConfig.FunctionConfigs, newFunctionConfig...)
- newSchemaConfig.ProcedureConfigs = append(newSchemaConfig.ProcedureConfigs, newProcedureConfig...)
- }
- alignedConfig.Schemas = append(alignedConfig.Schemas, newSchemaConfigs...)
-
- return alignedConfig
-}
-
-func initSchemaConfig(schema *storepb.SchemaMetadata, formattedUserUID string, branchResourceID string, time *timestamppb.Timestamp) *storepb.SchemaCatalog {
- s := &storepb.SchemaCatalog{
- Name: schema.Name,
- }
-
- for _, table := range schema.Tables {
- s.Tables = append(s.Tables, initTableConfig(table, formattedUserUID, branchResourceID, time))
- }
-
- for _, view := range schema.Views {
- s.ViewConfigs = append(s.ViewConfigs, initViewConfig(view, formattedUserUID, branchResourceID, time))
- }
-
- for _, function := range schema.Functions {
- s.FunctionConfigs = append(s.FunctionConfigs, initFunctionConfig(function, formattedUserUID, branchResourceID, time))
- }
-
- for _, procedure := range schema.Procedures {
- s.ProcedureConfigs = append(s.ProcedureConfigs, initProcedureConfig(procedure, formattedUserUID, branchResourceID, time))
- }
-
- return s
-}
-
-func initTableConfig(table *storepb.TableMetadata, formattedUserEmail string, branchResourceID string, time *timestamppb.Timestamp) *storepb.TableCatalog {
- var columnConfigs []*storepb.ColumnCatalog
- for _, column := range table.Columns {
- columnConfigs = append(columnConfigs, &storepb.ColumnCatalog{
- Name: column.Name,
- })
- }
- return &storepb.TableCatalog{
- Name: table.Name,
- Updater: formattedUserEmail,
- SourceBranch: branchResourceID,
- UpdateTime: time,
- Columns: columnConfigs,
- }
-}
-
-func initViewConfig(view *storepb.ViewMetadata, formattedUserEmail string, branchResourceID string, time *timestamppb.Timestamp) *storepb.ViewConfig {
- return &storepb.ViewConfig{
- Name: view.Name,
- Updater: formattedUserEmail,
- SourceBranch: branchResourceID,
- UpdateTime: time,
- }
-}
-
-func initFunctionConfig(function *storepb.FunctionMetadata, formattedUserEmail string, branchResourceID string, time *timestamppb.Timestamp) *storepb.FunctionConfig {
- return &storepb.FunctionConfig{
- Name: function.Name,
- Updater: formattedUserEmail,
- SourceBranch: branchResourceID,
- UpdateTime: time,
- }
-}
-
-func initProcedureConfig(procedure *storepb.ProcedureMetadata, formattedUserEmail string, branchResourceID string, time *timestamppb.Timestamp) *storepb.ProcedureConfig {
- return &storepb.ProcedureConfig{
- Name: procedure.Name,
- Updater: formattedUserEmail,
- SourceBranch: branchResourceID,
- UpdateTime: time,
- }
-}
-
-func buildMap[T any](objects []T, getUniqueIdentifier func(T) string) map[string]T {
- m := make(map[string]T)
- for _, obj := range objects {
- m[getUniqueIdentifier(obj)] = obj
- }
- return m
-}
-
-func initBranchLastUpdateInfoConfig(metadata *storepb.DatabaseSchemaMetadata, config *storepb.DatabaseConfig) {
- schemaConfigMap := buildMap(config.Schemas, func(s *storepb.SchemaCatalog) string {
- return s.Name
- })
- for _, schema := range metadata.Schemas {
- schemaConfig, ok := schemaConfigMap[schema.Name]
- if !ok {
- config.Schemas = append(config.Schemas, initSchemaConfig(schema, "", "", nil))
- continue
- }
- tableConfigMap := buildMap(schemaConfig.Tables, func(t *storepb.TableCatalog) string {
- return t.Name
- })
- for _, table := range schema.Tables {
- tableConfig, ok := tableConfigMap[table.Name]
- if !ok {
- schemaConfig.Tables = append(schemaConfig.Tables, initTableConfig(table, "", "", nil))
- } else {
- tableConfig.Updater = ""
- tableConfig.UpdateTime = nil
- tableConfig.SourceBranch = ""
- }
- }
- viewConfigMap := buildMap(schemaConfig.ViewConfigs, func(v *storepb.ViewConfig) string {
- return v.Name
- })
- for _, view := range schema.Views {
- viewConfig, ok := viewConfigMap[view.Name]
- if !ok {
- schemaConfig.ViewConfigs = append(schemaConfig.ViewConfigs, initViewConfig(view, "", "", nil))
- } else {
- viewConfig.Updater = ""
- viewConfig.UpdateTime = nil
- viewConfig.SourceBranch = ""
- }
- }
- functionConfigMap := buildMap(schemaConfig.FunctionConfigs, func(f *storepb.FunctionConfig) string {
- return f.Name
- })
- for _, function := range schema.Functions {
- functionConfig, ok := functionConfigMap[function.Name]
- if !ok {
- schemaConfig.FunctionConfigs = append(schemaConfig.FunctionConfigs, initFunctionConfig(function, "", "", nil))
- } else {
- functionConfig.Updater = ""
- functionConfig.UpdateTime = nil
- functionConfig.SourceBranch = ""
- }
- }
- procedureConfigMap := buildMap(schemaConfig.ProcedureConfigs, func(p *storepb.ProcedureConfig) string {
- return p.Name
- })
- for _, procedure := range schema.Procedures {
- procedureConfig, ok := procedureConfigMap[procedure.Name]
- if !ok {
- schemaConfig.ProcedureConfigs = append(schemaConfig.ProcedureConfigs, initProcedureConfig(procedure, "", "", nil))
- } else {
- procedureConfig.Updater = ""
- procedureConfig.UpdateTime = nil
- procedureConfig.SourceBranch = ""
- }
- }
- }
-}
-
-func trimClassificationIDFromCommentIfNeeded(dbSchema *storepb.DatabaseSchemaMetadata, classificationConfig *storepb.DataClassificationSetting_DataClassificationConfig) {
- if classificationConfig.ClassificationFromConfig {
- return
- }
- for _, schema := range dbSchema.Schemas {
- for _, table := range schema.Tables {
- if !classificationConfig.ClassificationFromConfig {
- _, table.UserComment = common.GetClassificationAndUserComment(table.Comment, classificationConfig)
- }
- for _, col := range table.Columns {
- if !classificationConfig.ClassificationFromConfig {
- _, col.UserComment = common.GetClassificationAndUserComment(col.Comment, classificationConfig)
- }
- }
- }
- }
-}
-
-// alignDatabaseConfig aligns the database config with the metadata by adding an empty config for the missing objects,
-// and deleting the config for the deleted objects.
-func alignDatabaseConfig(metadata *storepb.DatabaseSchemaMetadata, config *storepb.DatabaseConfig) *storepb.DatabaseConfig {
- result := &storepb.DatabaseConfig{
- Name: metadata.GetName(),
- }
- dbModel := model.NewDatabaseMetadata(metadata)
- schemaConfigMap := buildMap(config.Schemas, func(s *storepb.SchemaCatalog) string {
- return s.Name
- })
- for _, schemaName := range dbModel.ListSchemaNames() {
- schema := dbModel.GetSchema(schemaName)
- oldSchemaConfig, ok := schemaConfigMap[schemaName]
- if !ok {
- schemaConfig := initSchemaConfig(schema.GetProto(), "", "", nil)
- result.Schemas = append(result.Schemas, schemaConfig)
- continue
- }
- schemaConfig := &storepb.SchemaCatalog{
- Name: schemaName,
- }
- for _, tableName := range schema.ListTableNames() {
- table := schema.GetTable(tableName)
- tableConfigMap := buildMap(oldSchemaConfig.Tables, func(t *storepb.TableCatalog) string {
- return t.Name
- })
- oldTableConfig, ok := tableConfigMap[tableName]
- if !ok {
- tableConfig := initTableConfig(table.GetProto(), "", "", nil)
- schemaConfig.Tables = append(schemaConfig.Tables, tableConfig)
- continue
- }
- //nolint
- tableConfig := &storepb.TableCatalog{
- Name: tableName,
- Classification: oldTableConfig.Classification,
- Updater: oldTableConfig.Updater,
- UpdateTime: oldTableConfig.UpdateTime,
- SourceBranch: oldTableConfig.SourceBranch,
- }
- columnConfigMap := buildMap(oldTableConfig.Columns, func(c *storepb.ColumnCatalog) string {
- return c.Name
- })
- for _, columnProto := range table.GetColumns() {
- columnName := columnProto.GetName()
- if columnConfig, ok := columnConfigMap[columnName]; !ok {
- tableConfig.Columns = append(tableConfig.Columns, &storepb.ColumnCatalog{
- Name: columnName,
- })
- } else {
- columnConfig := &storepb.ColumnCatalog{
- Name: columnName,
- Classification: columnConfig.Classification,
- SemanticType: columnConfig.SemanticType,
- Labels: columnConfig.Labels,
- }
- tableConfig.Columns = append(tableConfig.Columns, columnConfig)
- }
- }
- schemaConfig.Tables = append(schemaConfig.Tables, tableConfig)
- }
-
- for _, viewName := range schema.ListViewNames() {
- view := schema.GetView(viewName)
- viewConfigMap := buildMap(oldSchemaConfig.ViewConfigs, func(v *storepb.ViewConfig) string {
- return v.Name
- })
- oldViewConfig, ok := viewConfigMap[viewName]
- if !ok {
- viewConfig := initViewConfig(view.GetProto(), "", "", nil)
- schemaConfig.ViewConfigs = append(schemaConfig.ViewConfigs, viewConfig)
- continue
- }
- viewConfig := &storepb.ViewConfig{
- Name: viewName,
- Updater: oldViewConfig.Updater,
- UpdateTime: oldViewConfig.UpdateTime,
- SourceBranch: oldViewConfig.SourceBranch,
- }
-
- schemaConfig.ViewConfigs = append(schemaConfig.ViewConfigs, viewConfig)
- }
-
- for _, procedureName := range schema.ListProcedureNames() {
- procedure := schema.GetProcedure(procedureName)
- procedureConfigMap := buildMap(oldSchemaConfig.ProcedureConfigs, func(p *storepb.ProcedureConfig) string {
- return p.Name
- })
- oldProcedureConfig, ok := procedureConfigMap[procedureName]
- if !ok {
- procedureConfig := initProcedureConfig(procedure.GetProto(), "", "", nil)
- schemaConfig.ProcedureConfigs = append(schemaConfig.ProcedureConfigs, procedureConfig)
- continue
- }
- procedureConfig := &storepb.ProcedureConfig{
- Name: procedureName,
- Updater: oldProcedureConfig.Updater,
- UpdateTime: oldProcedureConfig.UpdateTime,
- SourceBranch: oldProcedureConfig.SourceBranch,
- }
- schemaConfig.ProcedureConfigs = append(schemaConfig.ProcedureConfigs, procedureConfig)
- }
-
- for _, functionName := range schema.ListFunctionNames() {
- function := schema.GetFunction(functionName)
- functionConfigMap := buildMap(oldSchemaConfig.FunctionConfigs, func(f *storepb.FunctionConfig) string {
- return f.Name
- })
- oldFunctionConfig, ok := functionConfigMap[functionName]
- if !ok {
- functionConfig := initFunctionConfig(function.GetProto(), "", "", nil)
- schemaConfig.FunctionConfigs = append(schemaConfig.FunctionConfigs, functionConfig)
- continue
- }
- functionConfig := &storepb.FunctionConfig{
- Name: functionName,
- Updater: oldFunctionConfig.Updater,
- UpdateTime: oldFunctionConfig.UpdateTime,
- SourceBranch: oldFunctionConfig.SourceBranch,
- }
- schemaConfig.FunctionConfigs = append(schemaConfig.FunctionConfigs, functionConfig)
- }
- result.Schemas = append(result.Schemas, schemaConfig)
- }
- return result
-}
-
-func formatViewDef(def string) string {
- return strings.TrimRightFunc(def, utils.IsSpaceOrSemicolon)
-}
-
-// setClassificationIDToConfig inplace set the classification ID from the a config to the b config.
-func setClassificationIDToConfig(a, b *storepb.DatabaseConfig) {
- aSchemaConfigMap := buildMap(a.Schemas, func(s *storepb.SchemaCatalog) string {
- return s.Name
- })
-
- for _, schemaConfig := range b.Schemas {
- aSchemaConfig, ok := aSchemaConfigMap[schemaConfig.Name]
- if !ok {
- continue
- }
- aTableConfigMap := buildMap(aSchemaConfig.Tables, func(t *storepb.TableCatalog) string {
- return t.Name
- })
- for _, tableConfig := range schemaConfig.Tables {
- aTableConfig, ok := aTableConfigMap[tableConfig.Name]
- if !ok {
- continue
- }
- tableConfig.Classification = aTableConfig.Classification
- aColumnConfigMap := buildMap(aTableConfig.Columns, func(c *storepb.ColumnCatalog) string {
- return c.Name
- })
- for _, columnConfig := range tableConfig.Columns {
- aColumnConfig, ok := aColumnConfigMap[columnConfig.Name]
- if !ok {
- continue
- }
- columnConfig.Classification = aColumnConfig.Classification
- }
- }
- }
-}
diff --git a/backend/api/v1/branch_service_test.go b/backend/api/v1/branch_service_test.go
deleted file mode 100644
index 283e03b9ce..0000000000
--- a/backend/api/v1/branch_service_test.go
+++ /dev/null
@@ -1,146 +0,0 @@
-package v1
-
-import (
- "testing"
-
- "github.com/google/go-cmp/cmp"
- "github.com/stretchr/testify/require"
- "google.golang.org/protobuf/testing/protocmp"
-
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
-)
-
-func TestTrimDatabaseMetadata(t *testing.T) {
- source := &storepb.DatabaseSchemaMetadata{
- Schemas: []*storepb.SchemaMetadata{
- {Name: "schema0"},
- {
- Name: "schema1",
- Tables: []*storepb.TableMetadata{
- {Name: "t1", Columns: []*storepb.ColumnMetadata{{Name: "t1-c1", Type: "int"}}},
- {Name: "same-table", Columns: []*storepb.ColumnMetadata{{Name: "c1", Type: "int"}}},
- },
- },
- {
- Name: "same-schema",
- Tables: []*storepb.TableMetadata{
- {Name: "t1", Columns: []*storepb.ColumnMetadata{{Name: "c1", Type: "int"}}},
- },
- },
- },
- }
- target := &storepb.DatabaseSchemaMetadata{
- Schemas: []*storepb.SchemaMetadata{
- {
- Name: "same-schema",
- Tables: []*storepb.TableMetadata{
- {Name: "t1", Columns: []*storepb.ColumnMetadata{{Name: "c1", Type: "int"}}},
- },
- },
- {
- Name: "schema1",
- Tables: []*storepb.TableMetadata{
- {Name: "same-table", Columns: []*storepb.ColumnMetadata{{Name: "c1", Type: "int"}}},
- {Name: "t2", Columns: []*storepb.ColumnMetadata{{Name: "t2-c1", Type: "int"}}},
- },
- },
- {Name: "schema2"},
- },
- }
- wantTrimmedSource := &storepb.DatabaseSchemaMetadata{
- Schemas: []*storepb.SchemaMetadata{
- {Name: "schema0"},
- {
- Name: "schema1",
- Tables: []*storepb.TableMetadata{
- {Name: "t1", Columns: []*storepb.ColumnMetadata{{Name: "t1-c1", Type: "int"}}},
- },
- },
- {
- Name: "same-schema",
- },
- },
- }
- wantTrimmedTarget := &storepb.DatabaseSchemaMetadata{
- Schemas: []*storepb.SchemaMetadata{
- {
- Name: "same-schema",
- },
- {
- Name: "schema1",
- Tables: []*storepb.TableMetadata{
- {Name: "t2", Columns: []*storepb.ColumnMetadata{{Name: "t2-c1", Type: "int"}}},
- },
- },
- {Name: "schema2"},
- },
- }
-
- gotSource, gotTarget := trimDatabaseMetadata(source, target)
- diffTarget := cmp.Diff(wantTrimmedTarget, gotTarget, protocmp.Transform())
- require.Empty(t, diffTarget)
- diffSource := cmp.Diff(wantTrimmedSource, gotSource, protocmp.Transform())
- require.Empty(t, diffSource)
-}
-
-func TestAlignDatabaseConfig(t *testing.T) {
- // Create a sample metadata with two schemas and tables
- metadata := &storepb.DatabaseSchemaMetadata{
- Name: "testdb",
- Schemas: []*storepb.SchemaMetadata{
- {
- Name: "schema1",
- Tables: []*storepb.TableMetadata{
- {Name: "table3"},
- },
- Functions: []*storepb.FunctionMetadata{
- {
- Name: "function1",
- Definition: "CREATE FUNCTION `f1`() RETURNS char(50)\n DETERMINISTIC\nBEGIN\n return 1;\nEND",
- },
- },
- },
- },
- }
-
- // Create a sample config with one schema and one table
- config := &storepb.DatabaseConfig{
- Name: "testdb",
- Schemas: []*storepb.SchemaCatalog{
- {
- Name: "schema1",
- Tables: []*storepb.TableCatalog{
- {Name: "table1"},
- },
- FunctionConfigs: []*storepb.FunctionConfig{
- {
- Name: "function1",
- Updater: "anonymous",
- },
- },
- },
- },
- }
-
- want := &storepb.DatabaseConfig{
- Name: "testdb",
- Schemas: []*storepb.SchemaCatalog{
- {
- Name: "schema1",
- Tables: []*storepb.TableCatalog{
- {Name: "table3"},
- },
- FunctionConfigs: []*storepb.FunctionConfig{
- {
- Name: "function1",
- Updater: "anonymous",
- },
- },
- },
- },
- }
-
- got := alignDatabaseConfig(metadata, config)
- diff := cmp.Diff(want, got, protocmp.Transform())
- require.Empty(t, diff)
-}
diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.go
index 41c345eead..1c1174f540 100644
--- a/backend/api/v1/sql_service.go
+++ b/backend/api/v1/sql_service.go
@@ -1557,6 +1557,28 @@ func (*SQLService) StringifyMetadata(ctx context.Context, request *v1pb.Stringif
}, nil
}
+func sanitizeCommentForSchemaMetadata(dbSchema *storepb.DatabaseSchemaMetadata, dbModelConfig *model.DatabaseConfig, classificationFromConfig bool) {
+ for _, schema := range dbSchema.Schemas {
+ schemaConfig := dbModelConfig.CreateOrGetSchemaConfig(schema.Name)
+ for _, table := range schema.Tables {
+ tableConfig := schemaConfig.CreateOrGetTableConfig(table.Name)
+ classificationID := ""
+ if !classificationFromConfig {
+ classificationID = tableConfig.Classification
+ }
+ table.Comment = common.GetCommentFromClassificationAndUserComment(classificationID, table.UserComment)
+ for _, col := range table.Columns {
+ columnConfig := tableConfig.CreateOrGetColumnConfig(col.Name)
+ classificationID := ""
+ if !classificationFromConfig {
+ classificationID = columnConfig.Classification
+ }
+ col.Comment = common.GetCommentFromClassificationAndUserComment(classificationID, col.UserComment)
+ }
+ }
+ }
+}
+
func appendComments(schema string, storeSchemaMetadata *storepb.DatabaseSchemaMetadata) (string, error) {
if !isSingleTable(storeSchemaMetadata) {
return schema, nil
diff --git a/backend/server/grpc_routes.go b/backend/server/grpc_routes.go
index f545d1dd92..600cfcc32a 100644
--- a/backend/server/grpc_routes.go
+++ b/backend/server/grpc_routes.go
@@ -88,7 +88,7 @@ func configureGrpcRouters(
v1pb.RegisterRoleServiceServer(grpcServer, apiv1.NewRoleService(stores, iamManager, licenseService))
v1pb.RegisterSheetServiceServer(grpcServer, apiv1.NewSheetService(stores, sheetManager, licenseService, iamManager, profile))
v1pb.RegisterWorksheetServiceServer(grpcServer, apiv1.NewWorksheetService(stores, iamManager))
- v1pb.RegisterBranchServiceServer(grpcServer, apiv1.NewBranchService(stores, licenseService, profile, iamManager))
+ v1pb.RegisterBranchServiceServer(grpcServer, apiv1.NewBranchService())
v1pb.RegisterCelServiceServer(grpcServer, apiv1.NewCelService())
v1pb.RegisterDatabaseGroupServiceServer(grpcServer, apiv1.NewDatabaseGroupService(stores, profile, iamManager, licenseService))
v1pb.RegisterChangelistServiceServer(grpcServer, apiv1.NewChangelistService(stores, profile, iamManager))
diff --git a/backend/store/branch.go b/backend/store/branch.go
deleted file mode 100644
index b54e85acab..0000000000
--- a/backend/store/branch.go
+++ /dev/null
@@ -1,393 +0,0 @@
-package store
-
-import (
- "context"
- "database/sql"
- "fmt"
- "strings"
- "time"
-
- "github.com/pkg/errors"
- "google.golang.org/protobuf/encoding/protojson"
-
- "github.com/bytebase/bytebase/backend/common"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
-)
-
-// BranchMessage is the message for a branch.
-type BranchMessage struct {
- ProjectID string
- ResourceID string
- CreatorID int
-
- Engine storepb.Engine
- Config *storepb.BranchConfig
- Base *storepb.BranchSnapshot
- Head *storepb.BranchSnapshot
- BaseSchema []byte
- HeadSchema []byte
-
- // Output only fields
- UID int
- UpdaterID int
- CreatedTime time.Time
- UpdatedTime time.Time
-}
-
-// FindBranchMessage is the API message for finding branches.
-type FindBranchMessage struct {
- ProjectID *string
- ResourceID *string
- UID *int
- LoadFull bool
-
- ParentBranchResourceID *string
-}
-
-// UpdateBranchMessage is the message to update a branch.
-type UpdateBranchMessage struct {
- ProjectID string
- ResourceID string
- UpdaterID int
- Config *storepb.BranchConfig
- Base *storepb.BranchSnapshot
- Head *storepb.BranchSnapshot
- BaseSchema *[]byte
- HeadSchema *[]byte
- UpdateResourceID *string
-}
-
-// GetBranch gets a branch.
-func (s *Store) GetBranch(ctx context.Context, find *FindBranchMessage) (*BranchMessage, error) {
- branches, err := s.ListBranches(ctx, find)
- if err != nil {
- return nil, err
- }
- if len(branches) == 0 {
- return nil, nil
- }
- if len(branches) > 1 {
- return nil, errors.Errorf("expected 1 branch, got %d", len(branches))
- }
- return branches[0], nil
-}
-
-// ListBranches returns a list of branches.
-func (s *Store) ListBranches(ctx context.Context, find *FindBranchMessage) ([]*BranchMessage, error) {
- where, args := []string{"TRUE"}, []any{}
-
- if v := find.ProjectID; v != nil {
- project, err := s.GetProjectV2(ctx, &FindProjectMessage{ResourceID: v})
- if err != nil {
- return nil, err
- }
- where, args = append(where, fmt.Sprintf("branch.project_id = $%d", len(args)+1)), append(args, project.UID)
- }
- if v := find.ResourceID; v != nil {
- where, args = append(where, fmt.Sprintf("branch.name = $%d", len(args)+1)), append(args, *v)
- }
- if v := find.UID; v != nil {
- where, args = append(where, fmt.Sprintf("branch.id = $%d", len(args)+1)), append(args, *v)
- }
- if v := find.ParentBranchResourceID; v != nil {
- where, args = append(where, fmt.Sprintf("branch.config->>'sourceBranch' = $%d", len(args)+1)), append(args, *v)
- }
-
- tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})
- if err != nil {
- return nil, err
- }
- defer tx.Rollback()
-
- query := fmt.Sprintf(`
- SELECT
- branch.id,
- branch.creator_id,
- branch.created_ts,
- branch.updater_id,
- branch.updated_ts,
- project.resource_id AS project_id,
- branch.name,
- branch.engine,
- branch.base,
- branch.head,
- branch.base_schema,
- branch.head_schema,
- branch.config
- FROM branch
- LEFT JOIN project ON branch.project_id = project.id
- WHERE %s`, strings.Join(where, " AND "))
- if !find.LoadFull {
- query = fmt.Sprintf(`
- SELECT
- branch.id,
- branch.creator_id,
- branch.created_ts,
- branch.updater_id,
- branch.updated_ts,
- project.resource_id AS project_id,
- branch.name,
- branch.engine,
- '{}',
- '{}',
- '',
- '',
- branch.config
- FROM branch
- LEFT JOIN project ON branch.project_id = project.id
- WHERE %s`, strings.Join(where, " AND "))
- }
- rows, err := tx.QueryContext(ctx, query,
- args...,
- )
- if err != nil {
- return nil, err
- }
- defer rows.Close()
-
- var branches []*BranchMessage
- for rows.Next() {
- var branch BranchMessage
- var createdTs, updatedTs int64
- var base, head, config []byte
- var engine string
- if err := rows.Scan(
- &branch.UID,
- &branch.CreatorID,
- &createdTs,
- &branch.UpdaterID,
- &updatedTs,
- &branch.ProjectID,
- &branch.ResourceID,
- &engine,
- &base,
- &head,
- &branch.BaseSchema,
- &branch.HeadSchema,
- &config,
- ); err != nil {
- return nil, err
- }
- engineTypeValue, ok := storepb.Engine_value[engine]
- if !ok {
- return nil, errors.Errorf("invalid engine %s", engine)
- }
- branch.Engine = storepb.Engine(engineTypeValue)
-
- branchBase := &storepb.BranchSnapshot{}
- if err := common.ProtojsonUnmarshaler.Unmarshal(base, branchBase); err != nil {
- return nil, err
- }
- branch.Base = branchBase
- branchHead := &storepb.BranchSnapshot{}
- if err := common.ProtojsonUnmarshaler.Unmarshal(head, branchHead); err != nil {
- return nil, err
- }
- branch.Head = branchHead
- branchConfig := &storepb.BranchConfig{}
- if err := common.ProtojsonUnmarshaler.Unmarshal(config, branchConfig); err != nil {
- return nil, err
- }
- branch.Config = branchConfig
- branch.CreatedTime = time.Unix(createdTs, 0)
- branch.UpdatedTime = time.Unix(updatedTs, 0)
-
- branches = append(branches, &branch)
- }
- if err := rows.Err(); err != nil {
- return nil, err
- }
- if err := tx.Commit(); err != nil {
- return nil, err
- }
-
- return branches, nil
-}
-
-// CreateBranch creates a branch.
-func (s *Store) CreateBranch(ctx context.Context, create *BranchMessage) (*BranchMessage, error) {
- project, err := s.GetProjectV2(ctx, &FindProjectMessage{ResourceID: &create.ProjectID})
- if err != nil {
- return nil, err
- }
- if create.Base == nil {
- create.Base = &storepb.BranchSnapshot{}
- }
- if create.Head == nil {
- create.Head = &storepb.BranchSnapshot{}
- }
- if create.Config == nil {
- create.Config = &storepb.BranchConfig{}
- }
- create.UpdaterID = create.CreatorID
- base, err := protojson.Marshal(create.Base)
- if err != nil {
- return nil, err
- }
- head, err := protojson.Marshal(create.Head)
- if err != nil {
- return nil, err
- }
- config, err := protojson.Marshal(create.Config)
- if err != nil {
- return nil, err
- }
-
- query := `
- INSERT INTO branch (
- creator_id,
- updater_id,
- project_id,
- name,
- engine,
- base,
- head,
- base_schema,
- head_schema,
- config
- )
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
- RETURNING id, created_ts, updated_ts;
- `
-
- tx, err := s.db.BeginTx(ctx, nil)
- if err != nil {
- return nil, err
- }
- defer tx.Rollback()
- var createdTs, updatedTs int64
- if err := tx.QueryRowContext(ctx, query,
- create.CreatorID,
- create.CreatorID,
- project.UID,
- create.ResourceID,
- create.Engine.String(),
- base,
- head,
- // Convert to string because []byte{} is null which violates db schema constraints.
- string(create.BaseSchema),
- string(create.HeadSchema),
- config,
- ).Scan(
- &create.UID,
- &createdTs,
- &updatedTs,
- ); err != nil {
- return nil, err
- }
- create.CreatedTime = time.Unix(createdTs, 0)
- create.UpdatedTime = time.Unix(updatedTs, 0)
- if err := tx.Commit(); err != nil {
- return nil, err
- }
-
- return create, nil
-}
-
-// UpdateBranch updates a branch.
-func (s *Store) UpdateBranch(ctx context.Context, update *UpdateBranchMessage) error {
- project, err := s.GetProjectV2(ctx, &FindProjectMessage{ResourceID: &update.ProjectID})
- if err != nil {
- return err
- }
-
- tx, err := s.db.BeginTx(ctx, nil)
- if err != nil {
- return errors.Wrapf(err, "failed to begin transaction")
- }
-
- set, args := []string{"updater_id = $1", "updated_ts = $2"}, []any{update.UpdaterID, time.Now().Unix()}
- if v := update.Base; v != nil {
- base, err := protojson.Marshal(v)
- if err != nil {
- return err
- }
- set, args = append(set, fmt.Sprintf("base = $%d", len(args)+1)), append(args, base)
- }
- if v := update.Head; v != nil {
- head, err := protojson.Marshal(v)
- if err != nil {
- return err
- }
- set, args = append(set, fmt.Sprintf("head = $%d", len(args)+1)), append(args, head)
- }
- // Convert to string because []byte{} is null which violates db schema constraints.
- if v := update.BaseSchema; v != nil {
- set, args = append(set, fmt.Sprintf("base_schema = $%d", len(args)+1)), append(args, string(*v))
- }
- if v := update.HeadSchema; v != nil {
- set, args = append(set, fmt.Sprintf("head_schema = $%d", len(args)+1)), append(args, string(*v))
- }
- if v := update.Config; v != nil {
- config, err := protojson.Marshal(v)
- if err != nil {
- return err
- }
- set, args = append(set, fmt.Sprintf("config = $%d", len(args)+1)), append(args, config)
- }
- if v := update.UpdateResourceID; v != nil {
- set, args = append(set, fmt.Sprintf("name = $%d", len(args)+1)), append(args, *v)
- }
- args = append(args, project.UID, update.ResourceID)
-
- if _, err := tx.ExecContext(ctx, fmt.Sprintf(`
- UPDATE branch
- SET `+strings.Join(set, ", ")+`
- WHERE branch.project_id = $%d AND branch.name = $%d`, len(set)+1, len(set)+2), args...); err != nil {
- return err
- }
-
- return tx.Commit()
-}
-
-// DeleteBranch deletes a branch.
-func (s *Store) DeleteBranch(ctx context.Context, projectID, resourceID string) error {
- tx, err := s.db.BeginTx(ctx, nil)
- if err != nil {
- return err
- }
- defer tx.Rollback()
-
- if _, err := tx.ExecContext(ctx, `
- DELETE FROM branch
- USING project
- WHERE branch.project_id = project.id AND project.resource_id = $1 AND branch.name = $2;`,
- projectID, resourceID); err != nil {
- return err
- }
-
- return tx.Commit()
-}
-
-func (s *Store) ListBackfillBranches(ctx context.Context) ([]int, error) {
- tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})
- if err != nil {
- return nil, err
- }
- defer tx.Rollback()
-
- rows, err := tx.QueryContext(ctx, `SELECT id FROM branch WHERE head ? 'metadata' = false`)
- if err != nil {
- return nil, err
- }
- defer rows.Close()
-
- var ids []int
- for rows.Next() {
- var id int
- if err := rows.Scan(
- &id,
- ); err != nil {
- return nil, err
- }
- ids = append(ids, id)
- }
- if err := rows.Err(); err != nil {
- return nil, err
- }
- if err := tx.Commit(); err != nil {
- return nil, err
- }
-
- return ids, nil
-}
diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
index c62bcfcee0..be06327d78 100644
--- a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
+++ b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
@@ -38,7 +38,6 @@
>
<SchemaEditorLite
ref="schemaEditorRef"
- resource-type="database"
:project="project"
:targets="state.targets"
:loading="state.isPreparingMetadata"
diff --git a/frontend/src/components/Branch/BaselineSchemaSelector.vue b/frontend/src/components/Branch/BaselineSchemaSelector.vue
deleted file mode 100644
index be89e15197..0000000000
--- a/frontend/src/components/Branch/BaselineSchemaSelector.vue
+++ /dev/null
@@ -1,113 +0,0 @@
-<template>
- <div class="contents">
- <EnvironmentSelect
- name="environment"
- :disabled="readonly || props.loading"
- :environment-name="state.environmentName"
- @update:environment-name="handleEnvironmentSelect"
- />
- <DatabaseSelect
- style="width: 100%"
- :placeholder="$t('schema-designer.select-database-placeholder')"
- :disabled="readonly || props.loading"
- :allowed-engine-type-list="allowedEngineTypeList"
- :environment-name="state.environmentName"
- :project-name="props.projectName"
- :database-name="state.databaseName ?? UNKNOWN_DATABASE_NAME"
- :fallback-option="false"
- @update:database-name="handleDatabaseSelect"
- />
- </div>
-</template>
-
-<script lang="ts" setup>
-import { reactive, watch } from "vue";
-import { EnvironmentSelect, DatabaseSelect } from "@/components/v2";
-import { useDatabaseV1Store } from "@/store";
-import { UNKNOWN_DATABASE_NAME, isValidDatabaseName } from "@/types";
-import { Engine } from "@/types/proto/v1/common";
-
-const props = defineProps<{
- projectName?: string;
- databaseName?: string;
- readonly?: boolean;
- loading?: boolean;
-}>();
-
-const emit = defineEmits<{
- (event: "update:database-name", databaseName: string | undefined): void;
-}>();
-
-interface LocalState {
- environmentName?: string;
- databaseName?: string;
-}
-
-const state = reactive<LocalState>({});
-const databaseStore = useDatabaseV1Store();
-
-watch(
- () => props.projectName,
- () => {
- const database = isValidDatabaseName(state.databaseName)
- ? databaseStore.getDatabaseByName(state.databaseName)
- : undefined;
- if (!database || !props.projectName) {
- return;
- }
- if (database.project !== props.projectName) {
- state.environmentName = undefined;
- state.databaseName = undefined;
- }
- }
-);
-
-watch(
- () => state.databaseName,
- async (name) => {
- const database = isValidDatabaseName(name)
- ? databaseStore.getDatabaseByName(name)
- : undefined;
- try {
- if (database) {
- state.databaseName = database.name;
- state.environmentName = database.effectiveEnvironment;
- }
- } catch {
- // do nothing.
- }
- emit("update:database-name", database?.name);
- }
-);
-
-const allowedEngineTypeList: Engine[] = [
- Engine.MYSQL,
- Engine.TIDB,
- Engine.POSTGRES,
- Engine.ORACLE,
-];
-
-const handleEnvironmentSelect = (name?: string) => {
- if (name !== state.environmentName) {
- state.environmentName = name;
- state.databaseName = undefined;
- }
-};
-
-const handleDatabaseSelect = (name?: string) => {
- if (isValidDatabaseName(name)) {
- const database = databaseStore.getDatabaseByName(name);
- if (!database) {
- return;
- }
- state.environmentName = database.effectiveEnvironment;
- state.databaseName = name;
- }
-};
-</script>
-
-<style lang="postcss">
-.bb-baseline-schema-select-option .n-base-select-option__content {
- @apply w-full;
-}
-</style>
diff --git a/frontend/src/components/Branch/BranchBaseline.vue b/frontend/src/components/Branch/BranchBaseline.vue
deleted file mode 100644
index 28757534a2..0000000000
--- a/frontend/src/components/Branch/BranchBaseline.vue
+++ /dev/null
@@ -1,33 +0,0 @@
-<template>
- <div class="flex flex-row gap-x-1 text-sm">
- <RichDatabaseName
- :database="database"
- :show-instance="false"
- :show-instance-icon="!!showInstanceIcon"
- :show-arrow="false"
- :show-production-environment-icon="false"
- tooltip="instance"
- />
- </div>
-</template>
-
-<script setup lang="ts">
-import { computed } from "vue";
-import { RichDatabaseName } from "@/components/v2";
-import { useDatabaseV1Store } from "@/store";
-import type { Branch } from "@/types/proto/v1/branch_service";
-
-const props = withDefaults(
- defineProps<{
- branch: Branch;
- showInstanceIcon?: boolean;
- }>(),
- {
- showInstanceIcon: false,
- }
-);
-
-const database = computed(() => {
- return useDatabaseV1Store().getDatabaseByName(props.branch.baselineDatabase);
-});
-</script>
diff --git a/frontend/src/components/Branch/BranchCreateView.vue b/frontend/src/components/Branch/BranchCreateView.vue
deleted file mode 100644
index 500c05fa6c..0000000000
--- a/frontend/src/components/Branch/BranchCreateView.vue
+++ /dev/null
@@ -1,322 +0,0 @@
-<template>
- <div
- class="w-full h-full flex flex-col gap-y-3 relative overflow-y-hidden overflow-x-auto pt-0.5"
- >
- <div
- class="w-[32rem] grid gap-y-3 gap-x-4 whitespace-nowrap items-center"
- style="grid-template-columns: minmax(auto, 8rem) 1fr"
- >
- <div class="contents">
- <div class="text-sm">
- {{ $t("database.branch-name") }}
- </div>
- <BBTextField
- v-model:value="branchId"
- required
- class="!w-60 text-sm"
- :placeholder="'feature/add-billing'"
- />
- </div>
- <div class="contents">
- <div class="text-sm">
- {{ $t("branch.source.self") }}
- </div>
- <NRadioGroup
- :value="source"
- class="!flex flex-row gap-x-2"
- @update:value="handleSwitchSource"
- >
- <NRadio value="PARENT">
- {{ $t("branch.source.parent-branch") }}
- </NRadio>
- <NTooltip :disabled="allowCreateBranchFromDatabase">
- <template #trigger>
- <NRadio
- :disabled="!allowCreateBranchFromDatabase"
- value="BASELINE"
- >
- {{ $t("branch.source.baseline-version") }}
- </NRadio>
- </template>
- <template #default>
- <div class="whitespace-nowrap">
- {{ $t("common.permission-denied") }}
- </div>
- </template>
- </NTooltip>
- </NRadioGroup>
- </div>
- <div v-if="source === 'PARENT'" class="contents">
- <div class="text-sm">
- {{ $t("schema-designer.parent-branch") }}
- </div>
- <BranchSelector
- v-model:branch="parentBranchName"
- :project="project"
- :loading="isPreparingBranch"
- :filter="filterParentBranch"
- class=""
- clearable
- />
- </div>
- <BaselineSchemaSelector
- v-if="source === 'BASELINE'"
- v-model:database-name="databaseName"
- :project-name="project.name"
- :loading="isPreparingBranch"
- />
- </div>
- <NDivider class="!my-0" />
- <div class="w-full flex-1 overflow-y-hidden">
- <SchemaEditorLite
- :key="branchData?.branch.name ?? ''"
- :loading="isPreparingBranch"
- :project="project"
- :resource-type="'branch'"
- :branch="branchData?.branch ?? EMPTY_BRANCH"
- :readonly="true"
- :diff-when-ready="!!branchData?.parent"
- />
- <!-- turn on diff-when-ready is useful when the branch is created from a parent branch -->
- </div>
- <div class="w-full flex items-center justify-end">
- <NButton
- type="primary"
- :disabled="!allowConfirm"
- :loading="isCreating"
- @click.prevent="handleConfirm"
- >
- {{ confirmText }}
- </NButton>
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { useDebounce } from "@vueuse/core";
-import { cloneDeep, uniqueId } from "lodash-es";
-import { NButton, NDivider, NRadio, NRadioGroup, NTooltip } from "naive-ui";
-import { computed, ref, shallowRef, watch } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
-import { BBTextField } from "@/bbkit";
-import SchemaEditorLite from "@/components/SchemaEditorLite";
-import { PROJECT_V1_ROUTE_BRANCH_DETAIL } from "@/router/dashboard/projectV1";
-import {
- pushNotification,
- useDatabaseV1Store,
- useDBSchemaV1Store,
-} from "@/store";
-import { useBranchStore } from "@/store/modules/branch";
-import type { ComposedProject } from "@/types";
-import { isValidDatabaseName } from "@/types";
-import { Branch } from "@/types/proto/v1/branch_service";
-import { DatabaseMetadataView } from "@/types/proto/v1/database_service";
-import { hasProjectPermissionV2 } from "@/utils";
-import BaselineSchemaSelector from "./BaselineSchemaSelector.vue";
-import BranchSelector from "./BranchSelector.vue";
-import { validateBranchName } from "./utils";
-
-type Source = "PARENT" | "BASELINE";
-
-type BranchData = {
- branch: Branch;
- parent: string | undefined;
-};
-
-const props = defineProps<{
- project: ComposedProject;
-}>();
-
-const DEBOUNCE_RATE = 100;
-const { t } = useI18n();
-const router = useRouter();
-const databaseStore = useDatabaseV1Store();
-const branchStore = useBranchStore();
-const dbSchemaStore = useDBSchemaV1Store();
-const source = ref<Source>("PARENT");
-const databaseName = ref<string>();
-const parentBranchName = ref<string>();
-const isCreating = ref(false);
-const branchId = ref<string>("");
-const isPreparingBranch = ref(false);
-
-const EMPTY_BRANCH = Branch.fromPartial({});
-
-const allowCreateBranchFromDatabase = computed(() => {
- return hasProjectPermissionV2(props.project, "bb.branches.admin");
-});
-
-const debouncedDatabaseName = useDebounce(databaseName, DEBOUNCE_RATE);
-const debouncedParentBranchName = useDebounce(parentBranchName, DEBOUNCE_RATE);
-
-const filterParentBranch = (branch: Branch) => {
- // Only "main branch" aka parent-less branches can be parents.
- return !branch.parentBranch;
-};
-
-const nextFakeBranchName = () => {
- return `${props.project.name}/branches/-${uniqueId()}`;
-};
-
-const prepareBranchFromParentBranch = async (parent: string) => {
- const tag = `prepareBranchFromParentBranch(${parent})`;
- console.time(tag);
- const parentBranch = await branchStore.fetchBranchByName(
- parent,
- false /* !useCache */
- );
- const branch = cloneDeep(parentBranch);
- branch.name = nextFakeBranchName();
- console.timeEnd(tag);
- return branch;
-};
-const prepareBranchFromDatabaseHead = async (databaseName: string) => {
- const tag = `prepareBranchFromDatabaseHead(${databaseName})`;
- console.time(tag);
-
- console.time("--fetch metadata");
- const database = databaseStore.getDatabaseByName(databaseName);
- const metadata = await dbSchemaStore.getOrFetchDatabaseMetadata({
- database: database.name,
- view: DatabaseMetadataView.DATABASE_METADATA_VIEW_FULL,
- skipCache: true,
- });
- console.timeEnd("--fetch metadata");
-
- console.time("--build branch object");
- // Here metadata is not used for editing, so we need not to clone a copy
- // for baseline
- const branch = Branch.fromPartial({
- name: nextFakeBranchName(),
- engine: database.instanceResource.engine,
- baselineDatabase: database.name,
- baselineSchemaMetadata: metadata,
- schemaMetadata: metadata,
- });
- console.timeEnd("--build branch object");
-
- console.timeEnd(tag);
- return branch;
-};
-
-const branchData = shallowRef<BranchData>();
-
-const prepareBranch = async (
- _parentBranchName: string | undefined,
- _databaseName: string | undefined
-) => {
- isPreparingBranch.value = true;
-
- const finish = (s: BranchData | undefined) => {
- const isOutdated =
- _parentBranchName !== parentBranchName.value ||
- _databaseName !== databaseName.value;
- if (isOutdated) {
- return;
- }
-
- branchData.value = s;
- isPreparingBranch.value = false;
- };
-
- if (_parentBranchName) {
- const branch = await prepareBranchFromParentBranch(_parentBranchName);
- return finish({
- branch,
- parent: _parentBranchName,
- });
- }
- if (isValidDatabaseName(_databaseName)) {
- const branch = await prepareBranchFromDatabaseHead(_databaseName);
- return finish({
- branch,
- parent: undefined,
- });
- }
- return finish(undefined);
-};
-
-const handleSwitchSource = (src: Source) => {
- source.value = src;
- if (src === "PARENT") {
- databaseName.value = undefined;
- } else {
- parentBranchName.value = undefined;
- }
-};
-
-watch(
- [debouncedParentBranchName, debouncedDatabaseName],
- ([parentBranchName, databaseName]) => {
- prepareBranch(parentBranchName, databaseName);
- }
-);
-
-const allowConfirm = computed(() => {
- if (!hasProjectPermissionV2(props.project, "bb.branches.create")) {
- return false;
- }
- return branchId.value && branchData.value && !isCreating.value;
-});
-
-const confirmText = computed(() => {
- return t("common.create");
-});
-
-const handleConfirm = async () => {
- if (!branchData.value) {
- return;
- }
-
- if (!validateBranchName(branchId.value)) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: "Branch name valid characters: /^[a-zA-Z][a-zA-Z0-9-_/]+$/",
- });
- return;
- }
-
- const { branch, parent } = branchData.value;
-
- const { baselineDatabase } = branch;
-
- try {
- isCreating.value = true;
- if (!parent) {
- await branchStore.createBranch(
- props.project.name,
- branchId.value,
- Branch.fromPartial({
- baselineDatabase,
- })
- );
- } else {
- await branchStore.createBranch(
- props.project.name,
- branchId.value,
- Branch.fromPartial({
- parentBranch: parent,
- })
- );
- }
- isCreating.value = false;
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("schema-designer.message.created-succeed"),
- });
-
- // Go to branch detail page after created.
- router.replace({
- name: PROJECT_V1_ROUTE_BRANCH_DETAIL,
- params: {
- branchName: branchId.value,
- },
- });
- } catch {
- isCreating.value = false;
- }
-};
-</script>
diff --git a/frontend/src/components/Branch/BranchDataTable/cells/AsyncBranchNameCell.vue b/frontend/src/components/Branch/BranchDataTable/cells/AsyncBranchNameCell.vue
deleted file mode 100644
index bfd1c2bacd..0000000000
--- a/frontend/src/components/Branch/BranchDataTable/cells/AsyncBranchNameCell.vue
+++ /dev/null
@@ -1,49 +0,0 @@
-<template>
- <div class="flex flex-row justify-start items-center gap-1">
- <span
- class="cursor-pointer hover:underline hover:text-blue-600"
- @click.stop="handleBranchClick"
- >{{ branchName }}</span
- >
- </div>
-</template>
-
-<script lang="ts" setup>
-import { computedAsync } from "@vueuse/core";
-import { computed } from "vue";
-import { useRouter } from "vue-router";
-import { PROJECT_V1_ROUTE_BRANCH_DETAIL } from "@/router/dashboard/projectV1";
-import { useBranchStore } from "@/store";
-import {
- getProjectAndBranchId,
-} from "@/store/modules/v1/common";
-
-const props = defineProps<{
- name: string;
-}>();
-
-const router = useRouter();
-const branchStore = useBranchStore();
-
-const branch = computedAsync(async () => {
- const anyView = branchStore.getBranchByName(props.name);
- if (anyView) {
- return anyView;
- }
- return branchStore.fetchBranchByName(props.name);
-}, undefined);
-
-const branchName = computed(() => {
- return branch.value?.branchId ?? getProjectAndBranchId(props.name)[1];
-});
-
-const handleBranchClick = async () => {
- const [_, branchId] = getProjectAndBranchId(props.name);
- router.push({
- name: PROJECT_V1_ROUTE_BRANCH_DETAIL,
- params: {
- branchName: `${branchId}`,
- },
- });
-};
-</script>
diff --git a/frontend/src/components/Branch/BranchDataTable/cells/BranchNameCell.vue b/frontend/src/components/Branch/BranchDataTable/cells/BranchNameCell.vue
deleted file mode 100644
index 4303fc853d..0000000000
--- a/frontend/src/components/Branch/BranchDataTable/cells/BranchNameCell.vue
+++ /dev/null
@@ -1,39 +0,0 @@
-<template>
- <div class="flex flex-row justify-start items-center gap-1">
- <span
- class="cursor-pointer hover:underline hover:text-blue-600"
- @click.stop="handleBranchClick"
- >{{ branchName }}</span
- >
- </div>
-</template>
-
-<script lang="ts" setup>
-import { computed } from "vue";
-import { useRouter } from "vue-router";
-import { PROJECT_V1_ROUTE_BRANCH_DETAIL } from "@/router/dashboard/projectV1";
-import {
- getProjectAndBranchId,
-} from "@/store/modules/v1/common";
-import type { Branch } from "@/types/proto/v1/branch_service";
-
-const props = defineProps<{
- branch: Branch;
-}>();
-
-const router = useRouter();
-
-const branchName = computed(() => {
- return props.branch.branchId;
-});
-
-const handleBranchClick = async () => {
- const [_, branchId] = getProjectAndBranchId(props.branch.name);
- router.push({
- name: PROJECT_V1_ROUTE_BRANCH_DETAIL,
- params: {
- branchName: `${branchId}`,
- },
- });
-};
-</script>
diff --git a/frontend/src/components/Branch/BranchDataTable/cells/BranchUpdatedCell.vue b/frontend/src/components/Branch/BranchDataTable/cells/BranchUpdatedCell.vue
deleted file mode 100644
index 98045a901c..0000000000
--- a/frontend/src/components/Branch/BranchDataTable/cells/BranchUpdatedCell.vue
+++ /dev/null
@@ -1,38 +0,0 @@
-<template>
- <div class="flex flex-row justify-start items-center gap-1 whitespace-nowrap">
- <div
- class="flex flex-row gap-x-1 mr-1 justify-start items-center border border-gray-200 rounded-md p-0.5 px-2"
- >
- <UserAvatar size="TINY" :user="updater" />
- <span>{{ updater?.title }}</span>
- </div>
- <span>{{ updateTimeStr }}</span>
- </div>
-</template>
-
-<script lang="ts" setup>
-import dayjs from "dayjs";
-import { computed } from "vue";
-import UserAvatar from "@/components/User/UserAvatar.vue";
-import { useUserStore } from "@/store";
-import { getUserEmailFromIdentifier } from "@/store/modules/v1/common";
-import { getTimeForPbTimestamp } from "@/types";
-import type { Branch } from "@/types/proto/v1/branch_service";
-
-const props = defineProps<{
- branch: Branch;
-}>();
-
-const userStore = useUserStore();
-
-const updater = computed(() => {
- const email = getUserEmailFromIdentifier(props.branch.updater);
- return userStore.getUserByEmail(email);
-});
-
-const updateTimeStr = computed(() => {
- return dayjs
- .duration(getTimeForPbTimestamp(props.branch.updateTime) - Date.now())
- .humanize(true);
-});
-</script>
diff --git a/frontend/src/components/Branch/BranchDataTable/index.vue b/frontend/src/components/Branch/BranchDataTable/index.vue
deleted file mode 100644
index 55ac38bf92..0000000000
--- a/frontend/src/components/Branch/BranchDataTable/index.vue
+++ /dev/null
@@ -1,90 +0,0 @@
-<template>
- <NDataTable
- v-bind="$attrs"
- :loading="!ready"
- :columns="columns"
- :data="branches"
- :row-key="rowKey"
- :pagination="{
- pageSize: 5,
- }"
- :paginate-single-page="false"
- />
-</template>
-
-<script lang="ts" setup>
-import type { DataTableColumn } from "naive-ui";
-import { NDataTable } from "naive-ui";
-import { computed, h } from "vue";
-import { useI18n } from "vue-i18n";
-import BranchBaseline from "@/components/Branch/BranchBaseline.vue";
-import type { Branch } from "@/types/proto/v1/branch_service";
-import AsyncBranchNameCell from "./cells/AsyncBranchNameCell.vue";
-import BranchNameCell from "./cells/BranchNameCell.vue";
-import BranchUpdatedCell from "./cells/BranchUpdatedCell.vue";
-
-defineOptions({
- name: "BranchDataTable",
-});
-
-const props = defineProps<{
- branches: Branch[];
- ready?: boolean;
- showParentBranchColumn?: boolean;
-}>();
-
-const { t } = useI18n();
-
-const columns = computed(() => {
- const columns: (DataTableColumn<Branch> & { hide?: boolean })[] = [
- {
- title: t("common.branch"),
- key: "branchName",
- render: (row: Branch) => {
- return h(BranchNameCell, {
- branch: row,
- });
- },
- },
- {
- title: t("schema-designer.parent-branch"),
- key: "branchName",
- width: 256,
- hide: !props.showParentBranchColumn,
- render: (row: Branch) => {
- if (!row.parentBranch) return null;
- return h(AsyncBranchNameCell, {
- name: row.parentBranch,
- });
- },
- },
- {
- title: t("schema-designer.baseline-version"),
- key: "baselineVersion",
- width: 300,
- render: (row: Branch) => {
- return h(BranchBaseline, {
- branch: row,
- showInstanceIcon: true,
- });
- },
- },
- {
- title: t("common.updated"),
- key: "updated",
- width: 200,
- render: (row: Branch) => {
- return h(BranchUpdatedCell, {
- branch: row,
- });
- },
- },
- ];
-
- return columns.filter((column) => !column.hide);
-});
-
-const rowKey = (row: Branch) => {
- return row.name;
-};
-</script>
diff --git a/frontend/src/components/Branch/BranchDetailView.vue b/frontend/src/components/Branch/BranchDetailView.vue
deleted file mode 100644
index 62f2e30fd1..0000000000
--- a/frontend/src/components/Branch/BranchDetailView.vue
+++ /dev/null
@@ -1,517 +0,0 @@
-<template>
- <div class="flex flex-col gap-y-3 w-full h-full relative" v-bind="$attrs">
- <MaskSpinner
- v-if="state.isReverting || state.savingStatus"
- class="!bg-white/75"
- >
- <div class="text-sm">
- <template v-if="state.savingStatus">
- {{ state.savingStatus }}
- </template>
- </div>
- </MaskSpinner>
-
- <div class="w-full flex flex-row justify-between items-center gap-2">
- <div class="flex flex-row justify-start items-center gap-x-2">
- <span class="text-xl leading-[34px]">{{ cleanBranch.branchId }}</span>
- <span
- v-if="parentBranch"
- class="group text-sm border rounded-full px-2 py-1 cursor-pointer hover:bg-gray-100"
- @click="handleParentBranchClick"
- >
- <span class="text-gray-500 mr-1"
- >{{ $t("schema-designer.parent-branch") }}:</span
- >
- <span class="group-hover:underline group-hover:text-blue-600">{{
- parentBranch.branchId
- }}</span>
- </span>
- </div>
- <div class="shrink-0 flex flex-row justify-between items-center gap-2">
- <template v-if="!state.isEditing">
- <NButton v-if="showEditButton" @click="handleEdit">{{
- $t("common.edit")
- }}</NButton>
- <NButton v-if="showMergeBranchButton" @click="handleGotoMergeBranch">
- {{ $t("branch.merge-rebase.merge-branch") }}
- </NButton>
- <NButton
- v-if="showRebaseBranchButton"
- @click="handleGotoRebaseBranch"
- >
- {{ $t("branch.merge-rebase.rebase-branch") }}
- </NButton>
- <NButton
- v-if="showApplyBranchButton"
- type="primary"
- @click="handleApplyBranchToDatabase"
- >{{ $t("schema-designer.apply-to-database") }}</NButton
- >
- </template>
- <template v-else>
- <NButton :loading="state.isReverting" @click="handleCancelEdit">{{
- $t("common.cancel")
- }}</NButton>
- <NButton
- type="primary"
- :loading="!!state.savingStatus"
- @click="handleSaveBranch"
- >{{ $t("common.save") }}</NButton
- >
- </template>
- </div>
- </div>
-
- <NDivider class="!my-0" />
-
- <div
- class="w-full flex flex-row justify-between items-center text-sm gap-4 h-[32px]"
- >
- <div
- class="flex-1 flex flex-row justify-start items-center opacity-80 whitespace-nowrap"
- >
- <span class="mr-4">{{ $t("schema-designer.baseline-version") }}:</span>
- <DatabaseInfo class="flex-nowrap" :database="database" />
- </div>
- <div
- v-if="!state.isEditing"
- class="flex flex-row justify-end items-center gap-x-1 whitespace-nowrap"
- >
- <NCheckbox v-model:checked="state.showDiff">
- {{ $t("branch.show-diff-with-branch-baseline") }}
- </NCheckbox>
- </div>
- </div>
-
- <div class="w-full flex-1 flex flex-col overflow-hidden">
- <SchemaDesignEditorLite
- ref="schemaDesignerRef"
- :project="project"
- :readonly="!state.isEditing"
- :branch="dirtyBranch"
- :disable-diff-coloring="!state.isEditing && !state.showDiff"
- @update-is-editing="updateIsEditing"
- />
- </div>
- <!-- Don't show delete button in view mode. -->
- <div v-if="allowDelete">
- <BBButtonConfirm
- :type="'DELETE'"
- :button-text="$t('database.delete-this-branch')"
- :require-confirm="true"
- @confirm="deleteBranch(false)"
- />
- </div>
- </div>
-
- <TargetDatabasesSelectPanel
- v-if="selectTargetDatabasesContext.show"
- :project="project.name"
- :engine="dirtyBranch.engine"
- :loading="!!state.applyingToDatabaseStatus"
- @close="selectTargetDatabasesContext.show = false"
- @update="handleApplyToDatabase"
- />
-</template>
-
-<script lang="ts" setup>
-import { asyncComputed, computedAsync } from "@vueuse/core";
-import { cloneDeep } from "lodash-es";
-import { NButton, NCheckbox, NDivider, useDialog } from "naive-ui";
-import { Status } from "nice-grpc-common";
-import { v4 as uuidv4 } from "uuid";
-import { computed, nextTick, reactive, ref, watch } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
-import { BBButtonConfirm } from "@/bbkit";
-import DatabaseInfo from "@/components/DatabaseInfo.vue";
-import { validateDatabaseMetadata } from "@/components/SchemaEditorLite";
-import TargetDatabasesSelectPanel from "@/components/SyncDatabaseSchemaV1/TargetDatabasesSelectPanel.vue";
-import {
- PROJECT_V1_ROUTE_BRANCHES,
- PROJECT_V1_ROUTE_BRANCH_DETAIL,
- PROJECT_V1_ROUTE_BRANCH_MERGE,
- PROJECT_V1_ROUTE_BRANCH_ROLLOUT,
- PROJECT_V1_ROUTE_BRANCH_REBASE,
- PROJECT_V1_ROUTE_ISSUE_DETAIL,
-} from "@/router/dashboard/projectV1";
-import {
- extractUserEmail,
- pushNotification,
- useDatabaseV1Store,
- useCurrentUserV1,
- useStorageStore,
-} from "@/store";
-import { useBranchStore } from "@/store/modules/branch";
-import { getProjectAndBranchId } from "@/store/modules/v1/common";
-import {
- unknownDatabase,
- type ComposedProject,
- type Permission,
-} from "@/types";
-import { Branch } from "@/types/proto/v1/branch_service";
-import { DatabaseMetadata } from "@/types/proto/v1/database_service";
-import {
- defer,
- extractProjectResourceName,
- generateIssueTitle,
- hasProjectPermissionV2,
-} from "@/utils";
-import { getErrorCode } from "@/utils/grpcweb";
-import { provideSQLCheckContext } from "../SQLCheck";
-import { generateDiffDDL } from "../SchemaEditorLite";
-import MaskSpinner from "../misc/MaskSpinner.vue";
-import SchemaDesignEditorLite from "./SchemaDesignEditorLite.vue";
-
-interface LocalState {
- branchId: string;
- showDiff: boolean;
- isEditing: boolean;
- isEditingBranchId: boolean;
- isReverting: boolean;
- savingStatus: string;
- applyingToDatabaseStatus: boolean;
-}
-
-const props = defineProps<{
- project: ComposedProject;
- cleanBranch: Branch;
- dirtyBranch: Branch;
-}>();
-
-const { t } = useI18n();
-const router = useRouter();
-const databaseStore = useDatabaseV1Store();
-const branchStore = useBranchStore();
-const { runSQLCheck } = provideSQLCheckContext();
-const schemaDesignerRef = ref<InstanceType<typeof SchemaDesignEditorLite>>();
-const state = reactive<LocalState>({
- branchId: "",
- // default true to child branches, default false to main branches
- showDiff: props.dirtyBranch.parentBranch ? true : false,
- isEditing: false,
- isEditingBranchId: false,
- isReverting: false,
- savingStatus: "",
- applyingToDatabaseStatus: false,
-});
-const $dialog = useDialog();
-const selectTargetDatabasesContext = ref<{
- show: boolean;
-}>({
- show: false,
-});
-
-const currentUser = useCurrentUserV1();
-
-const checkPermission = (permission: Permission): boolean => {
- return (
- hasProjectPermissionV2(props.project, permission) ||
- extractUserEmail(props.cleanBranch.creator) === currentUser.value.email
- );
-};
-
-const allowDelete = computed(() => {
- if (props.dirtyBranch.parentBranch === "") {
- return checkPermission("bb.branches.admin");
- }
- return checkPermission("bb.branches.delete");
-});
-
-const parentBranch = asyncComputed(async () => {
- const branch = props.dirtyBranch;
- // Show parent branch when the current branch is a personal draft and it's not the new created one.
- if (branch.parentBranch !== "") {
- return await branchStore.fetchBranchByName(
- branch.parentBranch,
- true /* useCache */
- );
- }
- return undefined;
-}, undefined);
-
-const database = computedAsync(() => {
- return databaseStore.getOrFetchDatabaseByName(
- props.dirtyBranch.baselineDatabase
- );
-}, unknownDatabase());
-
-const showEditButton = computed(() => {
- if (checkPermission("bb.branches.admin")) {
- return true;
- }
- // main branches (parent-less branches) cannot be updated.
- if (!parentBranch.value) {
- return false;
- }
- return true;
-});
-
-const showMergeBranchButton = computed(() => {
- // main branches (parent-less branches) cannot be merged.
- if (!parentBranch.value) {
- return false;
- }
- return checkPermission("bb.branches.update");
-});
-
-const showRebaseBranchButton = computed(() => {
- // For main branches: only project owners are allowed
- if (!parentBranch.value) {
- return hasProjectPermissionV2(props.project, "bb.branches.admin");
- }
-
- return checkPermission("bb.branches.update");
-});
-
-const showApplyBranchButton = computed(() => {
- // only main branches can be applied to databases.
- return !parentBranch.value;
-});
-
-const rebuildMetadataEdit = () => {
- const rebuild = schemaDesignerRef.value?.schemaEditor?.rebuildMetadataEdit;
- if (typeof rebuild !== "function") {
- console.warn("<SchemaEditor> ref is missing");
- return;
- }
- const branch = props.dirtyBranch;
- rebuild(
- database.value,
- branch.baselineSchemaMetadata ?? DatabaseMetadata.fromPartial({}),
- branch.schemaMetadata ?? DatabaseMetadata.fromPartial({})
- );
-};
-
-watch(
- () => props.dirtyBranch.branchId,
- (title) => {
- state.branchId = title;
- },
- {
- immediate: true,
- }
-);
-
-const handleParentBranchClick = async () => {
- if (!parentBranch.value) {
- return;
- }
-
- const [_, branchId] = getProjectAndBranchId(parentBranch.value.name);
- router.push({
- name: PROJECT_V1_ROUTE_BRANCH_DETAIL,
- params: {
- branchName: `${branchId}`,
- },
- });
-};
-
-const handleEdit = async () => {
- state.isEditing = true;
-};
-
-const handleCancelEdit = async () => {
- state.isReverting = true;
-
- Object.assign(props.dirtyBranch, cloneDeep(props.cleanBranch));
-
- await nextTick();
- rebuildMetadataEdit();
-
- state.isReverting = false;
- state.isEditing = false;
-};
-
-const handleSaveBranch = async () => {
- if (!state.isEditing) {
- return;
- }
- if (state.savingStatus) {
- return;
- }
-
- const applyMetadataEdit =
- schemaDesignerRef.value?.schemaEditor?.applyMetadataEdit;
- if (typeof applyMetadataEdit !== "function") {
- return;
- }
- const cleanup = async (success = false) => {
- state.savingStatus = "";
- if (success) {
- state.isEditing = false;
- await nextTick();
- rebuildMetadataEdit();
- }
- };
-
- const check = runSQLCheck.value;
- if (check) {
- state.savingStatus = "Checking SQL";
- if (!(await check())) {
- return cleanup();
- }
- // TODO: optimize: check() could return the generated DDL to avoid
- // generating one more time below. useful for large schemas
- }
-
- state.savingStatus = "Validating schema";
- const branch = props.dirtyBranch;
- const editing = branch.schemaMetadata
- ? cloneDeep(branch.schemaMetadata)
- : DatabaseMetadata.fromPartial({});
- applyMetadataEdit(database.value, editing);
-
- const validationMessages = validateDatabaseMetadata(editing);
- if (validationMessages.length > 0) {
- pushNotification({
- module: "bytebase",
- style: "WARN",
- title: "Invalid schema design",
- description: validationMessages.join("\n"),
- });
- return cleanup();
- }
-
- state.savingStatus = "Saving";
- const updateMask = ["schema_metadata"];
- const updatedBranch = await branchStore.updateBranch(
- Branch.fromPartial({
- name: branch.name,
- schemaMetadata: editing,
- }),
- updateMask
- );
- Object.assign(props.cleanBranch, updatedBranch);
- Object.assign(props.dirtyBranch, cloneDeep(updatedBranch));
-
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("schema-designer.message.updated-succeed"),
- });
- cleanup(/* success */ true);
-};
-
-const handleGotoMergeBranch = () => {
- router.push({
- name: PROJECT_V1_ROUTE_BRANCH_MERGE,
- params: {
- branchName: props.cleanBranch.branchId,
- },
- });
-};
-const handleGotoRebaseBranch = () => {
- router.push({
- name: PROJECT_V1_ROUTE_BRANCH_REBASE,
- params: {
- branchName: props.cleanBranch.branchId,
- },
- });
-};
-
-const handleApplyBranchToDatabase = () => {
- router.push({
- name: PROJECT_V1_ROUTE_BRANCH_ROLLOUT,
- params: {
- branchName: props.cleanBranch.branchId,
- },
- });
-};
-
-const handleApplyToDatabase = async (databaseNameList: string[]) => {
- const cleanup = () => {
- state.applyingToDatabaseStatus = false;
- };
-
- state.applyingToDatabaseStatus = true;
- // Use the raw branch since the branch might be dirty by schema editor
- const branch = props.cleanBranch;
-
- const source =
- branch.baselineSchemaMetadata ?? DatabaseMetadata.fromPartial({});
- const target = branch.schemaMetadata ?? DatabaseMetadata.fromPartial({});
- const result = await generateDiffDDL(
- database.value,
- source,
- target,
- /* !allowEmptyDiffDDLWithConfigChange */ false
- );
-
- if (result.errors.length > 0) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: t("common.error"),
- description: result.errors.join("\n"),
- });
- return cleanup();
- }
-
- const targetDatabaseList = databaseNameList.map((name) =>
- databaseStore.getDatabaseByName(name)
- );
- const sqlStorageKey = `bb.issues.sql.${uuidv4()}`;
- useStorageStore().put(sqlStorageKey, result.statement);
- const query: Record<string, any> = {
- template: "bb.issue.database.schema.update",
- mode: "normal",
- ghost: undefined,
- branch: branch.name,
- sqlStorageKey,
- };
- query.databaseList = targetDatabaseList.map((db) => db.name).join(",");
- query.name = generateIssueTitle(
- "bb.issue.database.schema.update",
- targetDatabaseList.map((db) => db.databaseName)
- );
- const routeInfo = {
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(props.project.name),
- issueSlug: "create",
- },
- query,
- };
- router.push(routeInfo);
-};
-
-const confirmForceDeleteBranch = () => {
- const d = defer<boolean>();
- $dialog.warning({
- title: t("common.warning"),
- content: t("branch.deleting-parent-branch"),
- style: "z-index: 100000",
- negativeText: t("common.cancel"),
- positiveText: t("branch.force-delete"),
- onNegativeClick: () => {
- d.resolve(false);
- },
- onPositiveClick: () => {
- d.resolve(true);
- },
- });
- return d.promise;
-};
-
-const deleteBranch = async (force: boolean) => {
- const branch = props.dirtyBranch;
- try {
- await branchStore.deleteBranch(branch.name, force);
- router.replace({
- name: PROJECT_V1_ROUTE_BRANCHES,
- });
- } catch (err) {
- if (getErrorCode(err) === Status.FAILED_PRECONDITION) {
- const confirmed = await confirmForceDeleteBranch();
- if (confirmed) {
- deleteBranch(true);
- }
- }
- }
-};
-
-const updateIsEditing = (newValue: boolean) => {
- state.isEditing = newValue;
-};
-</script>
diff --git a/frontend/src/components/Branch/BranchMergeView/BranchMergeView.vue b/frontend/src/components/Branch/BranchMergeView/BranchMergeView.vue
deleted file mode 100644
index 9c7eae9658..0000000000
--- a/frontend/src/components/Branch/BranchMergeView/BranchMergeView.vue
+++ /dev/null
@@ -1,266 +0,0 @@
-<template>
- <div class="h-full relative flex flex-col gap-y-2 overflow-y-hidden text-sm">
- <MaskSpinner v-if="state.isMerging" />
-
- <MergeBranchSelect
- :project="project"
- :head-branch="headBranch"
- :target-branch="targetBranch"
- :parent-branch-only="true"
- @update:head-branch-name="handleUpdateHeadBranch"
- @update:target-branch-name="state.targetBranchName = $event || null"
- />
-
- <MergeBranchValidationStateView
- :project="project"
- :head-branch="headBranch"
- :target-branch="targetBranch"
- :is-loading-head-branch="isLoadingHeadBranch"
- :is-loading-target-branch="isLoadingTargetBranch"
- :is-validating="isValidating"
- :validation-state="validationState"
- />
-
- <div class="flex-1">
- <BranchComparison
- v-if="validationState?.branch"
- :project="project"
- :base="targetBranch"
- :head="validationState?.branch"
- :is-base-loading="isLoadingTargetBranch"
- :is-head-loading="isValidating"
- >
- <template v-if="targetBranch" #baseline-title>
- {{ targetBranch.branchId }}
- {{ $t("branch.merge-rebase.before-merge") }}
- </template>
- <template v-if="targetBranch" #head-title>
- {{ targetBranch.branchId }}
- {{ $t("branch.merge-rebase.after-merge") }}
- </template>
- </BranchComparison>
- <div v-else-if="validationState?.errmsg" class="text-error text-sm">
- {{ validationState.errmsg }}
- </div>
- </div>
-
- <div class="flex flex-row justify-end items-center gap-x-3">
- <MergeBranchButton
- :button-props="{
- type: 'primary',
- disabled: !allowConfirm || state.isMerging,
- }"
- @perform-action="handleMergeBranch"
- />
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { computedAsync } from "@vueuse/core";
-import { Status } from "nice-grpc-common";
-import { computed, reactive, ref, watch } from "vue";
-import { useI18n } from "vue-i18n";
-import MaskSpinner from "@/components/misc/MaskSpinner.vue";
-import { branchServiceClient } from "@/grpcweb";
-import { pushNotification, useBranchStore } from "@/store";
-import type { ComposedProject } from "@/types";
-import { Branch } from "@/types/proto/v1/branch_service";
-import { extractGrpcErrorMessage, getErrorCode } from "@/utils/grpcweb";
-import BranchComparison from "../common/BranchComparison.vue";
-import MergeBranchButton from "./MergeBranchButton.vue";
-import MergeBranchSelect from "./MergeBranchSelect.vue";
-import MergeBranchValidationStateView from "./MergeBranchValidationStateView.vue";
-import type { MergeBranchValidationState, PostMergeAction } from "./types";
-
-interface LocalState {
- targetBranchName: string | null;
- isMerging: boolean;
-}
-
-const props = defineProps<{
- project: ComposedProject;
- headBranchName: string | null;
-}>();
-
-const emit = defineEmits<{
- (
- event: "merged",
- mergedBranch: Branch,
- headBranchName: string,
- headBranch: Branch | undefined
- ): void;
- (event: "update:head-branch-name", branchName: string | null): void;
-}>();
-
-const state = reactive<LocalState>({
- targetBranchName: null,
- isMerging: false,
-});
-const { t } = useI18n();
-const branchStore = useBranchStore();
-const isLoadingHeadBranch = ref(false);
-const isLoadingTargetBranch = ref(false);
-const isValidating = ref(false);
-
-const headBranch = computedAsync(
- async () => {
- const name = props.headBranchName;
- if (!name) {
- return undefined;
- }
- // Don't use local store cache since we need to ensure the branch is
- // fresh clean here
- return await branchStore.fetchBranchByName(name, /* !useCache */ false);
- },
- undefined,
- {
- evaluating: isLoadingHeadBranch,
- }
-);
-
-const targetBranch = computedAsync(
- async () => {
- const name = state.targetBranchName;
- if (!name) {
- return undefined;
- }
- // Don't use local store cache since we need to ensure the branch is
- // fresh clean here
- return await branchStore.fetchBranchByName(name, /* !useCache */ false);
- },
- undefined,
- {
- evaluating: isLoadingTargetBranch,
- }
-);
-
-const validationState = computedAsync(
- async (): Promise<MergeBranchValidationState | undefined> => {
- const head = headBranch.value;
- const target = targetBranch.value;
- if (!head) return;
- if (!target) return;
- try {
- const branch = await branchServiceClient.mergeBranch(
- {
- name: target.name,
- headBranch: head.name,
- validateOnly: true,
- },
- {
- silent: true,
- }
- );
- return {
- status: Status.OK,
- branch,
- };
- } catch (err) {
- const status = getErrorCode(err);
- const errmsg = extractGrpcErrorMessage(err);
- return {
- status,
- errmsg,
- };
- }
- },
- undefined,
- {
- evaluating: isValidating,
- }
-);
-const handleUpdateHeadBranch = (branchName: string | undefined) => {
- emit("update:head-branch-name", branchName || null);
-};
-
-const allowConfirm = computed(() => {
- return (
- headBranch.value !== undefined &&
- targetBranch.value !== undefined &&
- validationState.value?.status === Status.OK
- );
-});
-
-const handleMergeBranch = async (post: PostMergeAction) => {
- const target = targetBranch.value;
- if (!target) return;
- const head = headBranch.value;
- if (!head) return;
- state.isMerging = true;
-
- try {
- const mergedBranch = await branchStore.mergeBranch({
- name: target.name,
- headBranch: head.name,
- etag: "",
- validateOnly: false,
- });
-
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("branch.merge-rebase.merge-succeeded"),
- });
- if (post === "DELETE") {
- await branchStore.deleteBranch(head.name);
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("common.deleted"),
- });
-
- emit("merged", mergedBranch, head.name, undefined);
- return;
- }
- if (post === "REBASE") {
- await branchStore.deleteBranch(head.name);
- const pendingRecreateBranch = Branch.fromPartial({});
- if (head.parentBranch) {
- pendingRecreateBranch.parentBranch = head.parentBranch;
- } else {
- pendingRecreateBranch.baselineDatabase = head.baselineDatabase;
- }
- const recreatedBranch = await branchStore.createBranch(
- props.project.name,
- head.branchId,
- pendingRecreateBranch
- );
-
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("branch.merge-rebase.rebase-succeeded"),
- });
- emit("merged", recreatedBranch, recreatedBranch.name, recreatedBranch);
- return;
- }
- emit("merged", mergedBranch, head.name, head);
- } catch (error: any) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: `Request error occurred`,
- description: error.details,
- });
- } finally {
- state.isMerging = false;
- }
-};
-
-watch(
- headBranch,
- (head) => {
- if (head) {
- // Automatically select the branch's parent as merge target branch
- // if merge target is empty
- if (head.parentBranch && !state.targetBranchName) {
- state.targetBranchName = head.parentBranch;
- }
- }
- },
- {
- immediate: true,
- }
-);
-</script>
diff --git a/frontend/src/components/Branch/BranchMergeView/MergeBranchButton.vue b/frontend/src/components/Branch/BranchMergeView/MergeBranchButton.vue
deleted file mode 100644
index 6315344e4b..0000000000
--- a/frontend/src/components/Branch/BranchMergeView/MergeBranchButton.vue
+++ /dev/null
@@ -1,57 +0,0 @@
-<template>
- <ContextMenuButton
- :preference-key="`bb-branch-merge-action`"
- :action-list="actions"
- default-action-key="REBASE"
- size="medium"
- @click="
- $emit(
- 'perform-action',
- ($event as ContextMenuButtonAction<PostMergeAction>).params
- )
- "
- />
-</template>
-
-<script setup lang="ts">
-import type { ButtonProps } from "naive-ui";
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import {
- ContextMenuButton,
- type ContextMenuButtonAction,
-} from "@/components/v2";
-import type { PostMergeAction } from "./types";
-
-const props = defineProps<{
- buttonProps?: ButtonProps;
-}>();
-
-defineEmits<{
- (event: "perform-action", post: PostMergeAction): void;
-}>();
-
-const { t } = useI18n();
-const actions = computed((): ContextMenuButtonAction<PostMergeAction>[] => {
- return [
- {
- key: "NOOP",
- text: t("branch.merge-rebase.merge-branch"),
- params: "NOOP",
- props: props.buttonProps,
- },
- {
- key: "REBASE",
- text: t("branch.merge-rebase.post-merge-action.rebase"),
- params: "REBASE",
- props: props.buttonProps,
- },
- {
- key: "DELETE",
- text: t("branch.merge-rebase.post-merge-action.delete"),
- params: "DELETE",
- props: props.buttonProps,
- },
- ];
-});
-</script>
diff --git a/frontend/src/components/Branch/BranchMergeView/MergeBranchSelect.vue b/frontend/src/components/Branch/BranchMergeView/MergeBranchSelect.vue
deleted file mode 100644
index 4f3984e0bf..0000000000
--- a/frontend/src/components/Branch/BranchMergeView/MergeBranchSelect.vue
+++ /dev/null
@@ -1,83 +0,0 @@
-<template>
- <div
- class="w-full grid grid-cols-3 items-end text-sm gap-x-2"
- style="grid-template-columns: 1fr auto 1fr auto"
- >
- <div class="flex flex-col overflow-x-hidden">
- <div v-if="parentBranchOnly">
- {{ $t("schema-designer.parent-branch") }}
- </div>
- <NElement
- tag="div"
- class="flex overflow-x-hidden items-center gap-x-1"
- style="
- padding: 0 6px 0 12px;
- border: 1px solid var(--border-color);
- border-radius: var(--border-radius);
- min-height: var(--height-medium);
- "
- >
- <InstanceV1EngineIcon
- v-if="parentDatabase"
- :instance="parentDatabase.instanceResource"
- />
- <NPerformantEllipsis>
- {{ targetBranch?.branchId }}
- </NPerformantEllipsis>
- </NElement>
- </div>
- <div class="flex flex-row justify-center px-2">
- <MoveLeftIcon :size="40" stroke-width="1" />
- </div>
- <BranchSelector
- class="!full text-center"
- :clearable="false"
- :project="project"
- :branch="headBranch?.name"
- :filter="headBranchFilter"
- @update:branch="$emit('update:head-branch-name', $event)"
- />
- </div>
-</template>
-
-<script setup lang="ts">
-import { MoveLeftIcon } from "lucide-vue-next";
-import { NElement, NPerformantEllipsis } from "naive-ui";
-import { computed } from "vue";
-import { InstanceV1EngineIcon } from "@/components/v2";
-import { useDatabaseV1Store } from "@/store";
-import { isValidDatabaseName, type ComposedProject } from "@/types";
-import type { Branch } from "@/types/proto/v1/branch_service";
-import BranchSelector from "../BranchSelector.vue";
-
-const props = defineProps<{
- project: ComposedProject;
- targetBranch: Branch | undefined;
- headBranch: Branch | undefined;
- parentBranchOnly: boolean | undefined;
-}>();
-
-defineEmits<{
- (event: "update:head-branch-name", branch: string | undefined): void;
- (event: "update:target-branch-name", branch: string | undefined): void;
-}>();
-
-const parentDatabase = computed(() => {
- const name = props.targetBranch?.baselineDatabase;
- if (!isValidDatabaseName(name)) return undefined;
- return useDatabaseV1Store().getDatabaseByName(name);
-});
-
-const headBranchFilter = (branch: Branch) => {
- const { targetBranch } = props;
- if (!targetBranch) {
- return true;
- }
- return (
- branch.engine === targetBranch.engine &&
- branch.name !== targetBranch.name &&
- // Main branches are not allow be merged to any branch.
- !!branch.parentBranch
- );
-};
-</script>
diff --git a/frontend/src/components/Branch/BranchMergeView/MergeBranchValidationStateView.vue b/frontend/src/components/Branch/BranchMergeView/MergeBranchValidationStateView.vue
deleted file mode 100644
index 40d6c444b3..0000000000
--- a/frontend/src/components/Branch/BranchMergeView/MergeBranchValidationStateView.vue
+++ /dev/null
@@ -1,72 +0,0 @@
-<template>
- <div class="relative text-sm">
- <div class="flex flex-row items-center gap-x-1">
- <span v-if="!headBranch || !targetBranch">
- {{ $t("branch.merge-rebase.select-branches-to-merge") }}
- </span>
- <template v-else>
- <template v-if="isValidating">
- <BBSpin :size="20" />
- <span>{{ $t("branch.merge-rebase.validating-branch") }}</span>
- </template>
- <template v-else-if="validationState">
- <template v-if="validationState.status === Status.OK">
- <CheckIcon class="w-4 h-4 text-success" />
- <span>{{ $t("branch.merge-rebase.able-to-merge") }}</span>
- </template>
- <template v-else>
- <div class="flex flex-row items-center gap-x-1">
- <XCircleIcon class="w-4 h-4 text-error" />
- <i18n-t
- keypath="branch.merge-rebase.cannot-automatically-merge"
- tag="span"
- class="text-error"
- >
- <template #rebase_branch>
- <router-link
- :to="rebaseLink(headBranch, targetBranch)"
- class="normal-link"
- >
- {{ $t("branch.merge-rebase.go-rebase") }}
- </router-link>
- </template>
- </i18n-t>
- </div>
- </template>
- </template>
- </template>
- </div>
- </div>
-</template>
-
-<script setup lang="ts">
-import { CheckIcon, XCircleIcon } from "lucide-vue-next";
-import { Status } from "nice-grpc-common";
-import { PROJECT_V1_ROUTE_BRANCH_REBASE } from "@/router/dashboard/projectV1";
-import type { ComposedProject } from "@/types";
-import type { Branch } from "@/types/proto/v1/branch_service";
-import type { MergeBranchValidationState } from "./types";
-import { BBSpin } from "@/bbkit";
-
-defineProps<{
- project: ComposedProject;
- targetBranch: Branch | undefined;
- headBranch: Branch | undefined;
- isLoadingTargetBranch?: boolean;
- isLoadingHeadBranch?: boolean;
- isValidating?: boolean;
- validationState: MergeBranchValidationState | undefined;
-}>();
-
-const rebaseLink = (headBranch: Branch, targetBranch: Branch) => {
- return {
- name: PROJECT_V1_ROUTE_BRANCH_REBASE,
- params: {
- branchName: headBranch.branchId,
- },
- query: {
- source: targetBranch.branchId,
- },
- };
-};
-</script>
diff --git a/frontend/src/components/Branch/BranchMergeView/index.ts b/frontend/src/components/Branch/BranchMergeView/index.ts
deleted file mode 100644
index 50e87949fe..0000000000
--- a/frontend/src/components/Branch/BranchMergeView/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import BranchMergeView from "./BranchMergeView.vue";
-
-export default BranchMergeView;
diff --git a/frontend/src/components/Branch/BranchMergeView/types.ts b/frontend/src/components/Branch/BranchMergeView/types.ts
deleted file mode 100644
index b267e3b784..0000000000
--- a/frontend/src/components/Branch/BranchMergeView/types.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import type { Status } from "nice-grpc-common";
-import type { Branch } from "@/types/proto/v1/branch_service";
-
-export type MergeBranchValidationState = {
- status: Status;
- branch?: Branch;
- errmsg?: string;
-};
-
-export type PostMergeAction = "NOOP" | "DELETE" | "REBASE";
diff --git a/frontend/src/components/Branch/BranchRebaseView/BranchRebaseView.vue b/frontend/src/components/Branch/BranchRebaseView/BranchRebaseView.vue
deleted file mode 100644
index 274c20aa0d..0000000000
--- a/frontend/src/components/Branch/BranchRebaseView/BranchRebaseView.vue
+++ /dev/null
@@ -1,328 +0,0 @@
-<template>
- <div class="h-full relative flex flex-col gap-y-2 overflow-y-hidden text-sm">
- <MaskSpinner v-if="state.isRebasing" :zindexable="false" />
-
- <RebaseBranchSelect
- :project="project"
- :source-type="state.sourceType"
- :head-branch="headBranch"
- :source-branch="sourceBranch"
- :source-database="sourceDatabase"
- :parent-branch-only="parentBranchOnly"
- @update:source-type="state.sourceType = $event"
- @update:head-branch-name="handleUpdateHeadBranch"
- @update:source-branch-name="state.sourceBranchName = $event || null"
- @update:source-database-name="state.sourceDatabaseName = $event || null"
- />
-
- <RebaseBranchValidationStateView
- :project="project"
- :source-type="state.sourceType"
- :head-branch="headBranch"
- :source-branch="sourceBranch"
- :source-database="sourceDatabase"
- :is-loading-head-branch="isLoadingHeadBranch"
- :is-loading-source-branch="isLoadingSourceBranch"
- :is-validating="isValidating"
- :validation-state="validationState"
- />
-
- <div class="flex-1 flex flex-col overflow-y-hidden">
- <BranchComparison
- v-if="validationState?.branch && hasConflict"
- :project="project"
- :base="headBranch"
- :head="validationState?.branch"
- :is-base-loading="isLoadingHeadBranch"
- :is-head-loading="isValidating"
- >
- <template v-if="headBranch" #baseline-title>
- {{ headBranch.branchId }}
- {{ $t("branch.merge-rebase.before-rebase") }}
- </template>
- <template v-if="headBranch" #head-title>
- {{ headBranch.branchId }}
- {{ $t("branch.merge-rebase.after-rebase") }}
- </template>
- </BranchComparison>
- <ResolveConflict
- v-else-if="validationState && hasConflict"
- ref="resolveConflictRef"
- :project="project"
- :validation-state="validationState"
- />
- </div>
-
- <div class="flex flex-row justify-end items-center gap-x-3">
- <NButton
- type="primary"
- :disabled="!allowConfirm || state.isRebasing"
- @click="handleRebaseBranch"
- >
- {{ $t("common.confirm") }}
- </NButton>
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { computedAsync } from "@vueuse/core";
-import { NButton, useDialog } from "naive-ui";
-import { ClientError, Status } from "nice-grpc-common";
-import { computed, onMounted, reactive, ref, watch } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRoute } from "vue-router";
-import MaskSpinner from "@/components/misc/MaskSpinner.vue";
-import { branchServiceClient } from "@/grpcweb";
-import { pushNotification, useBranchStore, useDatabaseV1Store } from "@/store";
-import type { ComposedProject } from "@/types";
-import { isValidDatabaseName } from "@/types";
-import type { Branch } from "@/types/proto/v1/branch_service";
-import { defer } from "@/utils";
-import BranchComparison from "../common/BranchComparison.vue";
-import RebaseBranchSelect from "./RebaseBranchSelect.vue";
-import RebaseBranchValidationStateView from "./RebaseBranchValidationStateView.vue";
-import ResolveConflict from "./ResolveConflict.vue";
-import type { RebaseBranchValidationState, RebaseSourceType } from "./types";
-
-interface LocalState {
- currentStepIndex: number;
- sourceBranchName: string | null;
- sourceDatabaseName: string | null;
- sourceType: RebaseSourceType;
- isRebasing: boolean;
-}
-
-const props = defineProps<{
- project: ComposedProject;
- headBranchName: string | null;
-}>();
-
-const emit = defineEmits<{
- (event: "rebased", rebasedBranch: Branch): void;
- (event: "update:head-branch-name", branchName: string | null): void;
-}>();
-
-const state = reactive<LocalState>({
- currentStepIndex: 0,
- sourceBranchName: null,
- sourceDatabaseName: null,
- sourceType: "BRANCH",
- isRebasing: false,
-});
-const { t } = useI18n();
-const route = useRoute();
-const $dialog = useDialog();
-const resolveConflictRef = ref<InstanceType<typeof ResolveConflict>>();
-const branchStore = useBranchStore();
-const isLoadingHeadBranch = ref(false);
-const isLoadingSourceBranch = ref(false);
-const isValidating = ref(false);
-
-const headBranch = computedAsync(
- async () => {
- const name = props.headBranchName;
- if (!name) {
- return undefined;
- }
- // Don't use local store cache since we need to ensure the branch is
- // fresh clean here
- return await branchStore.fetchBranchByName(name, /* !useCache */ false);
- },
- undefined,
- {
- evaluating: isLoadingHeadBranch,
- }
-);
-
-const sourceBranch = computedAsync(
- async () => {
- if (state.sourceType === "DATABASE") {
- return undefined;
- }
- const name = state.sourceBranchName;
- if (!name) {
- return undefined;
- }
- // Don't use local store cache since we need to ensure the branch is
- // fresh clean here
- return await branchStore.fetchBranchByName(name, /* !useCache */ false);
- },
- undefined,
- {
- evaluating: isLoadingSourceBranch,
- }
-);
-const sourceDatabase = computed(() => {
- if (state.sourceType === "BRANCH") {
- return undefined;
- }
- const name = state.sourceDatabaseName;
- if (!isValidDatabaseName(name)) {
- return undefined;
- }
- return useDatabaseV1Store().getDatabaseByName(name);
-});
-const sourceBranchOrDatabase = computed(() => {
- if (state.sourceType === "BRANCH") {
- return sourceBranch.value;
- }
- return sourceDatabase.value;
-});
-
-const parentBranchOnly = computed(() => {
- const head = headBranch.value;
- if (!head) {
- return false; // not ready yet
- }
- if (!head.parentBranch) {
- return false; // parent-less (main) branches
- }
- return true;
-});
-
-const hasConflict = computed(() => {
- if (sourceDatabase.value?.databaseName == "bytebase-conflict") {
- return true;
- }
- return !!validationState.value?.conflictSchema;
-});
-
-const validationState = computedAsync(
- async (): Promise<RebaseBranchValidationState | undefined> => {
- const head = headBranch.value;
- const source = sourceBranchOrDatabase.value;
- if (!head) return;
- if (!source) return;
- const response = await branchServiceClient.rebaseBranch({
- name: head.name,
- sourceBranch: state.sourceType === "BRANCH" ? source.name : undefined,
- sourceDatabase: state.sourceType === "DATABASE" ? source.name : undefined,
- validateOnly: true,
- });
- return response;
- },
- undefined,
- {
- evaluating: isValidating,
- }
-);
-const handleUpdateHeadBranch = (branchName: string | undefined) => {
- emit("update:head-branch-name", branchName || null);
-};
-
-const allowConfirm = computed(() => {
- return (
- headBranch.value !== undefined &&
- sourceBranchOrDatabase.value !== undefined &&
- validationState.value !== undefined
- );
-});
-
-const confirmRebaseWithMaybeConflict = () => {
- const d = defer<boolean>();
- $dialog.warning({
- title: t("branch.merge-rebase.confirm-rebase"),
- content: t("branch.merge-rebase.conflict-not-resolved"),
- style: "z-index: 100000",
- negativeText: t("common.cancel"),
- positiveText: t("common.confirm"),
- onNegativeClick: () => {
- d.resolve(false);
- },
- onPositiveClick: () => {
- d.resolve(true);
- },
- });
- return d.promise;
-};
-
-const handleRebaseBranch = async () => {
- const source = sourceBranchOrDatabase.value;
- if (!source) return;
- const head = headBranch.value;
- if (!head) return;
-
- let mergedSchema = "";
- const resolveConflict = resolveConflictRef.value;
- if (resolveConflict) {
- const validation = resolveConflict.validateConflictSchema();
- if (!validation.valid) {
- const confirmed = await confirmRebaseWithMaybeConflict();
- if (!confirmed) return;
- }
- mergedSchema = validation.schema ?? "";
- }
- state.isRebasing = true;
-
- try {
- const response = await branchStore.rebaseBranch({
- name: head.name,
- sourceBranch: state.sourceType === "BRANCH" ? source.name : "",
- sourceDatabase: state.sourceType === "DATABASE" ? source.name : "",
- mergedSchema,
- etag: "",
- validateOnly: false,
- });
- if (!response.branch) {
- throw new ClientError(
- "BranchService.RebaseBranch",
- Status.ABORTED,
- "rebase failed"
- );
- }
-
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("branch.merge-rebase.rebase-succeeded"),
- });
-
- emit("rebased", response.branch);
- } catch (error: any) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: `Request error occurred`,
- description: error.details,
- });
- } finally {
- state.isRebasing = false;
- }
-};
-
-watch(
- headBranch,
- (head, prevValue) => {
- if (!head) return;
- if (!prevValue && route.query.source) {
- // Initial head branch loaded
- return;
- }
- // Automatically set the sourceDatabase to the branch's baselineDatabase
- // if sourceDatabase is empty
- if (!state.sourceDatabaseName) {
- state.sourceDatabaseName = head.baselineDatabase;
- state.sourceType = "DATABASE";
- }
-
- // Automatically select the branch's parent as rebase source branch
- // if rebase source is empty
- if (head.parentBranch && !state.sourceBranchName) {
- state.sourceBranchName = head.parentBranch;
- state.sourceType = "BRANCH";
- }
- },
- {
- immediate: true,
- }
-);
-
-onMounted(() => {
- if (route.query.source) {
- const source = `${props.project.name}/branches/${route.query.source}`;
- state.sourceBranchName = source;
- state.sourceType = "BRANCH";
- }
-});
-</script>
diff --git a/frontend/src/components/Branch/BranchRebaseView/RebaseBranchSelect.vue b/frontend/src/components/Branch/BranchRebaseView/RebaseBranchSelect.vue
deleted file mode 100644
index a125986fb1..0000000000
--- a/frontend/src/components/Branch/BranchRebaseView/RebaseBranchSelect.vue
+++ /dev/null
@@ -1,122 +0,0 @@
-<template>
- <div
- class="w-full grid grid-cols-3 items-end text-sm gap-x-2"
- style="grid-template-columns: 1fr auto 1fr"
- >
- <BranchSelector
- class="!full text-center"
- :clearable="false"
- :project="project"
- :branch="headBranch?.name"
- :filter="headBranchFilter"
- @update:branch="$emit('update:head-branch-name', $event)"
- />
- <div class="flex flex-row justify-center px-2 h-[34px]">
- <MoveLeftIcon :size="40" stroke-width="1" />
- </div>
- <div class="flex flex-col">
- <NRadioGroup
- v-if="!parentBranchOnly"
- :value="sourceType"
- class="space-x-2"
- @update:value="$emit('update:source-type', $event as RebaseSourceType)"
- >
- <NRadio value="BRANCH">{{ $t("common.branch") }}</NRadio>
- <NRadio value="DATABASE">{{ $t("common.database") }}</NRadio>
- </NRadioGroup>
- <div v-if="parentBranchOnly">
- {{ $t("schema-designer.parent-branch") }}
- </div>
-
- <BranchSelector
- v-if="sourceType === 'BRANCH'"
- class="!w-full text-center"
- :disabled="parentBranchOnly"
- :clearable="false"
- :project="project"
- :branch="sourceBranch?.name"
- :filter="sourceBranchFilter"
- @update:branch="$emit('update:source-branch-name', $event)"
- />
- <DatabaseSelect
- v-if="sourceType === 'DATABASE'"
- :database-name="sourceDatabase?.name"
- :project-name="project.name"
- :allowed-engine-type-list="headBranch ? [headBranch.engine] : undefined"
- :filter="databaseFilter"
- :loading="isPreparingDatabaseGroups"
- style="width: 100%"
- @update:database-name="$emit('update:source-database-name', $event)"
- />
- </div>
- </div>
-</template>
-
-<script setup lang="ts">
-import { MoveLeftIcon } from "lucide-vue-next";
-import { NRadio, NRadioGroup } from "naive-ui";
-import { computed, toRef } from "vue";
-import { DatabaseSelect } from "@/components/v2";
-import { useDatabaseInGroupFilter, useDatabaseV1Store } from "@/store";
-import type { ComposedDatabase, ComposedProject } from "@/types";
-import type { Branch } from "@/types/proto/v1/branch_service";
-import BranchSelector from "../BranchSelector.vue";
-import type { RebaseSourceType } from "./types";
-
-const props = defineProps<{
- project: ComposedProject;
- sourceType: RebaseSourceType;
- headBranch: Branch | undefined;
- sourceBranch: Branch | undefined;
- sourceDatabase: ComposedDatabase | undefined;
- parentBranchOnly: boolean | undefined;
- isLoadingSourceBranch?: boolean;
- isLoadingHeadBranch?: boolean;
-}>();
-
-defineEmits<{
- (event: "update:source-type", type: RebaseSourceType): void;
- (event: "update:head-branch-name", branch: string | undefined): void;
- (event: "update:source-branch-name", branch: string | undefined): void;
- (event: "update:source-database-name", uid: string | undefined): void;
-}>();
-
-const referencedDatabase = computed(() => {
- const name = props.headBranch?.baselineDatabase;
- if (!name) return undefined;
- return useDatabaseV1Store().getDatabaseByName(name);
-});
-const { isPreparingDatabaseGroups, databaseFilter } = useDatabaseInGroupFilter(
- toRef(props, "project"),
- referencedDatabase
-);
-
-const sourceBranchOrDatabase = computed(() => {
- return props.sourceType === "BRANCH"
- ? props.sourceBranch
- : props.sourceDatabase;
-});
-
-const sourceBranchFilter = (branch: Branch) => {
- const { headBranch } = props;
- if (!headBranch) {
- return true;
- }
- return branch.engine === headBranch.engine && branch.name !== headBranch.name;
-};
-const headBranchFilter = (branch: Branch) => {
- const source = sourceBranchOrDatabase.value;
- if (!source) {
- return true;
- }
- if (props.sourceType === "BRANCH") {
- const sourceBranch = source as Branch;
- return (
- branch.engine === sourceBranch.engine && branch.name !== sourceBranch.name
- );
- } else {
- const sourceDatabase = source as ComposedDatabase;
- return branch.engine === sourceDatabase.instanceResource.engine;
- }
-};
-</script>
diff --git a/frontend/src/components/Branch/BranchRebaseView/RebaseBranchStep.vue b/frontend/src/components/Branch/BranchRebaseView/RebaseBranchStep.vue
deleted file mode 100644
index 282d506bb0..0000000000
--- a/frontend/src/components/Branch/BranchRebaseView/RebaseBranchStep.vue
+++ /dev/null
@@ -1,192 +0,0 @@
-<template>
- <div class="flex-1 flex flex-col gap-y-1 text-sm">
- <template v-if="validationState.branch">
- <div>
- {{
- $t("branch.merge-rebase.preview-rebase-result", {
- branch: baseBranch.branchId,
- })
- }}
- </div>
- <!-- BranchService.RebaseBranch now returns empty schema and metadata -->
- <!-- so we have nothing to show by now -->
- <NTabs v-model:value="tab">
- <NTab name="schema-editor">
- {{ $t("schema-editor.self") }}
- </NTab>
- <NTab name="raw-schema-text">
- {{ $t("schema-editor.raw-sql") }}
- </NTab>
- </NTabs>
- <div
- v-show="tab === 'schema-editor'"
- class="w-full flex-1 relative text-sm"
- >
- <SchemaEditorLite
- ref="schemaEditorRef"
- resource-type="branch"
- :project="project"
- :readonly="true"
- :branch="validationState.branch"
- :show-last-updater="true"
- />
- </div>
- <div
- v-show="tab === 'raw-schema-text'"
- class="w-full flex-1 relative text-sm border rounded overflow-clip"
- >
- <DiffEditor
- :readonly="true"
- :original="validationState.branch.baselineSchema"
- :modified="validationState.branch.schema"
- class="h-full"
- />
- </div>
- </template>
- <template v-else>
- <div class="text-error">
- {{ $t("branch.merge-rebase.resolve-conflicts-to-rebase") }}
- </div>
- <div
- class="w-full flex-1 relative text-sm border rounded overflow-clip bb-resolve-conflict-editor"
- >
- <MonacoEditor
- v-model:content="state.editingSchema"
- :line-highlights="lineHighlightOptions"
- class="h-full"
- />
- </div>
- </template>
- </div>
-</template>
-
-<script setup lang="ts">
-import { NTab, NTabs } from "naive-ui";
-import { computed, reactive, ref, watch } from "vue";
-import type {
- LineHighlightOption,
- LineHighlightOverviewRulerPosition,
-} from "@/components/MonacoEditor";
-import { DiffEditor, MonacoEditor } from "@/components/MonacoEditor";
-import SchemaEditorLite from "@/components/SchemaEditorLite";
-import { useDatabaseV1Store } from "@/store";
-import type { ComposedProject } from "@/types";
-import type { Branch } from "@/types/proto/v1/branch_service";
-import { DatabaseMetadata } from "@/types/proto/v1/database_service";
-import type { RebaseBranchValidationState } from "./types";
-
-type TabValue = "schema-editor" | "raw-schema-text";
-type LocalState = {
- editingSchema: string;
-};
-const ConflictMarkers = [
- {
- pattern: "<<<<<<",
- type: "current",
- color: "rgb(16 185 129)", // bg-emerald-500
- position: "LEFT" as LineHighlightOverviewRulerPosition,
- },
- {
- pattern: "======",
- type: "gutter",
- color: "rgb(107 114 128)", // bg-gray-500
- position: "FULL" as LineHighlightOverviewRulerPosition,
- },
- {
- pattern: ">>>>>>",
- type: "incoming",
- color: "rgb(59 130 246)", // bg-blue-500
- position: "RIGHT" as LineHighlightOverviewRulerPosition,
- },
-];
-
-const props = defineProps<{
- project: ComposedProject;
- validationState: RebaseBranchValidationState;
- baseBranch: Branch;
-}>();
-
-const schemaEditorRef = ref<InstanceType<typeof SchemaEditorLite>>();
-const tab = ref<TabValue>("raw-schema-text");
-const state = reactive<LocalState>({
- editingSchema: "",
-});
-
-const lineHighlightOptions = computed(() => {
- const options: LineHighlightOption[] = [];
- state.editingSchema.split("\n").forEach((line, index) => {
- const marker = ConflictMarkers.find((m) => line.startsWith(m.pattern));
- if (marker) {
- options.push({
- lineNumber: index + 1,
- className: `bb-conflict-line--${marker.type}`,
- overviewRuler: {
- color: marker.color,
- position: marker.position,
- },
- });
- }
- });
- return options;
-});
-
-const validateConflictSchema = () => {
- if (props.validationState.branch) {
- // Auto rebase
- return {
- valid: true,
- schema: undefined,
- };
- }
- if (lineHighlightOptions.value.length === 0) {
- // Conflict resolved
- return {
- valid: true,
- schema: state.editingSchema,
- };
- }
- return {
- valid: false,
- schema: state.editingSchema,
- };
-};
-
-watch(
- [() => props.validationState.branch, schemaEditorRef],
- ([branch, editor]) => {
- if (branch && editor) {
- const db = useDatabaseV1Store().getDatabaseByName(
- branch.baselineDatabase
- );
- editor.rebuildMetadataEdit(
- db,
- branch.baselineSchemaMetadata ?? DatabaseMetadata.fromPartial({}),
- branch.schemaMetadata ?? DatabaseMetadata.fromPartial({})
- );
- }
- }
-);
-watch(
- () => props.validationState.conflictSchema,
- (conflictSchema) => {
- state.editingSchema = conflictSchema ?? "";
- },
- {
- immediate: true,
- }
-);
-
-defineExpose({ validateConflictSchema });
-</script>
-
-<style lang="postcss" scoped>
-.bb-resolve-conflict-editor :deep(.bb-conflict-line--current) {
- @apply bg-emerald-300;
-}
-.bb-resolve-conflict-editor :deep(.bb-conflict-line--gutter) {
- @apply bg-gray-300;
-}
-.bb-resolve-conflict-editor :deep(.bb-conflict-line--incoming) {
- @apply bg-blue-300;
-}
-</style>
diff --git a/frontend/src/components/Branch/BranchRebaseView/RebaseBranchValidationStateView.vue b/frontend/src/components/Branch/BranchRebaseView/RebaseBranchValidationStateView.vue
deleted file mode 100644
index 0357e88c66..0000000000
--- a/frontend/src/components/Branch/BranchRebaseView/RebaseBranchValidationStateView.vue
+++ /dev/null
@@ -1,59 +0,0 @@
-<template>
- <div class="flex flex-row items-center gap-x-1">
- <span v-if="!headBranch || !sourceBranchOrDatabase">
- {{ $t("branch.merge-rebase.select-branches-to-rebase") }}
- </span>
- <template v-else>
- <template v-if="isValidating">
- <BBSpin :size="20" />
- <span>{{ $t("branch.merge-rebase.validating-branch") }}</span>
- </template>
- <template v-else-if="validationState">
- <template v-if="validationState.branch">
- <CheckIcon class="w-4 h-4 text-success" />
- <span>{{ $t("branch.merge-rebase.able-to-rebase") }}</span>
- </template>
- <template v-else>
- <XCircleIcon class="w-4 h-4 text-error" />
- <span class="text-error">
- {{ $t("branch.merge-rebase.cannot-automatically-rebase") }}
- </span>
- </template>
- </template>
- </template>
- </div>
-</template>
-
-<script setup lang="ts">
-import { CheckIcon, XCircleIcon } from "lucide-vue-next";
-import { computed } from "vue";
-import { BBSpin } from "@/bbkit";
-import type { ComposedDatabase, ComposedProject } from "@/types";
-import type { Branch } from "@/types/proto/v1/branch_service";
-import type { RebaseBranchValidationState, RebaseSourceType } from "./types";
-
-const props = defineProps<{
- project: ComposedProject;
- sourceType: RebaseSourceType;
- headBranch: Branch | undefined;
- sourceBranch: Branch | undefined;
- sourceDatabase: ComposedDatabase | undefined;
- isLoadingSourceBranch?: boolean;
- isLoadingHeadBranch?: boolean;
- isValidating?: boolean;
- validationState: RebaseBranchValidationState | undefined;
-}>();
-
-defineEmits<{
- (event: "update:source-type", type: RebaseSourceType): void;
- (event: "update:head-branch-name", branch: string | undefined): void;
- (event: "update:source-branch-name", branch: string | undefined): void;
- (event: "update:source-database-name", name: string | undefined): void;
-}>();
-
-const sourceBranchOrDatabase = computed(() => {
- return props.sourceType === "BRANCH"
- ? props.sourceBranch
- : props.sourceDatabase;
-});
-</script>
diff --git a/frontend/src/components/Branch/BranchRebaseView/ResolveConflict.vue b/frontend/src/components/Branch/BranchRebaseView/ResolveConflict.vue
deleted file mode 100644
index bffdb72919..0000000000
--- a/frontend/src/components/Branch/BranchRebaseView/ResolveConflict.vue
+++ /dev/null
@@ -1,117 +0,0 @@
-<template>
- <div
- class="w-full flex-1 relative text-sm border rounded overflow-clip bb-resolve-conflict-editor"
- >
- <MonacoEditor
- v-model:content="state.editingSchema"
- :line-highlights="lineHighlightOptions"
- class="h-full"
- />
- </div>
-</template>
-
-<script setup lang="ts">
-import { computed, reactive, watch } from "vue";
-import type {
- LineHighlightOption,
- LineHighlightOverviewRulerPosition,
-} from "@/components/MonacoEditor";
-import { MonacoEditor } from "@/components/MonacoEditor";
-import type { ComposedProject } from "@/types";
-import type { RebaseBranchValidationState } from "./types";
-
-type LocalState = {
- editingSchema: string;
-};
-const ConflictMarkers = [
- {
- pattern: "<<<<<<",
- type: "current",
- color: "rgb(16 185 129)", // bg-emerald-500
- position: "LEFT" as LineHighlightOverviewRulerPosition,
- },
- {
- pattern: "======",
- type: "gutter",
- color: "rgb(107 114 128)", // bg-gray-500
- position: "FULL" as LineHighlightOverviewRulerPosition,
- },
- {
- pattern: ">>>>>>",
- type: "incoming",
- color: "rgb(59 130 246)", // bg-blue-500
- position: "RIGHT" as LineHighlightOverviewRulerPosition,
- },
-];
-
-const props = defineProps<{
- project: ComposedProject;
- validationState: RebaseBranchValidationState;
-}>();
-
-const state = reactive<LocalState>({
- editingSchema: "",
-});
-
-const lineHighlightOptions = computed(() => {
- const options: LineHighlightOption[] = [];
- state.editingSchema.split("\n").forEach((line, index) => {
- const marker = ConflictMarkers.find((m) => line.startsWith(m.pattern));
- if (marker) {
- options.push({
- lineNumber: index + 1,
- className: `bb-conflict-line--${marker.type}`,
- overviewRuler: {
- color: marker.color,
- position: marker.position,
- },
- });
- }
- });
- return options;
-});
-
-const validateConflictSchema = () => {
- if (props.validationState.branch) {
- // Auto rebase
- return {
- valid: true,
- schema: undefined,
- };
- }
- if (lineHighlightOptions.value.length === 0) {
- // Conflict resolved
- return {
- valid: true,
- schema: state.editingSchema,
- };
- }
- return {
- valid: false,
- schema: state.editingSchema,
- };
-};
-watch(
- () => props.validationState.conflictSchema,
- (conflictSchema) => {
- state.editingSchema = conflictSchema ?? "";
- },
- {
- immediate: true,
- }
-);
-
-defineExpose({ validateConflictSchema });
-</script>
-
-<style lang="postcss" scoped>
-.bb-resolve-conflict-editor :deep(.bb-conflict-line--current) {
- @apply bg-emerald-300;
-}
-.bb-resolve-conflict-editor :deep(.bb-conflict-line--gutter) {
- @apply bg-gray-300;
-}
-.bb-resolve-conflict-editor :deep(.bb-conflict-line--incoming) {
- @apply bg-blue-300;
-}
-</style>
diff --git a/frontend/src/components/Branch/BranchRebaseView/SelectBranchStep.vue b/frontend/src/components/Branch/BranchRebaseView/SelectBranchStep.vue
deleted file mode 100644
index 1c511821fc..0000000000
--- a/frontend/src/components/Branch/BranchRebaseView/SelectBranchStep.vue
+++ /dev/null
@@ -1,203 +0,0 @@
-<template>
- <div
- class="w-full grid grid-cols-3 items-end text-sm gap-x-2"
- style="grid-template-columns: 1fr auto 1fr"
- >
- <BranchSelector
- class="!full text-center"
- :clearable="false"
- :project="project"
- :branch="headBranch?.name"
- :filter="headBranchFilter"
- @update:branch="$emit('update:head-branch-name', $event)"
- />
- <div class="flex flex-row justify-center px-2 h-[34px]">
- <MoveLeftIcon :size="40" stroke-width="1" />
- </div>
- <div class="flex flex-col">
- <NRadioGroup
- :value="sourceType"
- class="space-x-2"
- @update:value="$emit('update:source-type', $event as RebaseSourceType)"
- >
- <NRadio value="BRANCH">{{ $t("common.branch") }}</NRadio>
- <NRadio value="DATABASE">{{ $t("common.database") }}</NRadio>
- </NRadioGroup>
- <BranchSelector
- v-if="sourceType === 'BRANCH'"
- class="!w-full text-center"
- :clearable="false"
- :project="project"
- :branch="sourceBranch?.name"
- :filter="sourceBranchFilter"
- @update:branch="$emit('update:source-branch-name', $event)"
- />
- <DatabaseSelect
- v-if="sourceType === 'DATABASE'"
- :database-name="sourceDatabase?.name"
- :project-name="project.name"
- :allowed-engine-type-list="headBranch ? [headBranch.engine] : undefined"
- style="width: 100%"
- @update:database-name="$emit('update:source-database-name', $event)"
- />
- </div>
- </div>
- <div class="flex-1 flex flex-col relative text-sm gap-y-1 overflow-hidden">
- <div class="flex flex-row items-center gap-x-1">
- <span v-if="!headBranch || !sourceBranchOrDatabase">
- {{ $t("branch.merge-rebase.select-branches-to-rebase") }}
- </span>
- <template v-else>
- <template v-if="isValidating">
- <BBSpin :size="20" />
- <span>{{ $t("branch.merge-rebase.validating-branch") }}</span>
- </template>
- <template v-else-if="validationState">
- <template v-if="validationState.branch">
- <CheckIcon class="w-4 h-4 text-success" />
- <span>{{ $t("branch.merge-rebase.able-to-rebase") }}</span>
- </template>
- <template v-else>
- <XCircleIcon class="w-4 h-4 text-error" />
- <span>
- {{ $t("branch.merge-rebase.cannot-automatically-rebase") }}
- </span>
- </template>
- </template>
- </template>
- </div>
- <NTabs v-model:value="tab">
- <template v-if="headBranch" #prefix>
- <div class="text-control-placeholder">
- {{
- $t("branch.merge-rebase.changes-of-branch", {
- branch: headBranch.branchId,
- })
- }}
- </div>
- </template>
- <NTab name="schema-editor">
- {{ $t("schema-editor.self") }}
- </NTab>
- <NTab name="raw-schema-text">
- {{ $t("schema-editor.raw-sql") }}
- </NTab>
- </NTabs>
- <div
- v-show="tab === 'schema-editor'"
- class="flex-1 relative text-sm overflow-hidden"
- >
- <SchemaEditorLite
- ref="schemaEditorRef"
- :key="headBranch?.name"
- resource-type="branch"
- :project="project"
- :readonly="true"
- :loading="isLoadingHeadBranch"
- :branch="headBranch ?? Branch.fromPartial({})"
- :show-last-updater="true"
- />
- <MaskSpinner v-if="isLoadingHeadBranch" />
- </div>
- <div
- v-show="tab === 'raw-schema-text'"
- class="w-full flex-1 relative text-sm border rounded overflow-clip"
- >
- <DiffEditor
- :readonly="true"
- :original="headBranch?.baselineSchema"
- :modified="headBranch?.schema"
- class="h-full"
- />
-
- <MaskSpinner v-if="isLoadingHeadBranch || isLoadingSourceBranch" />
- </div>
- </div>
-</template>
-
-<script setup lang="ts">
-import { CheckIcon, XCircleIcon, MoveLeftIcon } from "lucide-vue-next";
-import { NRadio, NRadioGroup, NTab, NTabs } from "naive-ui";
-import { computed, ref, watch } from "vue";
-import { BBSpin } from "@/bbkit";
-import { DiffEditor } from "@/components/MonacoEditor";
-import SchemaEditorLite from "@/components/SchemaEditorLite";
-import MaskSpinner from "@/components/misc/MaskSpinner.vue";
-import { DatabaseSelect } from "@/components/v2";
-import { useDatabaseV1Store } from "@/store";
-import type { ComposedDatabase, ComposedProject } from "@/types";
-import { Branch } from "@/types/proto/v1/branch_service";
-import { DatabaseMetadata } from "@/types/proto/v1/database_service";
-import BranchSelector from "../BranchSelector.vue";
-import type { RebaseBranchValidationState, RebaseSourceType } from "./types";
-
-type TabValue = "schema-editor" | "raw-schema-text";
-
-const props = defineProps<{
- project: ComposedProject;
- sourceType: RebaseSourceType;
- headBranch: Branch | undefined;
- sourceBranch: Branch | undefined;
- sourceDatabase: ComposedDatabase | undefined;
- isLoadingSourceBranch?: boolean;
- isLoadingHeadBranch?: boolean;
- isValidating?: boolean;
- validationState: RebaseBranchValidationState | undefined;
-}>();
-
-defineEmits<{
- (event: "update:source-type", type: RebaseSourceType): void;
- (event: "update:head-branch-name", branch: string | undefined): void;
- (event: "update:source-branch-name", branch: string | undefined): void;
- (event: "update:source-database-name", name: string | undefined): void;
-}>();
-
-const schemaEditorRef = ref<InstanceType<typeof SchemaEditorLite>>();
-const tab = ref<TabValue>("schema-editor");
-const sourceBranchOrDatabase = computed(() => {
- return props.sourceType === "BRANCH"
- ? props.sourceBranch
- : props.sourceDatabase;
-});
-
-const sourceBranchFilter = (branch: Branch) => {
- const { headBranch } = props;
- if (!headBranch) {
- return true;
- }
- return branch.engine === headBranch.engine && branch.name !== headBranch.name;
-};
-const headBranchFilter = (branch: Branch) => {
- const source = sourceBranchOrDatabase.value;
- if (!source) {
- return true;
- }
- if (props.sourceType === "BRANCH") {
- const sourceBranch = source as Branch;
- return (
- branch.engine === sourceBranch.engine && branch.name !== sourceBranch.name
- );
- } else {
- const sourceDatabase = source as ComposedDatabase;
- return branch.engine === sourceDatabase.instanceResource.engine;
- }
-};
-
-// re-calculate diff for coloring when branch changed
-watch(
- [() => props.headBranch, schemaEditorRef],
- ([head, editor]) => {
- if (head && editor) {
- const db = useDatabaseV1Store().getDatabaseByName(head.baselineDatabase);
- editor.rebuildMetadataEdit(
- db,
- head.baselineSchemaMetadata ?? DatabaseMetadata.fromPartial({}),
- head.schemaMetadata ?? DatabaseMetadata.fromPartial({})
- );
- }
- },
- {
- immediate: true,
- }
-);
-</script>
diff --git a/frontend/src/components/Branch/BranchRebaseView/index.ts b/frontend/src/components/Branch/BranchRebaseView/index.ts
deleted file mode 100644
index 6e5af6abe8..0000000000
--- a/frontend/src/components/Branch/BranchRebaseView/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import BranchRebaseView from "./BranchRebaseView.vue";
-
-export default BranchRebaseView;
diff --git a/frontend/src/components/Branch/BranchRebaseView/types.ts b/frontend/src/components/Branch/BranchRebaseView/types.ts
deleted file mode 100644
index b4eb8557b7..0000000000
--- a/frontend/src/components/Branch/BranchRebaseView/types.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import type { Branch } from "@/types/proto/v1/branch_service";
-
-export type RebaseSourceType = "BRANCH" | "DATABASE";
-
-export type RebaseBranchValidationState = {
- branch?: Branch;
- conflictSchema?: string;
-};
diff --git a/frontend/src/components/Branch/BranchRolloutView/BranchRolloutView.vue b/frontend/src/components/Branch/BranchRolloutView/BranchRolloutView.vue
deleted file mode 100644
index a0e4817421..0000000000
--- a/frontend/src/components/Branch/BranchRolloutView/BranchRolloutView.vue
+++ /dev/null
@@ -1,446 +0,0 @@
-<template>
- <div
- class="flex flex-col gap-y-2 w-full h-full overflow-x-auto relative p-1"
- v-bind="$attrs"
- >
- <div class="flex flex-row justify-between">
- <div class="flex flex-row items-center gap-x-4">
- <div class="textlabel">
- {{ $t("branch.rollout.select-target-database") }}
- </div>
- <div class="flex flex-row items-center gap-x-2">
- <div class="textlabel">{{ $t("common.environment") }}</div>
- <EnvironmentSelect
- :environment-name="environment?.name"
- style="width: 8rem"
- @update:environment-name="handleSelectEnvironment"
- />
- </div>
- <div class="flex flex-row items-center gap-x-2">
- <div class="textlabel">{{ $t("common.database") }}</div>
- <DatabaseSelect
- :database-name="database?.name"
- :project-name="project.name"
- :environment-name="environment?.name"
- :filter="filterDatabase"
- :loading="isPreparingDatabaseGroups"
- style="width: 16rem"
- @update:database-name="handleSelectDatabase"
- />
- </div>
- </div>
-
- <div class="flex flex-row items-end justify-end">
- <NButton
- type="primary"
- :disabled="!allowPreviewIssue"
- @click="handlePreviewIssue"
- >
- {{ $t("issue.preview") }}
- </NButton>
- </div>
- </div>
- <div class="flex items-center flex-start border-b">
- <button
- class="-mb-px px-3 leading-9 rounded-t-md flex items-center text-sm text-gray-500 border border-b-0 border-transparent cursor-pointer select-none outline-none"
- :class="
- state.selectedTab === 'schema-editor' &&
- 'bg-white !border-gray-300 text-gray-800'
- "
- @click="handleChangeTab('schema-editor')"
- >
- {{ $t("schema-editor.self") }}
- </button>
- <button
- class="-mb-px px-3 leading-9 rounded-t-md text-sm text-gray-500 border border-b-0 border-transparent cursor-pointer select-none outline-none"
- :class="
- state.selectedTab === 'raw-sql-preview' &&
- 'bg-white !border-gray-300 text-gray-800'
- "
- @click="handleChangeTab('raw-sql-preview')"
- >
- {{ $t("schema-designer.raw-sql-preview") }}
- </button>
- </div>
-
- <div
- v-show="state.selectedTab === 'schema-editor'"
- class="flex-1 overflow-hidden relative"
- >
- <SchemaEditorLite
- v-show="database"
- ref="schemaEditorRef"
- v-model:selected-rollout-objects="selectedRolloutObjects"
- :project="project"
- :readonly="true"
- :resource-type="'branch'"
- :branch="virtualBranch"
- :loading="isLoadingVirtualBranch"
- :show-last-updater="true"
- />
-
- <!-- used as a placeholder -->
- <SchemaEditorLite
- v-show="!database"
- :project="project"
- :readonly="true"
- :resource-type="'branch'"
- :branch="emptyBranch"
- />
- <div
- v-show="!database"
- class="absolute inset-0 bg-white/75 text-sm flex flex-col items-center justify-center"
- >
- {{ $t("branch.rollout.select-target-database") }}
- </div>
- </div>
-
- <div
- v-show="state.selectedTab === 'raw-sql-preview'"
- class="w-full h-full overflow-y-auto relative"
- >
- <MaskSpinner v-if="rawSQLPreviewState.isFetching">
- <div class="text-sm">Generating diff DDL</div>
- </MaskSpinner>
- <MonacoEditor
- class="w-full h-full border rounded-lg overflow-auto"
- data-label="bb-schema-editor-sql-editor"
- :content="rawSQLPreviewState.value"
- :readonly="true"
- :auto-focus="false"
- :placeholder="rawSQLPreviewPlaceholder"
- />
- </div>
-
- <MaskSpinner
- v-if="virtualBranchReady && isGeneratingDDL"
- class="!bg-white/75"
- >
- <div class="text-sm">Generating DDL</div>
- </MaskSpinner>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { cloneDeep } from "lodash-es";
-import { NButton, useDialog } from "naive-ui";
-import { computed, reactive, ref, toRef, watch } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
-import { MonacoEditor } from "@/components/MonacoEditor";
-import type { RolloutObject } from "@/components/SchemaEditorLite";
-import SchemaEditorLite, {
- generateDiffDDL,
-} from "@/components/SchemaEditorLite";
-import MaskSpinner from "@/components/misc/MaskSpinner.vue";
-import { DatabaseSelect, EnvironmentSelect } from "@/components/v2";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
-import {
- pushNotification,
- useDatabaseInGroupFilter,
- useDatabaseV1Store,
- useEnvironmentV1Store,
- useSheetV1Store,
-} from "@/store";
-import type { ComposedDatabase, ComposedProject } from "@/types";
-import { isValidDatabaseName, isValidEnvironmentName } from "@/types";
-import { Branch } from "@/types/proto/v1/branch_service";
-import { DatabaseMetadata } from "@/types/proto/v1/database_service";
-import type { Environment } from "@/types/proto/v1/environment_service";
-import { Sheet, SheetPayload_Type } from "@/types/proto/v1/sheet_service";
-import {
- defer,
- extractProjectResourceName,
- extractSheetUID,
- generateIssueTitle,
- setSheetStatement,
-} from "@/utils";
-import { useVirtualBranch } from "./useVirtualBranch";
-
-type TabType = "schema-editor" | "raw-sql-preview";
-
-interface LocalState {
- selectedTab: TabType;
-}
-
-const props = defineProps<{
- project: ComposedProject;
- branch: Branch;
-}>();
-
-const { t } = useI18n();
-const state = reactive<LocalState>({
- selectedTab: "schema-editor",
-});
-const rawSQLPreviewState = reactive({
- value: "",
- isFetching: false,
-});
-const rawSQLPreviewPlaceholder = computed(() => {
- if (rawSQLPreviewState.isFetching) return undefined;
- return t("schema-editor.generated-ddl-is-empty");
-});
-
-const router = useRouter();
-const schemaEditorRef = ref<InstanceType<typeof SchemaEditorLite>>();
-const environment = ref<Environment>();
-const database = ref<ComposedDatabase>();
-const {
- isLoading: isLoadingVirtualBranch,
- ready: virtualBranchReady,
- branch: virtualBranch,
-} = useVirtualBranch(toRef(props, "project"), toRef(props, "branch"), database);
-const referencedDatabase = computed(() => {
- const name = props.branch.baselineDatabase;
- if (!name) return undefined;
- return useDatabaseV1Store().getDatabaseByName(name);
-});
-const { isPreparingDatabaseGroups, databaseFilter: filterDatabaseByGroup } =
- useDatabaseInGroupFilter(toRef(props, "project"), referencedDatabase);
-const selectedRolloutObjects = ref<RolloutObject[]>([]);
-const emptyBranch = Branch.fromJSON({});
-const isGeneratingDDL = ref(false);
-const $dialog = useDialog();
-
-const handleSelectEnvironment = (name: string | undefined) => {
- if (!isValidEnvironmentName(name)) {
- environment.value = undefined;
- handleSelectDatabase(undefined);
- return;
- }
- environment.value = useEnvironmentV1Store().getEnvironmentByName(name);
- if (database.value) {
- if (database.value.effectiveEnvironment !== name) {
- // de-select database since environment changed
- handleSelectDatabase(undefined);
- }
- }
-};
-const handleSelectDatabase = (name: string | undefined) => {
- if (!isValidDatabaseName(name)) {
- database.value = undefined;
- return;
- }
- database.value = useDatabaseV1Store().getDatabaseByName(name);
- if (!environment.value) {
- // Auto select environment if it's not selected
- environment.value = database.value.effectiveEnvironmentEntity;
- }
-};
-const filterDatabase = (db: ComposedDatabase) => {
- return (
- db.instanceResource.engine === props.branch.engine &&
- filterDatabaseByGroup(db)
- );
-};
-
-const allowPreviewIssue = computed(() => {
- if (!database.value) return false;
- if (!virtualBranchReady.value) return false;
- return selectedRolloutObjects.value.length > 0;
-});
-
-const handleChangeTab = async (tab: TabType) => {
- if (state.selectedTab === tab) return;
- state.selectedTab = tab;
-
- if (tab === "raw-sql-preview") {
- await fetchRawSQLPreview();
- }
-};
-
-const fetchRawSQLPreview = async () => {
- const cleanup = (errors: string[]) => {
- if (errors.length > 0) {
- rawSQLPreviewState.value = "";
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: t("common.error"),
- description: errors.join("\n"),
- });
- }
- rawSQLPreviewState.isFetching = false;
- };
-
- if (rawSQLPreviewState.isFetching) {
- return;
- }
- const vb = virtualBranch.value;
- if (!vb) {
- return;
- }
- rawSQLPreviewState.isFetching = true;
-
- const source = cloneDeep(vb.baselineSchemaMetadata);
- const target = cloneDeep(vb.schemaMetadata);
- const db = database.value;
- const editor = schemaEditorRef.value;
- if (!source) return;
- if (!target) return;
- if (!db) return;
- if (!editor) return;
- editor.applySelectedMetadataEdit(
- db,
- source,
- target,
- selectedRolloutObjects.value
- );
-
- const { statement, errors } = await generateDiffDDL(
- db,
- source,
- target,
- /* !allowEmptyDiffDDLWithConfigChange */ false
- );
- if (errors.length > 0) {
- return cleanup(errors);
- }
-
- rawSQLPreviewState.value = statement;
- rawSQLPreviewState.isFetching = false;
-};
-
-const handlePreviewIssue = async () => {
- const cleanup = (errors: string[]) => {
- if (errors.length > 0) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: t("common.error"),
- description: errors.join("\n"),
- });
- }
- isGeneratingDDL.value = false;
- };
-
- const vb = virtualBranch.value;
- if (!vb) {
- return;
- }
- const source = cloneDeep(vb.baselineSchemaMetadata);
- const target = cloneDeep(vb.schemaMetadata);
- const db = database.value;
- const editor = schemaEditorRef.value;
- if (!source) return;
- if (!target) return;
- if (!db) return;
- if (!editor) return;
-
- editor.applySelectedMetadataEdit(
- db,
- source,
- target,
- selectedRolloutObjects.value
- );
-
- isGeneratingDDL.value = true;
- const { statement, errors } = await generateDiffDDL(
- db,
- source,
- target,
- /* !allowEmptyDiffDDLWithConfigChange */ false
- );
- if (errors.length > 0) {
- return cleanup(errors);
- }
- if (statement === "") {
- if (!(await confirmCreateIssueWithEmptyStatement())) {
- return cleanup([]);
- }
- }
- const sheet = Sheet.fromPartial({
- engine: db.instanceResource.engine,
- payload: {
- type: SheetPayload_Type.SCHEMA_DESIGN,
- baselineDatabaseConfig: {
- schemaConfigs: source.schemaConfigs,
- },
- databaseConfig: {
- schemaConfigs: target.schemaConfigs,
- },
- },
- });
- setSheetStatement(sheet, statement);
- const createdSheet = await useSheetV1Store().createSheet(
- props.project.name,
- sheet
- );
- const query: Record<string, any> = {
- template: "bb.issue.database.schema.update",
- databaseList: db.name,
- sheetId: extractSheetUID(createdSheet.name),
- name: generateIssueTitle("bb.issue.database.schema.update", [
- db.databaseName,
- ]),
- description: generateIssueDescription(db.databaseName),
- };
- const routeInfo = {
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(props.project.name),
- issueSlug: "create",
- },
- query,
- };
- router.push(routeInfo);
-};
-
-const generateIssueDescription = (databaseName: string) => {
- const parts: string[] = [];
- parts.push(`Apply branch`);
- parts.push(`"${props.branch.branchId}"`);
- parts.push("to database");
- parts.push(`[${databaseName}]`);
- return parts.join(" ");
-};
-
-const confirmCreateIssueWithEmptyStatement = () => {
- const d = defer<boolean>();
- $dialog.warning({
- title: t("common.warning"),
- content: t("schema-editor.generated-ddl-is-empty"),
- style: "z-index: 100000",
- negativeText: t("common.cancel"),
- positiveText: t("common.continue-anyway"),
- onNegativeClick: () => {
- d.resolve(false);
- },
- onPositiveClick: () => {
- d.resolve(true);
- },
- });
- return d.promise;
-};
-
-watch(
- () => props.branch,
- () => {
- // Auto select the branch's baseline database as the target database by default
- const db = useDatabaseV1Store().getDatabaseByName(
- props.branch.baselineDatabase
- );
- handleSelectDatabase(db.name);
- },
- { immediate: true }
-);
-watch(
- () => virtualBranch.value,
- (vb) => {
- if (!vb) return;
- if ((vb as any).__rebuildMetadataEditFinished) {
- console.warn("unexpected: should never reach this line");
- return;
- }
- (vb as any).__rebuildMetadataEditFinished = true;
-
- selectedRolloutObjects.value = [];
- const db = useDatabaseV1Store().getDatabaseByName(vb.baselineDatabase);
- schemaEditorRef.value?.rebuildMetadataEdit(
- db,
- vb.baselineSchemaMetadata ?? DatabaseMetadata.fromPartial({}),
- vb.schemaMetadata ?? DatabaseMetadata.fromPartial({})
- );
- }
-);
-</script>
diff --git a/frontend/src/components/Branch/BranchRolloutView/index.ts b/frontend/src/components/Branch/BranchRolloutView/index.ts
deleted file mode 100644
index ef3c4466d4..0000000000
--- a/frontend/src/components/Branch/BranchRolloutView/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import BranchRolloutView from "./BranchRolloutView.vue";
-
-export default BranchRolloutView;
diff --git a/frontend/src/components/Branch/BranchRolloutView/useVirtualBranch.ts b/frontend/src/components/Branch/BranchRolloutView/useVirtualBranch.ts
deleted file mode 100644
index cf6b02726c..0000000000
--- a/frontend/src/components/Branch/BranchRolloutView/useVirtualBranch.ts
+++ /dev/null
@@ -1,82 +0,0 @@
-import { cloneDeep, uniqueId } from "lodash-es";
-import { computed, reactive, ref, unref, watchEffect } from "vue";
-import { useDBSchemaV1Store } from "@/store";
-import type { ComposedDatabase, ComposedProject, MaybeRef } from "@/types";
-import { Branch } from "@/types/proto/v1/branch_service";
-import type { DatabaseMetadata } from "@/types/proto/v1/database_service";
-import { DatabaseMetadataView } from "@/types/proto/v1/database_service";
-import { filterDatabaseMetadata } from "@/utils";
-
-/**
- * Create a "virtual" branch to show the diff between a branch's head and a database's head
- * @param database
- * @param branch
- */
-export const useVirtualBranch = (
- project: MaybeRef<ComposedProject>,
- branch: MaybeRef<Branch>,
- database: MaybeRef<ComposedDatabase | undefined>
-) => {
- const state = reactive({
- isLoadingDatabaseMetadata: false,
- });
- const databaseHeadMetadata = ref<DatabaseMetadata>();
-
- const fetchDatabaseHeadMetadata = async (
- db: ComposedDatabase | undefined,
- signal: AbortController["signal"]
- ) => {
- if (!db) {
- databaseHeadMetadata.value = undefined;
- state.isLoadingDatabaseMetadata = false;
- return;
- }
-
- state.isLoadingDatabaseMetadata = true;
- const metadata = await useDBSchemaV1Store().getOrFetchDatabaseMetadata({
- database: db.name,
- view: DatabaseMetadataView.DATABASE_METADATA_VIEW_FULL,
- skipCache: true, // ensure using the latest
- });
- if (signal.aborted) return;
- databaseHeadMetadata.value = filterDatabaseMetadata(metadata);
- state.isLoadingDatabaseMetadata = false;
- };
-
- watchEffect((onCancel) => {
- const controller = new AbortController();
- fetchDatabaseHeadMetadata(unref(database), controller.signal);
- onCancel(() => controller.abort());
- });
-
- const virtualBranch = computed(() => {
- const db = unref(database);
- if (!db) {
- return undefined;
- }
- if (state.isLoadingDatabaseMetadata) {
- return undefined;
- }
- return Branch.fromPartial({
- name: `${unref(project).name}/branches/-${uniqueId()}`,
- engine: db.instanceResource.engine,
- baselineDatabase: db.name,
- schemaMetadata: cloneDeep(unref(branch).schemaMetadata),
- baselineSchemaMetadata: cloneDeep(databaseHeadMetadata.value),
- });
- });
-
- const isLoading = computed(() => {
- return state.isLoadingDatabaseMetadata;
- });
-
- const ready = computed(() => {
- return !state.isLoadingDatabaseMetadata;
- });
-
- return {
- isLoading,
- ready,
- branch: virtualBranch,
- };
-};
diff --git a/frontend/src/components/Branch/BranchSQLCheckButton.vue b/frontend/src/components/Branch/BranchSQLCheckButton.vue
deleted file mode 100644
index 8e5c06d226..0000000000
--- a/frontend/src/components/Branch/BranchSQLCheckButton.vue
+++ /dev/null
@@ -1,33 +0,0 @@
-<template>
- <SQLCheckButton
- v-if="database"
- :database="database"
- :database-metadata="databaseMetadata"
- :get-statement="getStatement"
- :button-style="{
- height: '28px',
- }"
- :advice-filter="(advice) => advice.title !== 'advice.online-migration'"
- class="justify-end"
- />
-</template>
-
-<script lang="ts" setup>
-import { computed } from "vue";
-import { SQLCheckButton } from "@/components/SQLCheck";
-import { useDatabaseV1Store } from "@/store";
-import type { Branch } from "@/types/proto/v1/branch_service";
-
-const props = defineProps<{
- branch: Branch;
- getStatement: () => Promise<{ statement: string; errors: string[] }>;
-}>();
-
-const database = computed(() => {
- return useDatabaseV1Store().getDatabaseByName(props.branch.baselineDatabase);
-});
-
-const databaseMetadata = computed(() => {
- return props.branch.baselineSchemaMetadata;
-});
-</script>
diff --git a/frontend/src/components/Branch/BranchSelector.vue b/frontend/src/components/Branch/BranchSelector.vue
deleted file mode 100644
index 698ebc838d..0000000000
--- a/frontend/src/components/Branch/BranchSelector.vue
+++ /dev/null
@@ -1,103 +0,0 @@
-<template>
- <NSelect
- v-bind="$attrs"
- :value="branch || null"
- :options="options"
- :placeholder="$t('database.select-branch')"
- :filterable="true"
- :clearable="clearable"
- :filter="filterByName"
- :loading="!ready"
- :disabled="disabled || loading"
- class="bb-branch-select"
- :render-label="renderLabel"
- @update:value="$emit('update:branch', $event)"
- />
-</template>
-
-<script lang="ts" setup>
-import type { SelectOption, SelectRenderLabel } from "naive-ui";
-import { NSelect } from "naive-ui";
-import { computed, h } from "vue";
-import { useDatabaseV1Store, useBranchListByProject } from "@/store";
-import type { ComposedProject } from "@/types";
-import { isValidDatabaseName } from "@/types";
-import type { Branch } from "@/types/proto/v1/branch_service";
-import { InstanceV1EngineIcon } from "../v2";
-
-interface BranchSelectOption extends SelectOption {
- value: string;
- branch: Branch;
-}
-
-const props = defineProps<{
- project: ComposedProject;
- branch?: string | null;
- clearable?: boolean;
- loading?: boolean;
- disabled?: boolean;
- filter?: (branch: Branch, index: number) => boolean;
-}>();
-
-defineEmits<{
- (event: "update:branch", name: string | undefined): void;
-}>();
-
-const { branchList, ready } = useBranchListByProject(
- computed(() => props.project.name)
-);
-const databaseStore = useDatabaseV1Store();
-
-const combinedBranchList = computed(() => {
- let list = branchList.value;
- if (props.filter) {
- list = list.filter(props.filter);
- }
- return list;
-});
-
-const options = computed(() => {
- return combinedBranchList.value.map<BranchSelectOption>((branch) => {
- return {
- branch,
- value: branch.name,
- label: branch.branchId,
- };
- });
-});
-
-const filterByName = (pattern: string, option: SelectOption) => {
- const { branch } = option as BranchSelectOption;
- pattern = pattern.toLowerCase();
- return (
- branch.name.toLowerCase().includes(pattern) ||
- branch.branchId.toLowerCase().includes(pattern)
- );
-};
-
-const renderLabel: SelectRenderLabel = (option) => {
- const { branch } = option as BranchSelectOption;
- if (!branch) {
- return;
- }
-
- const children = [h("div", {}, [branch.branchId])];
- const database = databaseStore.getDatabaseByName(branch.baselineDatabase);
- if (isValidDatabaseName(database.name)) {
- // prefix engine icon
- children.unshift(
- h(InstanceV1EngineIcon, {
- class: "mr-1",
- instance: database.instanceResource,
- })
- );
- }
- return h(
- "div",
- {
- class: "w-full flex flex-row justify-start items-center truncate",
- },
- children
- );
-};
-</script>
diff --git a/frontend/src/components/Branch/SchemaDesignEditorLite.vue b/frontend/src/components/Branch/SchemaDesignEditorLite.vue
deleted file mode 100644
index ccc3eafc25..0000000000
--- a/frontend/src/components/Branch/SchemaDesignEditorLite.vue
+++ /dev/null
@@ -1,183 +0,0 @@
-<template>
- <div class="w-full h-full flex flex-col justify-start items-start">
- <div
- class="w-full flex flex-row justify-between items-center border-b pl-1 border-b-gray-300"
- >
- <div class="flex items-center flex-start">
- <button
- class="-mb-px px-3 leading-9 rounded-t-md flex items-center text-sm text-gray-500 border border-b-0 border-transparent cursor-pointer select-none outline-none"
- :class="
- state.selectedTab === 'schema-editor' &&
- 'bg-white !border-gray-300 text-gray-800'
- "
- @click="handleChangeTab('schema-editor')"
- >
- {{ $t("schema-editor.self") }}
- </button>
- <button
- class="-mb-px px-3 leading-9 rounded-t-md text-sm text-gray-500 border border-b-0 border-transparent cursor-pointer select-none outline-none"
- :class="
- state.selectedTab === 'raw-sql-preview' &&
- 'bg-white !border-gray-300 text-gray-800'
- "
- @click="handleChangeTab('raw-sql-preview')"
- >
- {{ $t("schema-designer.raw-sql-preview") }}
- </button>
- </div>
- <div v-if="!hideSQLCheckButton" class="flex items-center flex-end">
- <BranchSQLCheckButton
- class="justify-end"
- :branch="branch"
- :get-statement="() => generateDDL(false)"
- />
- </div>
- </div>
- <div class="grow w-full h-auto overflow-auto">
- <div
- v-show="state.selectedTab === 'schema-editor'"
- class="w-full h-full pt-2"
- >
- <SchemaEditorLite
- ref="schemaEditorRef"
- :project="project"
- :readonly="readonly"
- :resource-type="'branch'"
- :branch="branch"
- :diff-when-ready="true"
- :show-last-updater="true"
- :disable-diff-coloring="disableDiffColoring"
- :hide-preview="hidePreview"
- @update-is-editing="$emit('update-is-editing', $event)"
- />
- </div>
- <div
- v-if="state.selectedTab === 'raw-sql-preview'"
- class="w-full h-full pt-2 overflow-y-auto relative"
- >
- <MaskSpinner v-if="rawSQLPreviewState.isFetching">
- <div class="text-sm">Generating diff DDL</div>
- </MaskSpinner>
- <MonacoEditor
- class="w-full h-full border rounded-lg overflow-auto"
- data-label="bb-schema-editor-sql-editor"
- :content="rawSQLPreviewState.value"
- :readonly="true"
- :auto-focus="false"
- :placeholder="rawSQLPreviewPlaceholder"
- />
- </div>
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { cloneDeep } from "lodash-es";
-import { computed, reactive, ref } from "vue";
-import { useI18n } from "vue-i18n";
-import { pushNotification, useDatabaseV1Store } from "@/store";
-import type { ComposedProject } from "@/types";
-import type { Branch } from "@/types/proto/v1/branch_service";
-import { DatabaseMetadata } from "@/types/proto/v1/database_service";
-import { MonacoEditor } from "../MonacoEditor";
-import SchemaEditorLite, { generateDiffDDL } from "../SchemaEditorLite";
-import MaskSpinner from "../misc/MaskSpinner.vue";
-import BranchSQLCheckButton from "./BranchSQLCheckButton.vue";
-
-type TabType = "schema-editor" | "raw-sql-preview";
-
-interface LocalState {
- selectedTab: TabType;
-}
-
-const props = defineProps<{
- project: ComposedProject;
- branch: Branch;
- readonly?: boolean;
- hideSQLCheckButton?: boolean;
- disableDiffColoring?: boolean;
- hidePreview?: boolean;
-}>();
-
-const { t } = useI18n();
-const state = reactive<LocalState>({
- selectedTab: "schema-editor",
-});
-const rawSQLPreviewState = reactive({
- value: "",
- isFetching: false,
-});
-const rawSQLPreviewPlaceholder = computed(() => {
- if (rawSQLPreviewState.isFetching) return undefined;
- return t("schema-editor.generated-ddl-is-empty");
-});
-const database = computed(() => {
- return useDatabaseV1Store().getDatabaseByName(props.branch.baselineDatabase);
-});
-const schemaEditorRef = ref<InstanceType<typeof SchemaEditorLite>>();
-
-const handleChangeTab = async (tab: TabType) => {
- state.selectedTab = tab;
- if (tab === "raw-sql-preview") {
- await fetchRawSQLPreview();
- }
-};
-
-const generateDDL = async (silent: boolean) => {
- const applyMetadataEdit = schemaEditorRef.value?.applyMetadataEdit;
- if (typeof applyMetadataEdit !== "function") {
- throw new Error("SchemaEditor is not accessible");
- }
-
- const source =
- props.branch.baselineSchemaMetadata ?? DatabaseMetadata.fromPartial({});
- // We will not really apply the edits here, so we need to clone the edited copy
- const editing = props.branch.schemaMetadata
- ? cloneDeep(props.branch.schemaMetadata)
- : DatabaseMetadata.fromPartial({});
- applyMetadataEdit(database.value, editing);
-
- const result = await generateDiffDDL(database.value, source, editing);
- if (result.errors.length > 0 && !silent) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: t("common.error"),
- description: result.errors.join("\n"),
- });
- }
- return result;
-};
-
-const fetchRawSQLPreview = async () => {
- if (rawSQLPreviewState.isFetching) {
- return;
- }
-
- rawSQLPreviewState.isFetching = true;
-
- const applyMetadataEdit = schemaEditorRef.value?.applyMetadataEdit;
- if (typeof applyMetadataEdit !== "function") {
- rawSQLPreviewState.isFetching = false;
- return;
- }
-
- const result = await generateDDL(true);
- if (result.errors.length > 0) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: t("common.error"),
- description: result.errors.join("\n"),
- });
- }
- rawSQLPreviewState.value = result.statement;
- rawSQLPreviewState.isFetching = false;
-};
-
-defineExpose({
- schemaEditor: schemaEditorRef,
-});
-
-defineEmits(["update-is-editing"]);
-</script>
diff --git a/frontend/src/components/Branch/common/BranchComparison.vue b/frontend/src/components/Branch/common/BranchComparison.vue
deleted file mode 100644
index bb4c6d973f..0000000000
--- a/frontend/src/components/Branch/common/BranchComparison.vue
+++ /dev/null
@@ -1,137 +0,0 @@
-<template>
- <div class="h-full flex flex-col gap-y-1 relative">
- <NTabs v-model:value="tab">
- <template #prefix>
- <slot name="tab-prefix" />
- </template>
- <NTab name="schema-text">
- {{ $t("branch.schema-text") }}
- </NTab>
- <NTab name="visualized-schema">
- {{ $t("branch.visualized-schema") }}
- </NTab>
-
- <template #suffix>
- <slot name="tab-suffix" />
- </template>
- </NTabs>
- <div v-show="tab === 'schema-text'" class="flex-1 flex flex-col text-sm">
- <div class="flex items-center justify-between text-control-placeholder">
- <div class="flex-1">
- <slot name="baseline-title">
- {{ $t("branch.baseline") }}
- </slot>
- </div>
- <div class="flex-1">
- <slot name="head-title">
- {{ $t("branch.head") }}
- </slot>
- </div>
- </div>
- <div class="flex-1 w-full relative text-sm border rounded overflow-clip">
- <DiffEditor
- :readonly="true"
- :original="ready ? (virtualBranch?.baselineSchema ?? '') : ''"
- :modified="ready ? (virtualBranch?.schema ?? '') : ''"
- class="h-full"
- />
- </div>
- </div>
- <div
- v-show="tab === 'visualized-schema'"
- class="flex-1 relative text-sm overflow-y-hidden"
- >
- <SchemaEditorLite
- ref="schemaEditorRef"
- :key="virtualBranch?.name"
- resource-type="branch"
- :project="project"
- :readonly="true"
- :branch="virtualBranch ?? Branch.fromPartial({})"
- :loading="combinedLoading"
- :show-last-updater="true"
- />
- </div>
- <MaskSpinner v-if="combinedLoading" />
- </div>
-</template>
-
-<script lang="ts" setup>
-import { computedAsync } from "@vueuse/core";
-import { cloneDeep } from "lodash-es";
-import { NTab, NTabs } from "naive-ui";
-import { v1 as uuidv1 } from "uuid";
-import { computed, ref, watch } from "vue";
-import { DiffEditor } from "@/components/MonacoEditor";
-import SchemaEditorLite from "@/components/SchemaEditorLite";
-import MaskSpinner from "@/components/misc/MaskSpinner.vue";
-import { useDatabaseV1Store } from "@/store";
-import type { ComposedProject } from "@/types";
-import { Branch } from "@/types/proto/v1/branch_service";
-import { DatabaseMetadata } from "@/types/proto/v1/database_service";
-import { nextAnimationFrame } from "@/utils";
-
-type TabValue = "schema-text" | "visualized-schema";
-
-const props = defineProps<{
- project: ComposedProject;
- base: Branch | undefined;
- head: Branch | undefined;
- isBaseLoading?: boolean;
- isHeadLoading?: boolean;
-}>();
-
-const tab = ref<TabValue>("schema-text");
-const schemaEditorRef = ref<InstanceType<typeof SchemaEditorLite>>();
-const combinedLoading = computed(() => {
- return props.isBaseLoading || props.isHeadLoading;
-});
-const ready = computedAsync(async () => {
- const loading = combinedLoading.value;
- if (loading) return false;
- await nextAnimationFrame();
- return true;
-}, false);
-
-const emptyBranch = () => {
- return Branch.fromPartial({});
-};
-
-const virtualBranch = computed(() => {
- if (combinedLoading.value) {
- return emptyBranch();
- }
- const { project, base, head } = props;
- if (!base || !head) {
- return emptyBranch();
- }
- return Branch.fromPartial({
- name: `${project.name}/branches/${uuidv1()}`,
- baselineDatabase: base.baselineDatabase,
- baselineSchema: base.schema,
- baselineSchemaMetadata: cloneDeep(base.schemaMetadata),
- schema: head.schema,
- schemaMetadata: cloneDeep(head.schemaMetadata),
- });
-});
-
-// re-calculate diff for coloring when branch changed
-watch(
- [virtualBranch, schemaEditorRef],
- ([branch, editor]) => {
- if (branch && editor) {
- const db = useDatabaseV1Store().getDatabaseByName(
- branch.baselineDatabase
- );
- editor.rebuildMetadataEdit(
- db,
- branch.baselineSchemaMetadata ?? DatabaseMetadata.fromPartial({}),
- branch.schemaMetadata ?? DatabaseMetadata.fromPartial({})
- );
- }
- },
- {
- immediate: true,
- }
-);
-</script>
diff --git a/frontend/src/components/Branch/common/BranchDetailViewer.vue b/frontend/src/components/Branch/common/BranchDetailViewer.vue
deleted file mode 100644
index d0e5966e1c..0000000000
--- a/frontend/src/components/Branch/common/BranchDetailViewer.vue
+++ /dev/null
@@ -1,63 +0,0 @@
-<template>
- <div class="h-full flex flex-col gap-y-1 relative">
- <NTabs v-model:value="tab">
- <template v-if="branch" #prefix>
- <span class="text-control-placeholder text-sm">
- {{ branch.branchId }}
- </span>
- </template>
- <NTab name="visualized-schema">
- {{ $t("branch.visualized-schema") }}
- </NTab>
- <NTab name="schema-text">
- {{ $t("branch.schema-text") }}
- </NTab>
- </NTabs>
- <div
- v-show="tab === 'visualized-schema'"
- class="flex-1 relative text-sm overflow-y-hidden"
- >
- <SchemaEditorLite
- ref="schemaEditorRef"
- :key="branch?.name"
- resource-type="branch"
- :project="project"
- :readonly="true"
- :branch="branch ?? Branch.fromPartial({})"
- :loading="loading"
- :show-last-updater="true"
- />
- </div>
- <div
- v-show="tab === 'schema-text'"
- class="w-full flex-1 relative text-sm border rounded overflow-clip"
- >
- <MonacoEditor
- :readonly="true"
- :content="branch?.schema ?? ''"
- class="h-full"
- />
- </div>
- <MaskSpinner v-if="loading" />
- </div>
-</template>
-
-<script lang="ts" setup>
-import { NTab, NTabs } from "naive-ui";
-import { ref } from "vue";
-import { MonacoEditor } from "@/components/MonacoEditor";
-import SchemaEditorLite from "@/components/SchemaEditorLite";
-import MaskSpinner from "@/components/misc/MaskSpinner.vue";
-import type { ComposedProject } from "@/types";
-import { Branch } from "@/types/proto/v1/branch_service";
-
-type TabValue = "visualized-schema" | "schema-text";
-
-defineProps<{
- project: ComposedProject;
- branch: Branch | undefined;
- loading?: boolean;
-}>();
-
-const tab = ref<TabValue>("visualized-schema");
-</script>
diff --git a/frontend/src/components/Branch/utils.ts b/frontend/src/components/Branch/utils.ts
deleted file mode 100644
index b9ab6e16c8..0000000000
--- a/frontend/src/components/Branch/utils.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { useCurrentUserV1 } from "@/store";
-import type { Branch } from "@/types/proto/v1/branch_service";
-
-export const generateForkedBranchName = (branch: Branch): string => {
- const currentUser = useCurrentUserV1();
- const parentBranchName = branch.branchId;
- const branchName =
- `${currentUser.value.title}/${parentBranchName}-draft`.replaceAll(" ", "-");
- return branchName;
-};
-
-export const validateBranchName = (branchName: string): boolean => {
- const regex = /^[a-zA-Z][a-zA-Z0-9-_/]+$/;
- return regex.test(branchName);
-};
-
-export const wildcardToRegex = (wildcard: string): RegExp => {
- return new RegExp(`^${wildcard.split("*").join(".*")}$`);
-};
diff --git a/frontend/src/components/IssueV1/logic/initialize/create.ts b/frontend/src/components/IssueV1/logic/initialize/create.ts
index 3f5f1fceb4..4598168807 100644
--- a/frontend/src/components/IssueV1/logic/initialize/create.ts
+++ b/frontend/src/components/IssueV1/logic/initialize/create.ts
@@ -5,7 +5,6 @@ import { useRoute } from "vue-router";
import { rolloutServiceClient } from "@/grpcweb";
import type { TemplateType } from "@/plugins";
import {
- useBranchStore,
useChangelistStore,
useCurrentUserV1,
useDatabaseV1Store,
@@ -28,7 +27,6 @@ import {
TaskTypeListWithStatement,
} from "@/types";
import { DatabaseGroupView } from "@/types/proto/v1/database_group_service";
-import { DatabaseConfig } from "@/types/proto/v1/database_service";
import { IssueStatus, Issue_Type } from "@/types/proto/v1/issue_service";
import {
Plan,
@@ -40,7 +38,6 @@ import {
} from "@/types/proto/v1/plan_service";
import type { Stage } from "@/types/proto/v1/rollout_service";
import { Rollout, Task_Type } from "@/types/proto/v1/rollout_service";
-import { SheetPayload } from "@/types/proto/v1/sheet_service";
import {
extractProjectResourceName,
extractSheetUID,
@@ -85,9 +82,6 @@ export const createIssueSkeleton = async (
const issue = await buildIssue(params);
- // Prepare params context for building plan.
- await prepareParamsContext(params);
-
const plan = await buildPlan(params);
issue.plan = plan.name;
issue.planEntity = plan;
@@ -104,12 +98,6 @@ export const createIssueSkeleton = async (
return issue;
};
-const prepareParamsContext = async (params: CreateIssueParams) => {
- if (params.branch) {
- await useBranchStore().fetchBranchByName(params.branch);
- }
-};
-
const buildIssue = async (params: CreateIssueParams) => {
const { project, query } = params;
const issue = emptyIssue();
@@ -212,7 +200,6 @@ export const buildSteps = async (
const spec = await buildSpecForTarget(db.name, params, sheetUID);
step.specs.push(spec);
maybeSetInitialSQLForSpec(spec, db.name, params);
- maybeSetInitialDatabaseConfigForSpec(spec, params);
}
steps.push(step);
}
@@ -439,39 +426,6 @@ const maybeSetInitialSQLForSpec = (
}
};
-const maybeSetInitialDatabaseConfigForSpec = async (
- spec: Plan_Spec,
- params: CreateIssueParams
-) => {
- const branch = params.branch;
- if (!branch) {
- return;
- }
-
- const sheetName = sheetNameForSpec(spec);
- if (!sheetName) return;
- const uid = extractSheetUID(sheetName);
- if (!uid.startsWith("-")) {
- // If the sheet is a remote sheet, ignore initial Database configs.
- return;
- }
-
- // TODO(d): double check setting database config.
- const temp = await useBranchStore().fetchBranchByName(branch);
- if (temp) {
- const sheetEntity = getLocalSheetByName(sheetName);
- if (!sheetEntity.payload) {
- sheetEntity.payload = SheetPayload.fromPartial({});
- }
- sheetEntity.payload.databaseConfig = DatabaseConfig.fromPartial({
- schemaConfigs: temp.schemaMetadata?.schemaConfigs,
- });
- sheetEntity.payload.baselineDatabaseConfig = DatabaseConfig.fromPartial({
- schemaConfigs: temp.baselineSchemaMetadata?.schemaConfigs,
- });
- }
-};
-
const extractInitialSQLFromQuery = async (
query: Record<string, string>
): Promise<InitialSQL> => {
diff --git a/frontend/src/components/Plan/logic/initialize/create.ts b/frontend/src/components/Plan/logic/initialize/create.ts
index cf4d9027cd..c2966aa5d9 100644
--- a/frontend/src/components/Plan/logic/initialize/create.ts
+++ b/frontend/src/components/Plan/logic/initialize/create.ts
@@ -3,7 +3,6 @@ import { v4 as uuidv4 } from "uuid";
import { useRoute } from "vue-router";
import type { TemplateType } from "@/plugins";
import {
- useBranchStore,
useChangelistStore,
useDatabaseV1Store,
useEnvironmentV1Store,
@@ -16,7 +15,6 @@ import { useDatabaseV1List } from "@/store/modules/v1/databaseList";
import { composePlan } from "@/store/modules/v1/plan";
import type { ComposedProject } from "@/types";
import { isValidProjectName } from "@/types";
-import { DatabaseConfig } from "@/types/proto/v1/database_service";
import {
Plan,
Plan_ChangeDatabaseConfig,
@@ -24,7 +22,7 @@ import {
Plan_Spec,
Plan_Step,
} from "@/types/proto/v1/plan_service";
-import { Sheet, SheetPayload } from "@/types/proto/v1/sheet_service";
+import { Sheet } from "@/types/proto/v1/sheet_service";
import {
extractSheetUID,
generateSQLForChangeToDatabase,
@@ -73,19 +71,10 @@ export const createPlanSkeleton = async (
initialSQL: await extractInitialSQLFromQuery(query),
};
- // Prepare params context for building plan.
- await prepareParamsContext(params);
-
const plan = await buildPlan(params);
return plan;
};
-const prepareParamsContext = async (params: CreatePlanParams) => {
- if (params.branch) {
- await useBranchStore().fetchBranchByName(params.branch);
- }
-};
-
export const buildPlan = async (params: CreatePlanParams) => {
const { databaseNameList, project, query } = params;
@@ -154,7 +143,6 @@ export const buildSteps = async (
const spec = await buildSpecForTarget(db.name, params, sheetUID);
step.specs.push(spec);
maybeSetInitialSQLForSpec(spec, db.name, params);
- maybeSetInitialDatabaseConfigForSpec(spec, params);
}
steps.push(step);
}
@@ -337,39 +325,6 @@ const maybeSetInitialSQLForSpec = (
}
};
-const maybeSetInitialDatabaseConfigForSpec = async (
- spec: Plan_Spec,
- params: CreatePlanParams
-) => {
- const branch = params.branch;
- if (!branch) {
- return;
- }
-
- const sheetName = sheetNameForSpec(spec);
- if (!sheetName) return;
- const uid = extractSheetUID(sheetName);
- if (!uid.startsWith("-")) {
- // If the sheet is a remote sheet, ignore initial Database configs.
- return;
- }
-
- // TODO(d): double check setting database config.
- const temp = await useBranchStore().fetchBranchByName(branch);
- if (temp) {
- const sheetEntity = getLocalSheetByName(sheetName);
- if (!sheetEntity.payload) {
- sheetEntity.payload = SheetPayload.fromPartial({});
- }
- sheetEntity.payload.databaseConfig = DatabaseConfig.fromPartial({
- schemaConfigs: temp.schemaMetadata?.schemaConfigs,
- });
- sheetEntity.payload.baselineDatabaseConfig = DatabaseConfig.fromPartial({
- schemaConfigs: temp.baselineSchemaMetadata?.schemaConfigs,
- });
- }
-};
-
const extractInitialSQLFromQuery = async (
query: Record<string, string>
): Promise<InitialSQL> => {
diff --git a/frontend/src/components/ProjectBranchesPanel.vue b/frontend/src/components/ProjectBranchesPanel.vue
deleted file mode 100644
index 340517048c..0000000000
--- a/frontend/src/components/ProjectBranchesPanel.vue
+++ /dev/null
@@ -1,119 +0,0 @@
-<template>
- <div class="flex flex-row justify-end items-center gap-x-2 mb-2">
- <SearchBox
- v-model:value="state.searchKeyword"
- :autofocus="true"
- :placeholder="$t('common.filter-by-name')"
- />
- <NButton v-if="allowCreate" type="primary" @click="handleCreateBranch">
- <PlusIcon class="w-4 h-auto mr-0.5" />
- <span class="capitalize">{{ $t("database.new-branch") }}</span>
- </NButton>
- </div>
- <div class="space-y-6 w-full overflow-x-auto">
- <div class="w-full space-y-2">
- <p class="textlabel !text-base">{{ $t("branch.default-branches") }}</p>
- <BranchDataTable :branches="defaultBranches" :ready="ready" />
- </div>
- <div class="w-full space-y-2">
- <p class="textlabel !text-base">{{ $t("branch.your-branches") }}</p>
- <BranchDataTable
- :branches="currentUserBranches"
- :ready="ready"
- :show-parent-branch-column="true"
- />
- </div>
- <div class="w-full space-y-2">
- <p class="textlabel !text-base">{{ $t("branch.active-branches") }}</p>
- <BranchDataTable
- :branches="activeBranches"
- :ready="ready"
- :show-parent-branch-column="true"
- />
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { orderBy } from "lodash-es";
-import { PlusIcon } from "lucide-vue-next";
-import { NButton } from "naive-ui";
-import { computed, reactive } from "vue";
-import { useRouter } from "vue-router";
-import BranchDataTable from "@/components/Branch/BranchDataTable/index.vue";
-import { PROJECT_V1_ROUTE_BRANCH_DETAIL } from "@/router/dashboard/projectV1";
-import { useCurrentUserV1 } from "@/store";
-import { useBranchListByProject } from "@/store/modules/branch";
-import { userNamePrefix } from "@/store/modules/v1/common";
-import { getTimeForPbTimestamp, type ComposedProject } from "@/types";
-import { hasProjectPermissionV2 } from "@/utils";
-import { SearchBox } from "./v2";
-
-const props = defineProps<{
- project: ComposedProject;
-}>();
-
-interface LocalState {
- searchKeyword: string;
-}
-
-// BRANCH_DEFAULT_ACTIVE_DURATION is the duration that a branch is considered as active.
-// Currently, it is set to 2 months.
-const BRANCH_DEFAULT_ACTIVE_DURATION = 1000 * 60 * 60 * 24 * 30 * 2;
-
-const router = useRouter();
-const currentUser = useCurrentUserV1();
-const { branchList, ready } = useBranchListByProject(
- computed(() => props.project.name)
-);
-const state = reactive<LocalState>({
- searchKeyword: "",
-});
-const allowCreate = computed(() => {
- return hasProjectPermissionV2(props.project, "bb.branches.create");
-});
-
-const filteredBranches = computed(() => {
- return orderBy(branchList.value, "updateTime", "desc").filter((branch) => {
- return state.searchKeyword
- ? branch.branchId.includes(state.searchKeyword)
- : true;
- });
-});
-
-// defaultBranches are those branches that are parent branches.
-const defaultBranches = computed(() => {
- return filteredBranches.value.filter((branch) => {
- return branch.parentBranch === "";
- });
-});
-
-// currentUserBranches are those branches that are created by the current user and are not parent branches.
-const currentUserBranches = computed(() => {
- return filteredBranches.value.filter((branch) => {
- return (
- branch.parentBranch !== "" &&
- branch.creator === `${userNamePrefix}${currentUser.value.email}`
- );
- });
-});
-
-// activeBranches are those branches that are active in the last 2 months.
-const activeBranches = computed(() => {
- return filteredBranches.value.filter((branch) => {
- return (
- getTimeForPbTimestamp(branch.updateTime) >
- Date.now() - BRANCH_DEFAULT_ACTIVE_DURATION
- );
- });
-});
-
-const handleCreateBranch = () => {
- router.push({
- name: PROJECT_V1_ROUTE_BRANCH_DETAIL,
- params: {
- branchName: "new",
- },
- });
-};
-</script>
diff --git a/frontend/src/components/SchemaEditorLite/Aside/LastUpdate.vue b/frontend/src/components/SchemaEditorLite/Aside/LastUpdate.vue
deleted file mode 100644
index 3159a1bbef..0000000000
--- a/frontend/src/components/SchemaEditorLite/Aside/LastUpdate.vue
+++ /dev/null
@@ -1,132 +0,0 @@
-<template>
- <NPopover
- v-if="updater || sourceBranch"
- :disabled="!updateTime"
- placement="right"
- >
- <template #trigger>
- <div class="flex items-center justify-end gap-1">
- <NTag v-if="sourceBranch" size="small" round>{{
- sourceBranch.branchId
- }}</NTag>
- <UserAvatar v-if="updater" :user="updater" size="MINI" />
- </div>
- </template>
- <template #default>
- <div class="flex flex-col items-stretch gap-2 text-sm">
- <div class="flex justify-between gap-4">
- <div>
- {{ $t("branch.last-update.self") }}
- </div>
-
- <div v-if="updater" class="flex justify-end gap-1">
- <UserAvatar :user="updater" size="TINY" />
- {{ updater?.title }}
- </div>
- </div>
- <div v-if="sourceBranch" class="flex justify-between gap-4">
- <div>
- {{ $t("branch.source-branch.self") }}
- </div>
-
- <div v-if="sourceBranch" class="flex justify-end gap-1">
- {{ sourceBranch.branchId }}
- </div>
- </div>
- <div v-if="updateTime" class="flex justify-end gap-1 text-xs">
- {{
- dayjs(getDateForPbTimestamp(updateTime)).format(
- "YYYY-MM-DD HH:mm:ss UTCZZ"
- )
- }}
- </div>
- </div>
- </template>
- </NPopover>
-</template>
-
-<script setup lang="ts">
-import { NPopover, NTag } from "naive-ui";
-import { computed } from "vue";
-import { watchEffect } from "vue";
-import UserAvatar from "@/components/User/UserAvatar.vue";
-import { extractUserEmail, useBranchStore, useUserStore } from "@/store";
-import { getDateForPbTimestamp } from "@/types";
-import type {
- TreeNodeForFunction,
- TreeNodeForProcedure,
- TreeNodeForTable,
- TreeNodeForView,
-} from "./common";
-
-const props = defineProps<{
- node:
- | TreeNodeForTable
- | TreeNodeForView
- | TreeNodeForProcedure
- | TreeNodeForFunction;
-}>();
-
-const branchStore = useBranchStore();
-
-const config = computed(() => {
- const { type, metadata } = props.node;
- const schemaConfig = metadata.database.schemaConfigs.find(
- (sc) => sc.name === metadata.schema.name
- );
- if (!schemaConfig) {
- return undefined;
- }
- if (type === "table") {
- return schemaConfig.tableConfigs.find(
- (tc) => tc.name === metadata.table.name
- );
- }
- if (type === "view") {
- return schemaConfig.viewConfigs.find(
- (vc) => vc.name === metadata.view.name
- );
- }
- if (type === "procedure") {
- return schemaConfig.procedureConfigs.find(
- (pc) => pc.name === metadata.procedure.name
- );
- }
- if (type === "function") {
- return schemaConfig.functionConfigs.find(
- (fc) => fc.name === metadata.function.name
- );
- }
-
- return undefined;
-});
-
-const updater = computed(() => {
- if (!config.value?.updater) return undefined;
- const email = extractUserEmail(config.value.updater);
- return useUserStore().getUserByEmail(email);
-});
-
-const sourceBranch = computed(() => {
- if (!config.value?.sourceBranch) return undefined;
- return branchStore.getBranchByName(
- config.value.sourceBranch,
- /* view: any */ undefined
- );
-});
-
-const updateTime = computed(() => {
- return config.value?.updateTime;
-});
-
-watchEffect(() => {
- const source = config.value?.sourceBranch;
- if (source) {
- branchStore.fetchBranchByName(
- source,
- /* useCache */ true,
- /* silent */ true
- );
- }
-});
-</script>
diff --git a/frontend/src/components/SchemaEditorLite/Aside/Tree.vue b/frontend/src/components/SchemaEditorLite/Aside/Tree.vue
index 130dda39b2..35c032c92f 100644
--- a/frontend/src/components/SchemaEditorLite/Aside/Tree.vue
+++ b/frontend/src/components/SchemaEditorLite/Aside/Tree.vue
@@ -6,9 +6,7 @@
<NInput
v-model:value="searchPattern"
:placeholder="
- resourceType === 'branch'
- ? $t('schema-designer.search-tables')
- : $t('schema-editor.search-database-and-table')
+ $t('schema-editor.search-database-and-table')
"
>
<template #prefix>
@@ -141,7 +139,6 @@ import ViewNameModal from "../Modals/ViewNameModal.vue";
import { useSchemaEditorContext } from "../context";
import { keyForResource, keyForResourceName } from "../context/common";
import { engineSupportsMultiSchema } from "../spec";
-import LastUpdate from "./LastUpdate.vue";
import NodePrefix from "./NodePrefix.vue";
import type {
TreeNode,
@@ -189,11 +186,9 @@ interface LocalState {
const { t } = useI18n();
const {
events,
- resourceType,
targets,
readonly,
currentTab,
- showLastUpdater,
disableDiffColoring,
addTab,
markEditStatus,
@@ -288,7 +283,7 @@ const findFirstTableGroupNode = (
};
const buildDatabaseTreeData = (openFirstChild: boolean) => {
const treeNodeList = buildTree(targets.value, treeNodeMap, {
- byInstance: resourceType.value === "database",
+ byInstance: true,
});
treeDataRef.value = treeNodeList;
@@ -554,17 +549,6 @@ const renderSuffix = ({ option }: { option: TreeOption }) => {
return h("div", { class: "inline-flex gap-1" }, icons);
};
- if (
- node.type === "table" ||
- node.type === "view" ||
- node.type === "procedure" ||
- node.type === "function"
- ) {
- if (showLastUpdater.value) {
- icons.push(h(LastUpdate, { node }));
- }
- }
-
if (readonly.value) {
return renderIcons();
}
diff --git a/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.vue b/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.vue
index 9e62e6d972..e8ddc82ae3 100644
--- a/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.vue
+++ b/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.vue
@@ -66,7 +66,7 @@ import ClassificationCell from "@/components/ColumnDataTable/ClassificationCell.
import LabelEditorDrawer from "@/components/LabelEditorDrawer.vue";
import SemanticTypesDrawer from "@/components/SensitiveData/components/SemanticTypesDrawer.vue";
import { InlineInput } from "@/components/v2";
-import { useSettingV1Store, useSubscriptionV1Store } from "@/store/modules";
+import { useSettingV1Store } from "@/store/modules";
import type { ComposedDatabase } from "@/types";
import { Engine } from "@/types/proto/v1/common";
import type {
@@ -89,9 +89,7 @@ import {
OperationCell,
ReorderCell,
SelectionCell,
- SemanticTypeCell,
DefaultValueCell,
- LabelsCell,
} from "./components";
interface LocalState {
@@ -167,7 +165,6 @@ const state = reactive<LocalState>({
const {
classificationConfig,
showClassificationColumn,
- showDatabaseConfigColumn,
disableDiffColoring,
selectionEnabled,
markEditStatus,
@@ -199,7 +196,6 @@ const tableBodyHeight = computed(() => {
// Use this to avoid unnecessary initial rendering
const layoutReady = computed(() => tableHeaderHeight.value > 0);
const { t } = useI18n();
-const subscriptionV1Store = useSubscriptionV1Store();
const settingStore = useSettingV1Store();
const editColumnDefaultValueExpressionContext = ref<ColumnMetadata>();
@@ -252,13 +248,6 @@ const semanticTypeList = computed(() => {
);
});
-const showSemanticTypeColumn = computed(() => {
- return (
- subscriptionV1Store.hasFeature("bb.feature.sensitive-data") &&
- showDatabaseConfigColumn.value
- );
-});
-
const showClassification = computed(() => {
return showClassificationColumn(
props.engine,
@@ -342,29 +331,6 @@ const columns = computed(() => {
});
},
},
- {
- key: "semantic-types",
- title: t("settings.sensitive-data.semantic-types.table.semantic-type"),
- resizable: true,
- minWidth: 140,
- maxWidth: 320,
- hide: !showSemanticTypeColumn.value,
- render: (column) => {
- return h(SemanticTypeCell, {
- db: props.db,
- database: props.database,
- schema: props.schema,
- table: props.table,
- column,
- readonly: props.readonly,
- disabled: props.disableChangeTable,
- semanticTypeList: semanticTypeList.value,
- disableAlterColumn: props.disableAlterColumn,
- onRemove: () => onSemanticTypeRemove(column),
- onEdit: () => openSemanticTypeDrawer(column),
- });
- },
- },
{
key: "classification",
title: t("schema-editor.column.classification"),
@@ -539,26 +505,6 @@ const columns = computed(() => {
});
},
},
- {
- key: "labels",
- title: t("common.labels"),
- resizable: true,
- minWidth: 140,
- maxWidth: 320,
- hide: !showDatabaseConfigColumn.value,
- render: (column) => {
- return h(LabelsCell, {
- db: props.db,
- database: props.database,
- schema: props.schema,
- table: props.table,
- column,
- readonly: props.readonly,
- disabled: props.disableChangeTable,
- onEdit: () => openLabelsDrawer(column),
- });
- },
- },
{
key: "operations",
title: "",
@@ -679,16 +625,6 @@ const handleSelectColumnDefaultValueExpression = (expression: string) => {
markColumnStatus(column, "updated");
};
-const openSemanticTypeDrawer = (column: ColumnMetadata) => {
- state.pendingUpdateColumn = column;
- state.showSemanticTypesDrawer = true;
-};
-
-const openLabelsDrawer = (column: ColumnMetadata) => {
- state.pendingUpdateColumn = column;
- state.showLabelsDrawer = true;
-};
-
const onClassificationSelect = (classificationId: string) => {
if (!state.pendingUpdateColumn) {
return;
@@ -728,13 +664,6 @@ const onLabelsApply = (labelsList: { [key: string]: string }[]) => {
markColumnStatus(state.pendingUpdateColumn, "updated");
};
-const onSemanticTypeRemove = async (column: ColumnMetadata) => {
- markColumnStatus(column, "updated");
- updateColumnConfig(column, (config) => {
- config.semanticTypeId = "";
- });
-};
-
const classesForRow = (column: ColumnMetadata) => {
return props.getColumnItemComputedClassList(column);
};
diff --git a/frontend/src/components/SchemaEditorLite/SchemaEditorLite.vue b/frontend/src/components/SchemaEditorLite/SchemaEditorLite.vue
index 78edf1c8f7..01270c6086 100644
--- a/frontend/src/components/SchemaEditorLite/SchemaEditorLite.vue
+++ b/frontend/src/components/SchemaEditorLite/SchemaEditorLite.vue
@@ -26,10 +26,8 @@ import "splitpanes/dist/splitpanes.css";
import { reactive, computed, onMounted, toRef, watch } from "vue";
import MaskSpinner from "@/components/misc/MaskSpinner.vue";
import { useEmitteryEventListener } from "@/composables/useEmitteryEventListener";
-import { useDatabaseV1Store, useSettingV1Store } from "@/store";
+import { useSettingV1Store } from "@/store";
import type { ComposedProject } from "@/types";
-import type { Branch } from "@/types/proto/v1/branch_service";
-import { DatabaseMetadata } from "@/types/proto/v1/database_service";
import Aside from "./Aside";
import Editor from "./Editor.vue";
import { useAlgorithm } from "./algorithm";
@@ -38,15 +36,11 @@ import type { EditTarget, RolloutObject } from "./types";
const props = defineProps<{
project: ComposedProject;
- resourceType: "database" | "branch";
readonly?: boolean;
selectedRolloutObjects?: RolloutObject[];
targets?: EditTarget[];
- // NOTE: we only support editing one branch for now.
- branch?: Branch;
loading?: boolean;
diffWhenReady?: boolean;
- showLastUpdater?: boolean;
disableDiffColoring?: boolean;
hidePreview?: boolean;
}>();
@@ -73,21 +67,7 @@ onMounted(async () => {
});
const targets = computed(() => {
- if (props.resourceType === "database") {
- return props.targets ?? [];
- }
- if (props.resourceType === "branch") {
- const { branch } = props;
- if (!branch) return [];
- const target: EditTarget = {
- database: useDatabaseV1Store().getDatabaseByName(branch.baselineDatabase),
- metadata: branch.schemaMetadata ?? DatabaseMetadata.fromPartial({}),
- baselineMetadata:
- branch.baselineSchemaMetadata ?? DatabaseMetadata.fromPartial({}),
- };
- return [target];
- }
- return [];
+ return props.targets ?? [];
});
const ready = computed(() => {
@@ -101,10 +81,8 @@ const combinedLoading = computed(() => {
const context = provideSchemaEditorContext({
targets,
project: toRef(props, "project"),
- resourceType: toRef(props, "resourceType"),
readonly: toRef(props, "readonly"),
selectedRolloutObjects: toRef(props, "selectedRolloutObjects"),
- showLastUpdater: toRef(props, "showLastUpdater"),
disableDiffColoring: toRef(props, "disableDiffColoring"),
hidePreview: toRef(props, "hidePreview"),
});
@@ -113,8 +91,7 @@ const { rebuildMetadataEdit, applyMetadataEdit, applySelectedMetadataEdit } =
useEmitteryEventListener(context.events, "rebuild-edit-status", (params) => {
if (
- ready.value &&
- (props.diffWhenReady || props.resourceType === "database")
+ ready.value
) {
targets.value.forEach((target) => {
rebuildMetadataEdit(
diff --git a/frontend/src/components/SchemaEditorLite/TabsContainer.vue b/frontend/src/components/SchemaEditorLite/TabsContainer.vue
index 56e5cd121e..41e9716f99 100644
--- a/frontend/src/components/SchemaEditorLite/TabsContainer.vue
+++ b/frontend/src/components/SchemaEditorLite/TabsContainer.vue
@@ -94,7 +94,6 @@ const emit = defineEmits<{
const { t } = useI18n();
const {
- resourceType,
tabList,
currentTab,
setCurrentTab,
@@ -162,9 +161,6 @@ const getTabComputedClassList = (tab: TabContext) => {
const getTabName = (tab: TabContext) => {
if (tab.type === "database") {
- if (resourceType.value === "branch") {
- return "Tables";
- }
const { database } = tab;
return database.databaseName;
}
diff --git a/frontend/src/components/SchemaEditorLite/context/index.ts b/frontend/src/components/SchemaEditorLite/context/index.ts
index b01c26a2b1..a71e237a8c 100644
--- a/frontend/src/components/SchemaEditorLite/context/index.ts
+++ b/frontend/src/components/SchemaEditorLite/context/index.ts
@@ -6,7 +6,7 @@ import { useSettingV1Store } from "@/store";
import type { ComposedProject } from "@/types";
import { Engine } from "@/types/proto/v1/common";
import type { RebuildMetadataEditReset } from "../algorithm/rebuild";
-import type { EditTarget, ResourceType, RolloutObject } from "../types";
+import type { EditTarget, RolloutObject } from "../types";
import { useEditConfigs } from "./config";
import { useEditStatus } from "./edit";
import { useScrollStatus } from "./scroll";
@@ -30,20 +30,15 @@ export type SchemaEditorOptions = {
};
export const provideSchemaEditorContext = (params: {
- resourceType: Ref<ResourceType>;
readonly: Ref<boolean>;
project: Ref<ComposedProject>;
targets: Ref<EditTarget[]>;
selectedRolloutObjects: Ref<RolloutObject[] | undefined>;
- showLastUpdater: Ref<boolean>;
disableDiffColoring: Ref<boolean>;
hidePreview: Ref<boolean>;
options?: Ref<SchemaEditorOptions>;
}) => {
const events = new Emittery() as SchemaEditorEvents;
- const showDatabaseConfigColumn = computed(
- () => params.resourceType.value === "branch"
- );
const classificationConfig = computed(() => {
if (!params.project.value.dataClassificationConfigId) {
return;
@@ -61,7 +56,6 @@ export const provideSchemaEditorContext = (params: {
...useEditConfigs(params.targets),
...useScrollStatus(),
...useSelection(params.selectedRolloutObjects, events),
- showDatabaseConfigColumn,
classificationConfig,
showClassificationColumn: (
engine: Engine,
@@ -70,9 +64,6 @@ export const provideSchemaEditorContext = (params: {
if (!classificationConfig.value) {
return false;
}
- if (showDatabaseConfigColumn.value) {
- return true;
- }
return supportSetClassificationFromComment(
engine,
classificationFromConfig
diff --git a/frontend/src/components/SchemaEditorLite/types.ts b/frontend/src/components/SchemaEditorLite/types.ts
index f89bcf341e..6fefc60c31 100644
--- a/frontend/src/components/SchemaEditorLite/types.ts
+++ b/frontend/src/components/SchemaEditorLite/types.ts
@@ -15,8 +15,6 @@ export type EditTarget = {
baselineMetadata: DatabaseMetadata;
};
-export type ResourceType = "branch" | "database";
-
export type TabType = "database" | "table" | "view" | "procedure" | "function";
export type CommonTabContext = {
diff --git a/frontend/src/components/SchemaTemplate/TableTemplateForm.vue b/frontend/src/components/SchemaTemplate/TableTemplateForm.vue
index 6f07224911..d982616ae9 100644
--- a/frontend/src/components/SchemaTemplate/TableTemplateForm.vue
+++ b/frontend/src/components/SchemaTemplate/TableTemplateForm.vue
@@ -259,10 +259,8 @@ const targets = computed(() => {
const context = provideSchemaEditorContext({
targets,
project: ref(unknownProject()),
- resourceType: ref("branch"),
readonly: toRef(props, "readonly"),
selectedRolloutObjects: ref(undefined),
- showLastUpdater: ref(false),
disableDiffColoring: ref(true),
hidePreview: ref(false),
});
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 06aefa2cf2..aa186e2e4c 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -213,7 +213,6 @@
"leave-without-saving": "Leave without saving?",
"configure-now": "Configure now",
"connection": "Connection",
- "permission-denied": "Permission denied",
"resource": "Resource",
"resources": "Resources",
"closed": "Closed",
@@ -947,7 +946,6 @@
},
"unfinished-resolved-issue-tips": "This issue is marked as \"Done\" but some of its tasks are not executed successfully.",
"some-tasks-are-not-executed-successfully": "(Some tasks are not executed successfully)",
- "preview": "Preview issue",
"missing-sql-statement": "SQL statement missing.",
"task-summary-tooltip": "{failed} task failed | {failed} tasks failed",
"data-export": {
@@ -1374,10 +1372,6 @@
"mixed-values-for-label": "This selected label have mixed values",
"mixed-label-values-warning": "Some of the selected resources have mixed values for the same key",
"change-data": "Change Data",
- "new-branch": "New branch",
- "branch-name": "Branch name",
- "select-branch": "Select a branch",
- "delete-this-branch": "Delete this branch",
"table-detail": "Table detail",
"batch-action-not-support-alter-schema": "Some databases don't support altering schema",
"batch-action-permission-denied": "Don't have permission to {action} for databases",
@@ -2028,7 +2022,6 @@
"unique": "Unique",
"dependency-columns": "Depenedent columns"
},
- "generated-ddl-is-empty": "Generated DDL is empty",
"table-partition": {
"partitions": "Partitions",
"edit-partitions": "Edit partitions",
@@ -2624,18 +2617,7 @@
"review-sql": "Review SQL"
},
"schema-designer": {
- "baseline-version": "Baseline",
- "new-branch": "New branch",
- "parent-branch": "Parent",
- "raw-sql-preview": "Raw SQL Preview",
- "search-tables": "Search tables",
- "use-tips": "Click a table to start.",
- "apply-to-database": "Apply change to database",
- "select-database-placeholder": "Select a database (MySQL, PostgreSQL, TiDB and Oracle only)",
- "message": {
- "created-succeed": "Branch created successfully",
- "updated-succeed": "Branch updated successfully"
- }
+ "use-tips": "Click a table to start."
},
"cel": {
"condition": {
@@ -2735,64 +2717,13 @@
"password-info": "Provide a password to encrypt the export file."
},
"branch": {
- "rollout": {
- "select-target-database": "Select target database"
- },
"select-tables-to-rollout": "Select tables to rollout",
- "default-branches": "Default",
- "your-branches": "Your branches",
- "active-branches": "Active branches",
- "merge-rebase": {
- "select-branches-to-merge": "Select branches to merge",
- "select-branches-to-rebase": "Select branches to rebase",
- "validating-branch": "Validating branches",
- "able-to-merge": "Able to merge",
- "able-to-rebase": "Able to rebase",
- "cannot-automatically-merge": "Can't automatically merge, please {rebase_branch} first.",
- "cannot-automatically-rebase": "Can't rebase automatically. Please resolve the conflicts manually.",
- "go-rebase": "rebase branch",
- "changes-of-branch": "Changes of {branch}",
- "merge-succeeded": "Merge succeeded",
- "rebase-succeeded": "Rebase succeeded",
- "merge-branch": "Merge branch",
- "rebase-branch": "Rebase branch",
- "confirm-rebase": "Confirm rebase?",
- "conflict-not-resolved": "It seems that some conflicts haven't been resolved yet.",
- "resolve-conflicts-to-rebase": "Resolve conflicts to rebase",
- "preview-rebase-result": "Preview changes on {branch} after rebase",
- "before-merge": "Before merge",
- "after-merge": "After merge",
- "before-rebase": "Before rebase",
- "after-rebase": "After rebase",
- "post-merge-action": {
- "rebase": "Merge and rebase branch",
- "delete": "Merge and delete branch"
- }
- },
- "source": {
- "baseline-version": "Baseline version",
- "parent-branch": "Parent branch",
- "self": "Source"
- },
"index": {
"drop-index-confirm": "Drop index?"
},
- "force-delete": "Force delete",
- "deleting-parent-branch": "Deleting a parent branch.",
- "visualized-schema": "Visualized Schema",
- "schema-text": "Schema Text",
- "baseline": "Baseline",
- "head": "Head",
- "show-diff-with-branch-baseline": "Show diff with branch baseline",
"table-partition": {
"drop-partition-confirm": "Drop table partition?",
"drop-partition-with-subpartitions-confirm": "Will also drop all its subpartitions."
- },
- "last-update": {
- "self": "Last update"
- },
- "source-branch": {
- "self": "Source branch"
}
},
"worksheet": {
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index bb83ef2b94..a340e4046d 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -213,7 +213,6 @@
"leave-without-saving": "¿Salir sin ahorrar?",
"configure-now": "Configurar ahora",
"connection": "Conexión",
- "permission-denied": "Permiso denegado",
"resource": "Recurso",
"resources": "Recursos",
"closed": "Cerrado",
@@ -947,7 +946,6 @@
},
"unfinished-resolved-issue-tips": "Este problema está marcado como \"Listo\", pero algunas de sus tareas no se ejecutan correctamente.",
"some-tasks-are-not-executed-successfully": "(Algunas tareas no se ejecutan correctamente)",
- "preview": "Problema de vista previa",
"missing-sql-statement": "Sentencia SQL faltante.",
"task-summary-tooltip": "{failed} tarea fallida | \n{failed} tareas fallidas",
"data-export": {
@@ -1374,10 +1372,6 @@
"mixed-values-for-label": "Esta etiqueta seleccionada tiene valores mixtos.",
"mixed-label-values-warning": "Algunos de los recursos seleccionados tienen valores mixtos para la misma clave",
"change-data": "Cambiar datos",
- "new-branch": "Nueva rama",
- "branch-name": "Nombre de la rama",
- "select-branch": "Seleccione una rama",
- "delete-this-branch": "Eliminar esta rama",
"table-detail": "Detalle de la tabla",
"batch-action-not-support-alter-schema": "Algunas bases de datos no admiten la modificación del esquema",
"batch-action-permission-denied": "No tengo permiso para {action} para bases de datos",
@@ -2028,7 +2022,6 @@
"unique": "Único",
"dependency-columns": "Columnas dependientes"
},
- "generated-ddl-is-empty": "El DDL generado está vacío",
"table-partition": {
"partitions": "Particiones",
"edit-partitions": "Editar particiones",
@@ -2624,18 +2617,7 @@
"review-sql": "Revisar SQL"
},
"schema-designer": {
- "baseline-version": "Versión de referencia",
- "new-branch": "Nueva rama",
- "parent-branch": "Rama principal",
- "raw-sql-preview": "vista previa de sql sin formato",
- "search-tables": "Buscar tablas",
- "use-tips": "Selecciona las tablas a diseñar",
- "apply-to-database": "Aplicar cambio a la base de datos",
- "select-database-placeholder": "Seleccione una base de datos (solo MySQL, PostgreSQL, TiDB y Oracle)",
- "message": {
- "created-succeed": "Diseño de esquema creado con éxito",
- "updated-succeed": "Diseño de esquema actualizado con éxito"
- }
+ "use-tips": "Selecciona las tablas a diseñar"
},
"cel": {
"condition": {
@@ -2735,64 +2717,13 @@
"password-info": "Proporcione una contraseña para cifrar el archivo de exportación."
},
"branch": {
- "rollout": {
- "select-target-database": "Seleccionar base de datos de destino"
- },
"select-tables-to-rollout": "Seleccionar tablas para implementar",
- "default-branches": "Ramas por defecto",
- "your-branches": "Tus ramas",
- "active-branches": "Ramas activas",
- "merge-rebase": {
- "select-branches-to-merge": "Seleccionar sucursales para fusionar",
- "select-branches-to-rebase": "Seleccione sucursales para rebase",
- "validating-branch": "Validando sucursales",
- "able-to-merge": "Capaz de fusionarse",
- "able-to-rebase": "Capaz de rebase",
- "cannot-automatically-merge": "No se puede fusionar automáticamente, {rebase_branch} primero.",
- "cannot-automatically-rebase": "No se puede cambiar la base automáticamente. \nResuelva los conflictos manualmente.",
- "go-rebase": "rama de rebase",
- "changes-of-branch": "Cambios de {branch}",
- "merge-succeeded": "Fusión exitosa",
- "rebase-succeeded": "Rebase exitoso",
- "merge-branch": "Fusionar rama",
- "rebase-branch": "rama de rebase",
- "confirm-rebase": "¿Confirmar rebase?",
- "conflict-not-resolved": "Parece que algunos conflictos aún no se han resuelto.",
- "resolve-conflicts-to-rebase": "Resolver conflictos para rebase",
- "preview-rebase-result": "Vista previa de los cambios en {branch} después de la rebase",
- "before-merge": "Antes de fusionarse",
- "after-merge": "Después de fusionar",
- "before-rebase": "Antes de rebase",
- "after-rebase": "Después de rebase",
- "post-merge-action": {
- "rebase": "Fusionar y reorganizar rama",
- "delete": "Fusionar y eliminar rama"
- }
- },
- "source": {
- "baseline-version": "Versión básica",
- "parent-branch": "Rama principal",
- "self": "Fuente"
- },
"index": {
"drop-index-confirm": "¿Índice de caída?"
},
- "force-delete": "Forzar eliminación",
- "deleting-parent-branch": "Eliminando una rama principal.",
- "visualized-schema": "Esquema visualizado",
- "schema-text": "Texto del esquema",
- "baseline": "Base",
- "head": "Cabeza",
- "show-diff-with-branch-baseline": "Mostrar diferencia con la línea base de la rama",
"table-partition": {
"drop-partition-confirm": "¿Eliminar partición de mesa?",
"drop-partition-with-subpartitions-confirm": "También eliminará todas sus subparticiones."
- },
- "last-update": {
- "self": "Última actualización"
- },
- "source-branch": {
- "self": "Rama fuente"
}
},
"worksheet": {
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 18d3447e70..0fcac094b3 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -213,7 +213,6 @@
"leave-without-saving": "変更を保存していませんか?",
"configure-now": "今すぐ設定する",
"connection": "接続する",
- "permission-denied": "許可が拒否されました",
"resource": "リソース",
"resources": "リソース",
"closed": "閉まっている",
@@ -947,7 +946,6 @@
},
"unfinished-resolved-issue-tips": "イシューは「完了」とマークされましたが、一部のタスクは正常に実行されませんでした。",
"some-tasks-are-not-executed-successfully": "(一部のタスクは正常に実行されませんでした)",
- "preview": "イシューのプレビュー",
"missing-sql-statement": "SQL ステートメントが欠落しています。",
"task-summary-tooltip": "{failed} 個のタスクが失敗しました",
"data-export": {
@@ -1374,10 +1372,6 @@
"mixed-values-for-label": "タグの値が異なります",
"mixed-label-values-warning": "一部のタグには異なる値があり、タグの編集はバッチで適用されます",
"change-data": "データ変更",
- "new-branch": "新しいブランチを作成する",
- "branch-name": "支店名",
- "select-branch": "ブランチを選択してください",
- "delete-this-branch": "このブランチを削除します",
"table-detail": "テーブルの詳細",
"batch-action-not-support-alter-schema": "一部のデータベースはテーブル構造の変更をサポートしていません",
"batch-action-permission-denied": "データベース {action} に対する権限がありません",
@@ -2028,7 +2022,6 @@
"unique": "唯一",
"dependency-columns": "従属列"
},
- "generated-ddl-is-empty": "生成された DDL は空です",
"table-partition": {
"partitions": "パーティション",
"edit-partitions": "パーティションの編集",
@@ -2624,18 +2617,7 @@
"review-sql": "SQLを確認する"
},
"schema-designer": {
- "baseline-version": "ベースラインバージョン",
- "new-branch": "新しいブランチを作成する",
- "parent-branch": "親ブランチ",
- "raw-sql-preview": "生の SQL プレビュー",
- "search-tables": "検索テーブル",
- "use-tips": "デザインするテーブルを選択してください",
- "apply-to-database": "変更をデータベースに適用する",
- "select-database-placeholder": "データベースを選択します (MySQL、PostgreSQL、TiDB、Oracle のみ)",
- "message": {
- "created-succeed": "ブランチが正常に作成されました",
- "updated-succeed": "ブランチが正常に更新されました"
- }
+ "use-tips": "デザインするテーブルを選択してください"
},
"cel": {
"condition": {
@@ -2735,64 +2717,13 @@
"password-info": "エクスポートされたファイルを暗号化するためのパスワードを入力します"
},
"branch": {
- "rollout": {
- "select-target-database": "ターゲットデータベースを選択してください"
- },
"select-tables-to-rollout": "公開するテーブルを選択してください",
- "default-branches": "デフォルトのブランチ",
- "your-branches": "あなたの支店",
- "active-branches": "アクティブなブランチ",
- "merge-rebase": {
- "select-branches-to-merge": "マージするブランチを選択してください",
- "select-branches-to-rebase": "リベースするブランチを選択してください",
- "validating-branch": "ブランチの検証中",
- "able-to-merge": "統合可能",
- "able-to-rebase": "リベース可能",
- "cannot-automatically-merge": "自動的に結合できません。まず {rebase_branch} してください。",
- "cannot-automatically-rebase": "自動的にリベースできません。競合を手動で解決してください。",
- "go-rebase": "ブランチをリベースする",
- "changes-of-branch": "{branch} への変更",
- "merge-succeeded": "マージが成功しました",
- "rebase-succeeded": "リベースが成功しました",
- "merge-branch": "ブランチをマージする",
- "rebase-branch": "ブランチをリベースする",
- "confirm-rebase": "リベースを確認しますか?",
- "conflict-not-resolved": "未解決の競合があるようです。",
- "resolve-conflicts-to-rebase": "リベースの競合を解決する",
- "preview-rebase-result": "リベース後に {branch} の変更をプレビューする",
- "before-merge": "合併前",
- "after-merge": "合併後",
- "before-rebase": "リベース前",
- "after-rebase": "リベース後",
- "post-merge-action": {
- "rebase": "ブランチのマージと同期",
- "delete": "ブランチのマージと削除"
- }
- },
- "source": {
- "baseline-version": "ベースラインバージョン",
- "parent-branch": "親ブランチ",
- "self": "ソース"
- },
"index": {
"drop-index-confirm": "インデックスを削除しますか?"
},
- "force-delete": "強制削除",
- "deleting-parent-branch": "親ブランチが削除されようとしています。",
- "visualized-schema": "ビジュアルスキーマ",
- "schema-text": "テキストスキーマ",
- "baseline": "ベースライン",
- "head": "現在",
- "show-diff-with-branch-baseline": "ブランチのベースラインとの違いを示します",
"table-partition": {
"drop-partition-confirm": "テーブルパーティションを削除しますか?",
"drop-partition-with-subpartitions-confirm": "すべてのサブパーティションが同時に削除されます。"
- },
- "last-update": {
- "self": "最後の更新"
- },
- "source-branch": {
- "self": "ソースブランチ"
}
},
"worksheet": {
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 5e5a0b069c..92c8f03e31 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -213,7 +213,6 @@
"leave-without-saving": "不保存变动?",
"configure-now": "现在配置",
"connection": "连接",
- "permission-denied": "您没有权限执行此操作",
"resource": "资源",
"resources": "资源",
"closed": "已关闭",
@@ -947,7 +946,6 @@
},
"unfinished-resolved-issue-tips": "该工单被标记为「已完成」,但其中某些任务并未成功执行。",
"some-tasks-are-not-executed-successfully": "(部分任务并未成功执行)",
- "preview": "预览工单",
"missing-sql-statement": "SQL 语句缺失。",
"task-summary-tooltip": "{failed} 个任务失败",
"data-export": {
@@ -1374,10 +1372,6 @@
"mixed-values-for-label": "该标签拥有不同的值",
"mixed-label-values-warning": "某些标签拥有不同的值,编辑标签将会批量应用",
"change-data": "变更数据",
- "new-branch": "新建分支",
- "branch-name": "分支名称",
- "select-branch": "选择一个分支",
- "delete-this-branch": "删除这个分支",
"table-detail": "表详情",
"batch-action-not-support-alter-schema": "一些数据库不支持修改表结构",
"batch-action-permission-denied": "没有权限对数据库{action}",
@@ -2028,7 +2022,6 @@
"unique": "唯一",
"dependency-columns": "依赖列"
},
- "generated-ddl-is-empty": "生成的 DDL 为空",
"table-partition": {
"partitions": "分区",
"edit-partitions": "编辑分区",
@@ -2624,18 +2617,7 @@
"review-sql": "审核 SQL"
},
"schema-designer": {
- "baseline-version": "基线版本",
- "new-branch": "新建分支",
- "parent-branch": "父分支",
- "raw-sql-preview": "原始 SQL 预览",
- "search-tables": "搜索表",
- "use-tips": "选择需要设计的表",
- "apply-to-database": "应用变更到数据库",
- "select-database-placeholder": "选择数据库(仅限 MySQL、PostgreSQL、TiDB 和 Oracle)",
- "message": {
- "created-succeed": "分支创建成功",
- "updated-succeed": "分支更新成功"
- }
+ "use-tips": "选择需要设计的表"
},
"cel": {
"condition": {
@@ -2735,64 +2717,13 @@
"password-info": "提供密码来对导出的文件进行加密"
},
"branch": {
- "rollout": {
- "select-target-database": "选择目标数据库"
- },
"select-tables-to-rollout": "选择要发布的表",
- "default-branches": "默认分支",
- "your-branches": "你的分支",
- "active-branches": "活跃的分支",
- "merge-rebase": {
- "select-branches-to-merge": "选择要合并的分支",
- "select-branches-to-rebase": "选择要 rebase 的分支",
- "validating-branch": "正在验证分支",
- "able-to-merge": "可以合并",
- "able-to-rebase": "可以 rebase",
- "cannot-automatically-merge": "无法自动合并,请先 {rebase_branch}。",
- "cannot-automatically-rebase": "无法自动 rebase,请手动解决冲突。",
- "go-rebase": "rebase 分支",
- "changes-of-branch": "{branch} 的变更",
- "merge-succeeded": "合并成功",
- "rebase-succeeded": "Rebase 成功",
- "merge-branch": "合并分支",
- "rebase-branch": "Rebase 分支",
- "confirm-rebase": "确认 rebase?",
- "conflict-not-resolved": "似乎还有尚未解决的冲突。",
- "resolve-conflicts-to-rebase": "解决冲突以进行 rebase",
- "preview-rebase-result": "预览 rebase 后 {branch} 上的修改",
- "before-merge": "合并前",
- "after-merge": "合并后",
- "before-rebase": "rebase 前",
- "after-rebase": "rebase 后",
- "post-merge-action": {
- "rebase": "合并且同步分支",
- "delete": "合并且删除分支"
- }
- },
- "source": {
- "baseline-version": "基线版本",
- "parent-branch": "父分支",
- "self": "来源"
- },
"index": {
"drop-index-confirm": "删除索引?"
},
- "force-delete": "强制删除",
- "deleting-parent-branch": "将要删除一个父分支。",
- "visualized-schema": "可视化 Schema",
- "schema-text": "文本 Schema",
- "baseline": "基线",
- "head": "当前",
- "show-diff-with-branch-baseline": "显示与分支基线之间的差异",
"table-partition": {
"drop-partition-confirm": "删除表分区?",
"drop-partition-with-subpartitions-confirm": "将会同时删除其所有子分区。"
- },
- "last-update": {
- "self": "最后更新"
- },
- "source-branch": {
- "self": "源分支"
}
},
"worksheet": {
diff --git a/frontend/src/router/dashboard/projectV1.ts b/frontend/src/router/dashboard/projectV1.ts
index e33f928d8a..e1e16f190f 100644
--- a/frontend/src/router/dashboard/projectV1.ts
+++ b/frontend/src/router/dashboard/projectV1.ts
@@ -14,11 +14,6 @@ export const PROJECT_V1_ROUTE_DATABASE_GROUPS = `${PROJECT_V1_ROUTE_DASHBOARD}.d
export const PROJECT_V1_ROUTE_DATABASE_GROUPS_CREATE = `${PROJECT_V1_ROUTE_DASHBOARD}.database-group.create`;
export const PROJECT_V1_ROUTE_DATABASE_GROUP_DETAIL = `${PROJECT_V1_ROUTE_DASHBOARD}.database-group.detail`;
export const PROJECT_V1_ROUTE_DEPLOYMENT_CONFIG = `${PROJECT_V1_ROUTE_DASHBOARD}.deployment-config`;
-export const PROJECT_V1_ROUTE_BRANCHES = `${PROJECT_V1_ROUTE_DASHBOARD}.branch`;
-export const PROJECT_V1_ROUTE_BRANCH_DETAIL = `${PROJECT_V1_ROUTE_DASHBOARD}.branch.detail`;
-export const PROJECT_V1_ROUTE_BRANCH_ROLLOUT = `${PROJECT_V1_ROUTE_DASHBOARD}.branch.rollout`;
-export const PROJECT_V1_ROUTE_BRANCH_MERGE = `${PROJECT_V1_ROUTE_DASHBOARD}.branch.merge`;
-export const PROJECT_V1_ROUTE_BRANCH_REBASE = `${PROJECT_V1_ROUTE_DASHBOARD}.branch.rebase`;
export const PROJECT_V1_ROUTE_ISSUES = `${PROJECT_V1_ROUTE_DASHBOARD}.issue`;
export const PROJECT_V1_ROUTE_ISSUE_DETAIL = `${PROJECT_V1_ROUTE_DASHBOARD}.issue.detail`;
export const PROJECT_V1_ROUTE_PLAN_DETAIL = `${PROJECT_V1_ROUTE_DASHBOARD}.plan.detail`;
@@ -154,82 +149,6 @@ const projectV1Routes: RouteRecordRaw[] = [
import("@/views/project/ProjectDeploymentConfigPanel.vue"),
props: true,
},
- {
- path: "branches",
- meta: {
- overrideTitle: true,
- },
- props: true,
- children: [
- {
- path: "",
- name: PROJECT_V1_ROUTE_BRANCHES,
- meta: {
- overrideTitle: true,
- requiredProjectPermissionList: () => [
- "bb.projects.get",
- "bb.branches.list",
- ],
- },
- component: () =>
- import("@/views/project/ProjectBranchDashboard.vue"),
- props: true,
- },
- {
- path: ":branchName",
- name: PROJECT_V1_ROUTE_BRANCH_DETAIL,
- meta: {
- overrideTitle: true,
- requiredProjectPermissionList: () => [
- "bb.projects.get",
- "bb.branches.get",
- ],
- },
- component: () => import("@/views/branch/BranchDetail.vue"),
- props: true,
- },
- {
- path: ":branchName/rollout",
- name: PROJECT_V1_ROUTE_BRANCH_ROLLOUT,
- meta: {
- overrideTitle: true,
- requiredProjectPermissionList: () => [
- "bb.projects.get",
- "bb.branches.get",
- "bb.issues.create",
- ],
- },
- component: () => import("@/views/branch/BranchRollout.vue"),
- props: true,
- },
- {
- path: ":branchName/merge",
- name: PROJECT_V1_ROUTE_BRANCH_MERGE,
- meta: {
- title: () => t("branch.merge-rebase.merge-branch"),
- requiredProjectPermissionList: () => [
- "bb.projects.get",
- "bb.branches.get",
- ],
- },
- component: () => import("@/views/branch/BranchMerge.vue"),
- props: true,
- },
- {
- path: ":branchName/rebase",
- name: PROJECT_V1_ROUTE_BRANCH_REBASE,
- meta: {
- title: () => t("branch.merge-rebase.rebase-branch"),
- requiredProjectPermissionList: () => [
- "bb.projects.get",
- "bb.branches.get",
- ],
- },
- component: () => import("@/views/branch/BranchRebase.vue"),
- props: true,
- },
- ],
- },
{
path: "issues",
name: PROJECT_V1_ROUTE_ISSUES,
diff --git a/frontend/src/store/modules/branch.ts b/frontend/src/store/modules/branch.ts
deleted file mode 100644
index ba42483b5b..0000000000
--- a/frontend/src/store/modules/branch.ts
+++ /dev/null
@@ -1,172 +0,0 @@
-import { defineStore } from "pinia";
-import { ref, unref, watchEffect } from "vue";
-import { branchServiceClient } from "@/grpcweb";
-import type { MaybeRef } from "@/types";
-import type {
- MergeBranchRequest,
- Branch,
- RebaseBranchRequest,
-} from "@/types/proto/v1/branch_service";
-import { BranchView } from "@/types/proto/v1/branch_service";
-import { useCache } from "../cache";
-
-type BranchCacheKey = [string /* name */, BranchView];
-
-export const useBranchStore = defineStore("branch", () => {
- const cacheByName = useCache<BranchCacheKey, Branch>("bb.branch.by-name");
-
- // Cache utils
- const setBranchCache = (branch: Branch, view: BranchView) => {
- if (view === BranchView.BRANCH_VIEW_FULL) {
- // A FULL view branch should override its BASIC view
- cacheByName.invalidateEntity([branch.name, BranchView.BRANCH_VIEW_BASIC]);
- }
- cacheByName.setEntity([branch.name, view], branch);
- };
-
- // Actions
- const fetchBranchList = async (projectName: string) => {
- const { branches } = await branchServiceClient.listBranches({
- parent: projectName,
- view: BranchView.BRANCH_VIEW_BASIC,
- });
- branches.forEach((branch) =>
- setBranchCache(branch, BranchView.BRANCH_VIEW_BASIC)
- );
- return branches;
- };
-
- const createBranch = async (
- projectName: string,
- branchId: string,
- branch: Branch
- ) => {
- const createdBranch = await branchServiceClient.createBranch({
- parent: projectName,
- branchId: branchId,
- branch,
- });
- setBranchCache(createdBranch, BranchView.BRANCH_VIEW_FULL);
- return createdBranch;
- };
-
- const updateBranch = async (branch: Branch, updateMask: string[]) => {
- const updatedBranch = await branchServiceClient.updateBranch({
- branch,
- updateMask,
- });
- setBranchCache(updatedBranch, BranchView.BRANCH_VIEW_FULL);
- return updatedBranch;
- };
-
- const mergeBranch = async (request: MergeBranchRequest) => {
- const branch = await branchServiceClient.mergeBranch(request, {
- silent: true,
- });
- setBranchCache(branch, BranchView.BRANCH_VIEW_FULL);
- return branch;
- };
-
- const rebaseBranch = async (request: RebaseBranchRequest) => {
- const response = await branchServiceClient.rebaseBranch(request, {
- silent: true,
- });
- if (response.branch) {
- setBranchCache(response.branch, BranchView.BRANCH_VIEW_FULL);
- }
- return response;
- };
-
- const fetchBranchByName = async (
- name: string,
- useCache = true,
- silent = false
- ) => {
- if (useCache) {
- const cachedEntity = cacheByName.getEntity([
- name,
- BranchView.BRANCH_VIEW_FULL,
- ]);
- if (cachedEntity) {
- return cachedEntity;
- }
-
- // Avoid making duplicated requests concurrently.
- const cachedRequest = cacheByName.getRequest([
- name,
- BranchView.BRANCH_VIEW_FULL,
- ]);
- if (cachedRequest) {
- return cachedRequest;
- }
- }
- const request = branchServiceClient.getBranch(
- {
- name,
- },
- {
- silent,
- }
- );
- cacheByName.setRequest([name, BranchView.BRANCH_VIEW_FULL], request);
- return request;
- };
-
- /**
- *
- * @param name
- * @param view default undefined to any (FULL -> BASIC)
- * @returns
- */
- const getBranchByName = (name: string, view?: BranchView) => {
- if (view === undefined) {
- return (
- cacheByName.getEntity([name, BranchView.BRANCH_VIEW_FULL]) ??
- cacheByName.getEntity([name, BranchView.BRANCH_VIEW_BASIC])
- );
- }
- return cacheByName.getEntity([name, view]);
- };
-
- const deleteBranch = async (name: string, force = false) => {
- await branchServiceClient.deleteBranch(
- {
- name,
- force,
- },
- {
- silent: true,
- }
- );
- cacheByName.invalidateEntity([name, BranchView.BRANCH_VIEW_FULL]);
- cacheByName.invalidateEntity([name, BranchView.BRANCH_VIEW_BASIC]);
- };
-
- return {
- fetchBranchList,
- createBranch,
- updateBranch,
- mergeBranch,
- rebaseBranch,
- fetchBranchByName,
- getBranchByName,
- deleteBranch,
- };
-});
-
-export const useBranchListByProject = (project: MaybeRef<string>) => {
- const store = useBranchStore();
- const ready = ref(false);
- const branchList = ref<Branch[]>([]);
-
- watchEffect(() => {
- ready.value = false;
- branchList.value = [];
- store.fetchBranchList(unref(project)).then((response) => {
- ready.value = true;
- branchList.value = response;
- });
- });
-
- return { branchList, ready };
-};
diff --git a/frontend/src/store/modules/index.ts b/frontend/src/store/modules/index.ts
index aaf74d253e..4eaf1ef7b8 100644
--- a/frontend/src/store/modules/index.ts
+++ b/frontend/src/store/modules/index.ts
@@ -16,7 +16,6 @@ export * from "./slowQuery";
export * from "./role";
export * from "./dbGroup";
export * from "./utils";
-export * from "./branch";
export * from "./release";
export * from "./revision";
export * from "./rollout";
diff --git a/frontend/src/store/modules/v1/changelist.ts b/frontend/src/store/modules/v1/changelist.ts
index 305a7e0db5..4952a6a017 100644
--- a/frontend/src/store/modules/v1/changelist.ts
+++ b/frontend/src/store/modules/v1/changelist.ts
@@ -10,10 +10,8 @@ import type {
} from "@/types/proto/v1/changelist_service";
import {
ResourceComposer,
- isBranchChangeSource,
isChangelogChangeSource,
} from "@/utils";
-import { useBranchStore } from "../branch";
import { useChangelogStore } from "./changelog";
import { useSheetV1Store } from "./sheet";
@@ -103,10 +101,6 @@ export const useChangelistStore = defineStore("changelist", () => {
composer.collect(source, () =>
useChangelogStore().getOrFetchChangelogByName(source)
);
- } else if (isBranchChangeSource(change)) {
- composer.collect(source, () =>
- useBranchStore().fetchBranchByName(source, true /* useCache */)
- );
} else {
// Raw SQL, no need to compose
}
diff --git a/frontend/src/types/proto/google/protobuf/descriptor.ts b/frontend/src/types/proto/google/protobuf/descriptor.ts
index ae3f877dc7..2fdf22f5e2 100644
--- a/frontend/src/types/proto/google/protobuf/descriptor.ts
+++ b/frontend/src/types/proto/google/protobuf/descriptor.ts
@@ -36,7 +36,7 @@ export enum Edition {
EDITION_2024 = "EDITION_2024",
/**
* EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be
- * used or relyed on outside of tests.
+ * used or relied on outside of tests.
*/
EDITION_1_TEST_ONLY = "EDITION_1_TEST_ONLY",
EDITION_2_TEST_ONLY = "EDITION_2_TEST_ONLY",
@@ -1093,12 +1093,13 @@ export interface MessageOptions {
export interface FieldOptions {
/**
+ * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead.
* The ctype option instructs the C++ code generator to use a different
* representation of the field than it normally would. See the specific
* options below. This option is only implemented to support use of
* [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of
- * type "bytes" in the open source release -- sorry, we'll try to include
- * other types in a future version!
+ * type "bytes" in the open source release.
+ * TODO: make ctype actually deprecated.
*/
ctype?:
| FieldOptions_CType
@@ -1314,11 +1315,7 @@ export function fieldOptions_JSTypeToNumber(object: FieldOptions_JSType): number
}
}
-/**
- * If set to RETENTION_SOURCE, the option will be omitted from the binary.
- * Note: as of January 2023, support for this is in progress and does not yet
- * have an effect (b/264593489).
- */
+/** If set to RETENTION_SOURCE, the option will be omitted from the binary. */
export enum FieldOptions_OptionRetention {
RETENTION_UNKNOWN = "RETENTION_UNKNOWN",
RETENTION_RUNTIME = "RETENTION_RUNTIME",
@@ -1375,8 +1372,7 @@ export function fieldOptions_OptionRetentionToNumber(object: FieldOptions_Option
/**
* This indicates the types of entities that the field may apply to when used
* as an option. If it is unset, then the field may be freely used as an
- * option on any kind of entity. Note: as of January 2023, support for this is
- * in progress and does not yet have an effect (b/264593489).
+ * option on any kind of entity.
*/
export enum FieldOptions_OptionTargetType {
TARGET_TYPE_UNKNOWN = "TARGET_TYPE_UNKNOWN",
diff --git a/frontend/src/types/proto/v1/branch_service.ts b/frontend/src/types/proto/v1/branch_service.ts
index 2785775d8e..d7f281396d 100644
--- a/frontend/src/types/proto/v1/branch_service.ts
+++ b/frontend/src/types/proto/v1/branch_service.ts
@@ -7,322 +7,11 @@
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import Long from "long";
-import { Empty } from "../google/protobuf/empty";
-import { FieldMask } from "../google/protobuf/field_mask";
-import { Timestamp } from "../google/protobuf/timestamp";
import { Engine, engineFromJSON, engineToJSON, engineToNumber } from "./common";
import { DatabaseMetadata } from "./database_service";
export const protobufPackage = "bytebase.v1";
-export enum BranchView {
- /**
- * BRANCH_VIEW_UNSPECIFIED - The default / unset value.
- * The API will default to the BASIC view.
- */
- BRANCH_VIEW_UNSPECIFIED = "BRANCH_VIEW_UNSPECIFIED",
- /** BRANCH_VIEW_BASIC - Exclude schema, baseline_schema. */
- BRANCH_VIEW_BASIC = "BRANCH_VIEW_BASIC",
- /** BRANCH_VIEW_FULL - Include everything. */
- BRANCH_VIEW_FULL = "BRANCH_VIEW_FULL",
- UNRECOGNIZED = "UNRECOGNIZED",
-}
-
-export function branchViewFromJSON(object: any): BranchView {
- switch (object) {
- case 0:
- case "BRANCH_VIEW_UNSPECIFIED":
- return BranchView.BRANCH_VIEW_UNSPECIFIED;
- case 1:
- case "BRANCH_VIEW_BASIC":
- return BranchView.BRANCH_VIEW_BASIC;
- case 2:
- case "BRANCH_VIEW_FULL":
- return BranchView.BRANCH_VIEW_FULL;
- case -1:
- case "UNRECOGNIZED":
- default:
- return BranchView.UNRECOGNIZED;
- }
-}
-
-export function branchViewToJSON(object: BranchView): string {
- switch (object) {
- case BranchView.BRANCH_VIEW_UNSPECIFIED:
- return "BRANCH_VIEW_UNSPECIFIED";
- case BranchView.BRANCH_VIEW_BASIC:
- return "BRANCH_VIEW_BASIC";
- case BranchView.BRANCH_VIEW_FULL:
- return "BRANCH_VIEW_FULL";
- case BranchView.UNRECOGNIZED:
- default:
- return "UNRECOGNIZED";
- }
-}
-
-export function branchViewToNumber(object: BranchView): number {
- switch (object) {
- case BranchView.BRANCH_VIEW_UNSPECIFIED:
- return 0;
- case BranchView.BRANCH_VIEW_BASIC:
- return 1;
- case BranchView.BRANCH_VIEW_FULL:
- return 2;
- case BranchView.UNRECOGNIZED:
- default:
- return -1;
- }
-}
-
-export interface Branch {
- /**
- * The name of the branch.
- * Format: projects/{project}/branches/{branch}
- * {branch} should be the id of a sheet.
- */
- name: string;
- /** The branch ID. */
- branchId: string;
- /** The schema of branch. AKA sheet's statement. */
- schema: string;
- /** The metadata of the current editing schema. */
- schemaMetadata:
- | DatabaseMetadata
- | undefined;
- /** The baseline schema. */
- baselineSchema: string;
- /** The metadata of the baseline schema. */
- baselineSchemaMetadata:
- | DatabaseMetadata
- | undefined;
- /** The database engine of the branch. */
- engine: Engine;
- /**
- * The name of the baseline database.
- * Format: instances/{instance}/databases/{database}
- */
- baselineDatabase: string;
- /**
- * The name of the parent branch.
- * For main branch, it's empty.
- * For child branch, its format will be: projects/{project}/branches/{branch}
- */
- parentBranch: string;
- /** The etag of the branch. */
- etag: string;
- /**
- * The creator of the branch.
- * Format: users/{email}
- */
- creator: string;
- /**
- * The updater of the branch.
- * Format: users/{email}
- */
- updater: string;
- /** The timestamp when the branch was created. */
- createTime:
- | Timestamp
- | undefined;
- /** The timestamp when the branch was last updated. */
- updateTime: Timestamp | undefined;
-}
-
-export interface GetBranchRequest {
- /**
- * The name of the branch to retrieve.
- * Format: projects/{project}/branches/{branch}
- */
- name: string;
-}
-
-export interface ListBranchesRequest {
- /**
- * The parent resource of the branch.
- * Format: projects/{project}
- */
- parent: string;
- /** To filter the search result. */
- filter: string;
- /**
- * Not used.
- * The maximum number of branches to return. The service may return fewer than
- * this value.
- * If unspecified, at most 50 branches will be returned.
- * The maximum value is 1000; values above 1000 will be coerced to 1000.
- */
- pageSize: number;
- /**
- * Not used.
- * A page token, received from a previous `ListBranches` call.
- * Provide this to retrieve the subsequent page.
- *
- * When paginating, all other parameters provided to `ListBranches` must match
- * the call that provided the page token.
- */
- pageToken: string;
- view: BranchView;
-}
-
-export interface ListBranchesResponse {
- /** The branches from the specified request. */
- branches: Branch[];
- /**
- * A token, which can be sent as `page_token` to retrieve the next page.
- * If this field is omitted, there are no subsequent pages.
- */
- nextPageToken: string;
-}
-
-export interface CreateBranchRequest {
- /**
- * The parent, which owns this collection of branches.
- * Format: project/{project}
- */
- parent: string;
- branch:
- | Branch
- | undefined;
- /**
- * The ID to use for the branch, which will become the final component of
- * the branch's resource name.
- * Format: [a-zA-Z][a-zA-Z0-9-_/]+.
- */
- branchId: string;
-}
-
-export interface UpdateBranchRequest {
- /**
- * The branch to update.
- *
- * The branch's `name` field is used to identify the branch to update.
- * Format: projects/{project}/branches/{branch}
- */
- branch:
- | Branch
- | undefined;
- /** The list of fields to update. */
- updateMask:
- | string[]
- | undefined;
- /**
- * The current etag of the branch.
- * If an etag is provided and does not match the current etag of the branch,
- * the call will be blocked and an ABORTED error will be returned.
- * The etag should be specified for using merged_schema. The etag should be the etag from named branch.
- */
- etag: string;
-}
-
-export interface MergeBranchRequest {
- /**
- * The name of the base branch to merge to.
- * Format: projects/{project}/branches/{branch}
- */
- name: string;
- /**
- * The head branch to merge from.
- * Format: projects/{project}/branches/{branch}
- */
- headBranch: string;
- /**
- * The current etag of the branch.
- * If an etag is provided and does not match the current etag of the branch,
- * the call will be blocked and an ABORTED error will be returned.
- * The etag should be the etag from named branch.
- */
- etag: string;
- /** validate_only determines if the merge can occur seamlessly without any conflicts. */
- validateOnly: boolean;
-}
-
-export interface RebaseBranchRequest {
- /**
- * The name of the base branch to merge to.
- * Format: projects/{project}/branches/{branch}
- */
- name: string;
- /**
- * The database (remote upstream) used to rebase.
- * We use its schema as baseline and reapply the difference between base and head of the named branch.
- * Format: instances/{instance}/databases/{database}
- */
- sourceDatabase: string;
- /**
- * The branch (remote upstream) used to rebase. We use its head as baseline.
- * We use its head schema as baseline and reapply the difference between base and head of the named branch.
- * Format: projects/{project}/branches/{branch}
- */
- sourceBranch: string;
- /**
- * For failed merge, we will pass in this addition merged schema and use it for head.
- * This has to be set together with source_database or source_branch.
- */
- mergedSchema: string;
- /**
- * The current etag of the branch.
- * If an etag is provided and does not match the current etag of the branch,
- * the call will be blocked and an ABORTED error will be returned.
- * The etag should be specified for using merged_schema. The etag should be the etag from named branch.
- */
- etag: string;
- /** validate_only determines if the rebase can occur seamlessly without any conflicts. */
- validateOnly: boolean;
-}
-
-export interface RebaseBranchResponse {
- /** The rebased branch when rebase occurs seamlessly. */
- branch?:
- | Branch
- | undefined;
- /**
- * The conflict schema when rebase has conflicts.
- * The conflict section is enclosed by the following.
- * <<<<< HEAD
- * ====
- * >>>>> main
- */
- conflictSchema?: string | undefined;
-}
-
-export interface DeleteBranchRequest {
- /**
- * The name of the branch to delete.
- * Format: projects/{project}/branches/{branch}
- */
- name: string;
- /**
- * By default, server will return `FAILED_PRECONDITION` error
- * if delete the branch that is parent of other branches.
- * If true, server will delete the branch forcely but will not delete its children branches.
- */
- force: boolean;
-}
-
-export interface DiffDatabaseRequest {
- /** The name of branch. */
- name: string;
- /** The name of the databsae to merge the branch to. */
- database: string;
-}
-
-export interface DiffDatabaseResponse {
- /** The schema diff when merge occurs seamlessly. */
- diff: string;
- /** The merged schema if there is no conflict. */
- schema?:
- | string
- | undefined;
- /**
- * The conflict schema when rebase has conflicts.
- * The conflict section is enclosed by the following.
- * <<<<< HEAD
- * ====
- * >>>>> main
- */
- conflictSchema?: string | undefined;
-}
-
export interface DiffMetadataRequest {
/** The metadata of the source schema. */
sourceMetadata:
@@ -343,76 +32,36 @@ export interface DiffMetadataResponse {
diff: string;
}
-function createBaseBranch(): Branch {
+function createBaseDiffMetadataRequest(): DiffMetadataRequest {
return {
- name: "",
- branchId: "",
- schema: "",
- schemaMetadata: undefined,
- baselineSchema: "",
- baselineSchemaMetadata: undefined,
+ sourceMetadata: undefined,
+ targetMetadata: undefined,
engine: Engine.ENGINE_UNSPECIFIED,
- baselineDatabase: "",
- parentBranch: "",
- etag: "",
- creator: "",
- updater: "",
- createTime: undefined,
- updateTime: undefined,
+ classificationFromConfig: false,
};
}
-export const Branch: MessageFns<Branch> = {
- encode(message: Branch, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.name !== "") {
- writer.uint32(10).string(message.name);
- }
- if (message.branchId !== "") {
- writer.uint32(18).string(message.branchId);
- }
- if (message.schema !== "") {
- writer.uint32(26).string(message.schema);
- }
- if (message.schemaMetadata !== undefined) {
- DatabaseMetadata.encode(message.schemaMetadata, writer.uint32(34).fork()).join();
- }
- if (message.baselineSchema !== "") {
- writer.uint32(42).string(message.baselineSchema);
+export const DiffMetadataRequest: MessageFns<DiffMetadataRequest> = {
+ encode(message: DiffMetadataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.sourceMetadata !== undefined) {
+ DatabaseMetadata.encode(message.sourceMetadata, writer.uint32(10).fork()).join();
}
- if (message.baselineSchemaMetadata !== undefined) {
- DatabaseMetadata.encode(message.baselineSchemaMetadata, writer.uint32(50).fork()).join();
+ if (message.targetMetadata !== undefined) {
+ DatabaseMetadata.encode(message.targetMetadata, writer.uint32(18).fork()).join();
}
if (message.engine !== Engine.ENGINE_UNSPECIFIED) {
- writer.uint32(56).int32(engineToNumber(message.engine));
- }
- if (message.baselineDatabase !== "") {
- writer.uint32(66).string(message.baselineDatabase);
- }
- if (message.parentBranch !== "") {
- writer.uint32(74).string(message.parentBranch);
- }
- if (message.etag !== "") {
- writer.uint32(82).string(message.etag);
- }
- if (message.creator !== "") {
- writer.uint32(90).string(message.creator);
- }
- if (message.updater !== "") {
- writer.uint32(98).string(message.updater);
- }
- if (message.createTime !== undefined) {
- Timestamp.encode(message.createTime, writer.uint32(106).fork()).join();
+ writer.uint32(24).int32(engineToNumber(message.engine));
}
- if (message.updateTime !== undefined) {
- Timestamp.encode(message.updateTime, writer.uint32(114).fork()).join();
+ if (message.classificationFromConfig !== false) {
+ writer.uint32(32).bool(message.classificationFromConfig);
}
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): Branch {
+ decode(input: BinaryReader | Uint8Array, length?: number): DiffMetadataRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseBranch();
+ const message = createBaseDiffMetadataRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -421,7 +70,7 @@ export const Branch: MessageFns<Branch> = {
break;
}
- message.name = reader.string();
+ message.sourceMetadata = DatabaseMetadata.decode(reader, reader.uint32());
continue;
}
case 2: {
@@ -429,103 +78,23 @@ export const Branch: MessageFns<Branch> = {
break;
}
- message.branchId = reader.string();
+ message.targetMetadata = DatabaseMetadata.decode(reader, reader.uint32());
continue;
}
case 3: {
- if (tag !== 26) {
- break;
- }
-
- message.schema = reader.string();
- continue;
- }
- case 4: {
- if (tag !== 34) {
- break;
- }
-
- message.schemaMetadata = DatabaseMetadata.decode(reader, reader.uint32());
- continue;
- }
- case 5: {
- if (tag !== 42) {
- break;
- }
-
- message.baselineSchema = reader.string();
- continue;
- }
- case 6: {
- if (tag !== 50) {
- break;
- }
-
- message.baselineSchemaMetadata = DatabaseMetadata.decode(reader, reader.uint32());
- continue;
- }
- case 7: {
- if (tag !== 56) {
+ if (tag !== 24) {
break;
}
message.engine = engineFromJSON(reader.int32());
continue;
}
- case 8: {
- if (tag !== 66) {
- break;
- }
-
- message.baselineDatabase = reader.string();
- continue;
- }
- case 9: {
- if (tag !== 74) {
- break;
- }
-
- message.parentBranch = reader.string();
- continue;
- }
- case 10: {
- if (tag !== 82) {
- break;
- }
-
- message.etag = reader.string();
- continue;
- }
- case 11: {
- if (tag !== 90) {
- break;
- }
-
- message.creator = reader.string();
- continue;
- }
- case 12: {
- if (tag !== 98) {
- break;
- }
-
- message.updater = reader.string();
- continue;
- }
- case 13: {
- if (tag !== 106) {
- break;
- }
-
- message.createTime = Timestamp.decode(reader, reader.uint32());
- continue;
- }
- case 14: {
- if (tag !== 114) {
+ case 4: {
+ if (tag !== 32) {
break;
}
- message.updateTime = Timestamp.decode(reader, reader.uint32());
+ message.classificationFromConfig = reader.bool();
continue;
}
}
@@ -537,122 +106,67 @@ export const Branch: MessageFns<Branch> = {
return message;
},
- fromJSON(object: any): Branch {
+ fromJSON(object: any): DiffMetadataRequest {
return {
- name: isSet(object.name) ? globalThis.String(object.name) : "",
- branchId: isSet(object.branchId) ? globalThis.String(object.branchId) : "",
- schema: isSet(object.schema) ? globalThis.String(object.schema) : "",
- schemaMetadata: isSet(object.schemaMetadata) ? DatabaseMetadata.fromJSON(object.schemaMetadata) : undefined,
- baselineSchema: isSet(object.baselineSchema) ? globalThis.String(object.baselineSchema) : "",
- baselineSchemaMetadata: isSet(object.baselineSchemaMetadata)
- ? DatabaseMetadata.fromJSON(object.baselineSchemaMetadata)
- : undefined,
+ sourceMetadata: isSet(object.sourceMetadata) ? DatabaseMetadata.fromJSON(object.sourceMetadata) : undefined,
+ targetMetadata: isSet(object.targetMetadata) ? DatabaseMetadata.fromJSON(object.targetMetadata) : undefined,
engine: isSet(object.engine) ? engineFromJSON(object.engine) : Engine.ENGINE_UNSPECIFIED,
- baselineDatabase: isSet(object.baselineDatabase) ? globalThis.String(object.baselineDatabase) : "",
- parentBranch: isSet(object.parentBranch) ? globalThis.String(object.parentBranch) : "",
- etag: isSet(object.etag) ? globalThis.String(object.etag) : "",
- creator: isSet(object.creator) ? globalThis.String(object.creator) : "",
- updater: isSet(object.updater) ? globalThis.String(object.updater) : "",
- createTime: isSet(object.createTime) ? fromJsonTimestamp(object.createTime) : undefined,
- updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined,
+ classificationFromConfig: isSet(object.classificationFromConfig)
+ ? globalThis.Boolean(object.classificationFromConfig)
+ : false,
};
},
- toJSON(message: Branch): unknown {
+ toJSON(message: DiffMetadataRequest): unknown {
const obj: any = {};
- if (message.name !== "") {
- obj.name = message.name;
- }
- if (message.branchId !== "") {
- obj.branchId = message.branchId;
- }
- if (message.schema !== "") {
- obj.schema = message.schema;
- }
- if (message.schemaMetadata !== undefined) {
- obj.schemaMetadata = DatabaseMetadata.toJSON(message.schemaMetadata);
- }
- if (message.baselineSchema !== "") {
- obj.baselineSchema = message.baselineSchema;
+ if (message.sourceMetadata !== undefined) {
+ obj.sourceMetadata = DatabaseMetadata.toJSON(message.sourceMetadata);
}
- if (message.baselineSchemaMetadata !== undefined) {
- obj.baselineSchemaMetadata = DatabaseMetadata.toJSON(message.baselineSchemaMetadata);
+ if (message.targetMetadata !== undefined) {
+ obj.targetMetadata = DatabaseMetadata.toJSON(message.targetMetadata);
}
if (message.engine !== Engine.ENGINE_UNSPECIFIED) {
obj.engine = engineToJSON(message.engine);
}
- if (message.baselineDatabase !== "") {
- obj.baselineDatabase = message.baselineDatabase;
- }
- if (message.parentBranch !== "") {
- obj.parentBranch = message.parentBranch;
- }
- if (message.etag !== "") {
- obj.etag = message.etag;
- }
- if (message.creator !== "") {
- obj.creator = message.creator;
- }
- if (message.updater !== "") {
- obj.updater = message.updater;
- }
- if (message.createTime !== undefined) {
- obj.createTime = fromTimestamp(message.createTime).toISOString();
- }
- if (message.updateTime !== undefined) {
- obj.updateTime = fromTimestamp(message.updateTime).toISOString();
+ if (message.classificationFromConfig !== false) {
+ obj.classificationFromConfig = message.classificationFromConfig;
}
return obj;
},
- create(base?: DeepPartial<Branch>): Branch {
- return Branch.fromPartial(base ?? {});
+ create(base?: DeepPartial<DiffMetadataRequest>): DiffMetadataRequest {
+ return DiffMetadataRequest.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<Branch>): Branch {
- const message = createBaseBranch();
- message.name = object.name ?? "";
- message.branchId = object.branchId ?? "";
- message.schema = object.schema ?? "";
- message.schemaMetadata = (object.schemaMetadata !== undefined && object.schemaMetadata !== null)
- ? DatabaseMetadata.fromPartial(object.schemaMetadata)
- : undefined;
- message.baselineSchema = object.baselineSchema ?? "";
- message.baselineSchemaMetadata =
- (object.baselineSchemaMetadata !== undefined && object.baselineSchemaMetadata !== null)
- ? DatabaseMetadata.fromPartial(object.baselineSchemaMetadata)
- : undefined;
- message.engine = object.engine ?? Engine.ENGINE_UNSPECIFIED;
- message.baselineDatabase = object.baselineDatabase ?? "";
- message.parentBranch = object.parentBranch ?? "";
- message.etag = object.etag ?? "";
- message.creator = object.creator ?? "";
- message.updater = object.updater ?? "";
- message.createTime = (object.createTime !== undefined && object.createTime !== null)
- ? Timestamp.fromPartial(object.createTime)
+ fromPartial(object: DeepPartial<DiffMetadataRequest>): DiffMetadataRequest {
+ const message = createBaseDiffMetadataRequest();
+ message.sourceMetadata = (object.sourceMetadata !== undefined && object.sourceMetadata !== null)
+ ? DatabaseMetadata.fromPartial(object.sourceMetadata)
: undefined;
- message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
- ? Timestamp.fromPartial(object.updateTime)
+ message.targetMetadata = (object.targetMetadata !== undefined && object.targetMetadata !== null)
+ ? DatabaseMetadata.fromPartial(object.targetMetadata)
: undefined;
+ message.engine = object.engine ?? Engine.ENGINE_UNSPECIFIED;
+ message.classificationFromConfig = object.classificationFromConfig ?? false;
return message;
},
};
-function createBaseGetBranchRequest(): GetBranchRequest {
- return { name: "" };
+function createBaseDiffMetadataResponse(): DiffMetadataResponse {
+ return { diff: "" };
}
-export const GetBranchRequest: MessageFns<GetBranchRequest> = {
- encode(message: GetBranchRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.name !== "") {
- writer.uint32(10).string(message.name);
+export const DiffMetadataResponse: MessageFns<DiffMetadataResponse> = {
+ encode(message: DiffMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.diff !== "") {
+ writer.uint32(10).string(message.diff);
}
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): GetBranchRequest {
+ decode(input: BinaryReader | Uint8Array, length?: number): DiffMetadataResponse {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseGetBranchRequest();
+ const message = createBaseDiffMetadataResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -661,7 +175,7 @@ export const GetBranchRequest: MessageFns<GetBranchRequest> = {
break;
}
- message.name = reader.string();
+ message.diff = reader.string();
continue;
}
}
@@ -673,1640 +187,88 @@ export const GetBranchRequest: MessageFns<GetBranchRequest> = {
return message;
},
- fromJSON(object: any): GetBranchRequest {
- return { name: isSet(object.name) ? globalThis.String(object.name) : "" };
+ fromJSON(object: any): DiffMetadataResponse {
+ return { diff: isSet(object.diff) ? globalThis.String(object.diff) : "" };
},
- toJSON(message: GetBranchRequest): unknown {
+ toJSON(message: DiffMetadataResponse): unknown {
const obj: any = {};
- if (message.name !== "") {
- obj.name = message.name;
+ if (message.diff !== "") {
+ obj.diff = message.diff;
}
return obj;
},
- create(base?: DeepPartial<GetBranchRequest>): GetBranchRequest {
- return GetBranchRequest.fromPartial(base ?? {});
+ create(base?: DeepPartial<DiffMetadataResponse>): DiffMetadataResponse {
+ return DiffMetadataResponse.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<GetBranchRequest>): GetBranchRequest {
- const message = createBaseGetBranchRequest();
- message.name = object.name ?? "";
+ fromPartial(object: DeepPartial<DiffMetadataResponse>): DiffMetadataResponse {
+ const message = createBaseDiffMetadataResponse();
+ message.diff = object.diff ?? "";
return message;
},
};
-function createBaseListBranchesRequest(): ListBranchesRequest {
- return { parent: "", filter: "", pageSize: 0, pageToken: "", view: BranchView.BRANCH_VIEW_UNSPECIFIED };
-}
-
-export const ListBranchesRequest: MessageFns<ListBranchesRequest> = {
- encode(message: ListBranchesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.parent !== "") {
- writer.uint32(10).string(message.parent);
- }
- if (message.filter !== "") {
- writer.uint32(18).string(message.filter);
- }
- if (message.pageSize !== 0) {
- writer.uint32(24).int32(message.pageSize);
- }
- if (message.pageToken !== "") {
- writer.uint32(34).string(message.pageToken);
- }
- if (message.view !== BranchView.BRANCH_VIEW_UNSPECIFIED) {
- writer.uint32(40).int32(branchViewToNumber(message.view));
- }
- return writer;
+export type BranchServiceDefinition = typeof BranchServiceDefinition;
+export const BranchServiceDefinition = {
+ name: "BranchService",
+ fullName: "bytebase.v1.BranchService",
+ methods: {
+ diffMetadata: {
+ name: "DiffMetadata",
+ requestType: DiffMetadataRequest,
+ requestStream: false,
+ responseType: DiffMetadataResponse,
+ responseStream: false,
+ options: {
+ _unknownFields: {
+ 800000: [new Uint8Array([1])],
+ 578365826: [
+ new Uint8Array([
+ 34,
+ 58,
+ 1,
+ 42,
+ 34,
+ 29,
+ 47,
+ 118,
+ 49,
+ 47,
+ 115,
+ 99,
+ 104,
+ 101,
+ 109,
+ 97,
+ 68,
+ 101,
+ 115,
+ 105,
+ 103,
+ 110,
+ 58,
+ 100,
+ 105,
+ 102,
+ 102,
+ 77,
+ 101,
+ 116,
+ 97,
+ 100,
+ 97,
+ 116,
+ 97,
+ ]),
+ ],
+ },
+ },
+ },
},
+} as const;
- decode(input: BinaryReader | Uint8Array, length?: number): ListBranchesRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseListBranchesRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.parent = reader.string();
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.filter = reader.string();
- continue;
- }
- case 3: {
- if (tag !== 24) {
- break;
- }
-
- message.pageSize = reader.int32();
- continue;
- }
- case 4: {
- if (tag !== 34) {
- break;
- }
-
- message.pageToken = reader.string();
- continue;
- }
- case 5: {
- if (tag !== 40) {
- break;
- }
-
- message.view = branchViewFromJSON(reader.int32());
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): ListBranchesRequest {
- return {
- parent: isSet(object.parent) ? globalThis.String(object.parent) : "",
- filter: isSet(object.filter) ? globalThis.String(object.filter) : "",
- pageSize: isSet(object.pageSize) ? globalThis.Number(object.pageSize) : 0,
- pageToken: isSet(object.pageToken) ? globalThis.String(object.pageToken) : "",
- view: isSet(object.view) ? branchViewFromJSON(object.view) : BranchView.BRANCH_VIEW_UNSPECIFIED,
- };
- },
-
- toJSON(message: ListBranchesRequest): unknown {
- const obj: any = {};
- if (message.parent !== "") {
- obj.parent = message.parent;
- }
- if (message.filter !== "") {
- obj.filter = message.filter;
- }
- if (message.pageSize !== 0) {
- obj.pageSize = Math.round(message.pageSize);
- }
- if (message.pageToken !== "") {
- obj.pageToken = message.pageToken;
- }
- if (message.view !== BranchView.BRANCH_VIEW_UNSPECIFIED) {
- obj.view = branchViewToJSON(message.view);
- }
- return obj;
- },
-
- create(base?: DeepPartial<ListBranchesRequest>): ListBranchesRequest {
- return ListBranchesRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<ListBranchesRequest>): ListBranchesRequest {
- const message = createBaseListBranchesRequest();
- message.parent = object.parent ?? "";
- message.filter = object.filter ?? "";
- message.pageSize = object.pageSize ?? 0;
- message.pageToken = object.pageToken ?? "";
- message.view = object.view ?? BranchView.BRANCH_VIEW_UNSPECIFIED;
- return message;
- },
-};
-
-function createBaseListBranchesResponse(): ListBranchesResponse {
- return { branches: [], nextPageToken: "" };
-}
-
-export const ListBranchesResponse: MessageFns<ListBranchesResponse> = {
- encode(message: ListBranchesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- for (const v of message.branches) {
- Branch.encode(v!, writer.uint32(10).fork()).join();
- }
- if (message.nextPageToken !== "") {
- writer.uint32(18).string(message.nextPageToken);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): ListBranchesResponse {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseListBranchesResponse();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.branches.push(Branch.decode(reader, reader.uint32()));
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.nextPageToken = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): ListBranchesResponse {
- return {
- branches: globalThis.Array.isArray(object?.branches) ? object.branches.map((e: any) => Branch.fromJSON(e)) : [],
- nextPageToken: isSet(object.nextPageToken) ? globalThis.String(object.nextPageToken) : "",
- };
- },
-
- toJSON(message: ListBranchesResponse): unknown {
- const obj: any = {};
- if (message.branches?.length) {
- obj.branches = message.branches.map((e) => Branch.toJSON(e));
- }
- if (message.nextPageToken !== "") {
- obj.nextPageToken = message.nextPageToken;
- }
- return obj;
- },
-
- create(base?: DeepPartial<ListBranchesResponse>): ListBranchesResponse {
- return ListBranchesResponse.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<ListBranchesResponse>): ListBranchesResponse {
- const message = createBaseListBranchesResponse();
- message.branches = object.branches?.map((e) => Branch.fromPartial(e)) || [];
- message.nextPageToken = object.nextPageToken ?? "";
- return message;
- },
-};
-
-function createBaseCreateBranchRequest(): CreateBranchRequest {
- return { parent: "", branch: undefined, branchId: "" };
-}
-
-export const CreateBranchRequest: MessageFns<CreateBranchRequest> = {
- encode(message: CreateBranchRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.parent !== "") {
- writer.uint32(10).string(message.parent);
- }
- if (message.branch !== undefined) {
- Branch.encode(message.branch, writer.uint32(18).fork()).join();
- }
- if (message.branchId !== "") {
- writer.uint32(26).string(message.branchId);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): CreateBranchRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseCreateBranchRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.parent = reader.string();
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.branch = Branch.decode(reader, reader.uint32());
- continue;
- }
- case 3: {
- if (tag !== 26) {
- break;
- }
-
- message.branchId = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): CreateBranchRequest {
- return {
- parent: isSet(object.parent) ? globalThis.String(object.parent) : "",
- branch: isSet(object.branch) ? Branch.fromJSON(object.branch) : undefined,
- branchId: isSet(object.branchId) ? globalThis.String(object.branchId) : "",
- };
- },
-
- toJSON(message: CreateBranchRequest): unknown {
- const obj: any = {};
- if (message.parent !== "") {
- obj.parent = message.parent;
- }
- if (message.branch !== undefined) {
- obj.branch = Branch.toJSON(message.branch);
- }
- if (message.branchId !== "") {
- obj.branchId = message.branchId;
- }
- return obj;
- },
-
- create(base?: DeepPartial<CreateBranchRequest>): CreateBranchRequest {
- return CreateBranchRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<CreateBranchRequest>): CreateBranchRequest {
- const message = createBaseCreateBranchRequest();
- message.parent = object.parent ?? "";
- message.branch = (object.branch !== undefined && object.branch !== null)
- ? Branch.fromPartial(object.branch)
- : undefined;
- message.branchId = object.branchId ?? "";
- return message;
- },
-};
-
-function createBaseUpdateBranchRequest(): UpdateBranchRequest {
- return { branch: undefined, updateMask: undefined, etag: "" };
-}
-
-export const UpdateBranchRequest: MessageFns<UpdateBranchRequest> = {
- encode(message: UpdateBranchRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.branch !== undefined) {
- Branch.encode(message.branch, writer.uint32(10).fork()).join();
- }
- if (message.updateMask !== undefined) {
- FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join();
- }
- if (message.etag !== "") {
- writer.uint32(26).string(message.etag);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): UpdateBranchRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseUpdateBranchRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.branch = Branch.decode(reader, reader.uint32());
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));
- continue;
- }
- case 3: {
- if (tag !== 26) {
- break;
- }
-
- message.etag = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): UpdateBranchRequest {
- return {
- branch: isSet(object.branch) ? Branch.fromJSON(object.branch) : undefined,
- updateMask: isSet(object.updateMask) ? FieldMask.unwrap(FieldMask.fromJSON(object.updateMask)) : undefined,
- etag: isSet(object.etag) ? globalThis.String(object.etag) : "",
- };
- },
-
- toJSON(message: UpdateBranchRequest): unknown {
- const obj: any = {};
- if (message.branch !== undefined) {
- obj.branch = Branch.toJSON(message.branch);
- }
- if (message.updateMask !== undefined) {
- obj.updateMask = FieldMask.toJSON(FieldMask.wrap(message.updateMask));
- }
- if (message.etag !== "") {
- obj.etag = message.etag;
- }
- return obj;
- },
-
- create(base?: DeepPartial<UpdateBranchRequest>): UpdateBranchRequest {
- return UpdateBranchRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<UpdateBranchRequest>): UpdateBranchRequest {
- const message = createBaseUpdateBranchRequest();
- message.branch = (object.branch !== undefined && object.branch !== null)
- ? Branch.fromPartial(object.branch)
- : undefined;
- message.updateMask = object.updateMask ?? undefined;
- message.etag = object.etag ?? "";
- return message;
- },
-};
-
-function createBaseMergeBranchRequest(): MergeBranchRequest {
- return { name: "", headBranch: "", etag: "", validateOnly: false };
-}
-
-export const MergeBranchRequest: MessageFns<MergeBranchRequest> = {
- encode(message: MergeBranchRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.name !== "") {
- writer.uint32(10).string(message.name);
- }
- if (message.headBranch !== "") {
- writer.uint32(18).string(message.headBranch);
- }
- if (message.etag !== "") {
- writer.uint32(26).string(message.etag);
- }
- if (message.validateOnly !== false) {
- writer.uint32(32).bool(message.validateOnly);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): MergeBranchRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseMergeBranchRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.name = reader.string();
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.headBranch = reader.string();
- continue;
- }
- case 3: {
- if (tag !== 26) {
- break;
- }
-
- message.etag = reader.string();
- continue;
- }
- case 4: {
- if (tag !== 32) {
- break;
- }
-
- message.validateOnly = reader.bool();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): MergeBranchRequest {
- return {
- name: isSet(object.name) ? globalThis.String(object.name) : "",
- headBranch: isSet(object.headBranch) ? globalThis.String(object.headBranch) : "",
- etag: isSet(object.etag) ? globalThis.String(object.etag) : "",
- validateOnly: isSet(object.validateOnly) ? globalThis.Boolean(object.validateOnly) : false,
- };
- },
-
- toJSON(message: MergeBranchRequest): unknown {
- const obj: any = {};
- if (message.name !== "") {
- obj.name = message.name;
- }
- if (message.headBranch !== "") {
- obj.headBranch = message.headBranch;
- }
- if (message.etag !== "") {
- obj.etag = message.etag;
- }
- if (message.validateOnly !== false) {
- obj.validateOnly = message.validateOnly;
- }
- return obj;
- },
-
- create(base?: DeepPartial<MergeBranchRequest>): MergeBranchRequest {
- return MergeBranchRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<MergeBranchRequest>): MergeBranchRequest {
- const message = createBaseMergeBranchRequest();
- message.name = object.name ?? "";
- message.headBranch = object.headBranch ?? "";
- message.etag = object.etag ?? "";
- message.validateOnly = object.validateOnly ?? false;
- return message;
- },
-};
-
-function createBaseRebaseBranchRequest(): RebaseBranchRequest {
- return { name: "", sourceDatabase: "", sourceBranch: "", mergedSchema: "", etag: "", validateOnly: false };
-}
-
-export const RebaseBranchRequest: MessageFns<RebaseBranchRequest> = {
- encode(message: RebaseBranchRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.name !== "") {
- writer.uint32(10).string(message.name);
- }
- if (message.sourceDatabase !== "") {
- writer.uint32(18).string(message.sourceDatabase);
- }
- if (message.sourceBranch !== "") {
- writer.uint32(26).string(message.sourceBranch);
- }
- if (message.mergedSchema !== "") {
- writer.uint32(34).string(message.mergedSchema);
- }
- if (message.etag !== "") {
- writer.uint32(42).string(message.etag);
- }
- if (message.validateOnly !== false) {
- writer.uint32(48).bool(message.validateOnly);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): RebaseBranchRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseRebaseBranchRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.name = reader.string();
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.sourceDatabase = reader.string();
- continue;
- }
- case 3: {
- if (tag !== 26) {
- break;
- }
-
- message.sourceBranch = reader.string();
- continue;
- }
- case 4: {
- if (tag !== 34) {
- break;
- }
-
- message.mergedSchema = reader.string();
- continue;
- }
- case 5: {
- if (tag !== 42) {
- break;
- }
-
- message.etag = reader.string();
- continue;
- }
- case 6: {
- if (tag !== 48) {
- break;
- }
-
- message.validateOnly = reader.bool();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): RebaseBranchRequest {
- return {
- name: isSet(object.name) ? globalThis.String(object.name) : "",
- sourceDatabase: isSet(object.sourceDatabase) ? globalThis.String(object.sourceDatabase) : "",
- sourceBranch: isSet(object.sourceBranch) ? globalThis.String(object.sourceBranch) : "",
- mergedSchema: isSet(object.mergedSchema) ? globalThis.String(object.mergedSchema) : "",
- etag: isSet(object.etag) ? globalThis.String(object.etag) : "",
- validateOnly: isSet(object.validateOnly) ? globalThis.Boolean(object.validateOnly) : false,
- };
- },
-
- toJSON(message: RebaseBranchRequest): unknown {
- const obj: any = {};
- if (message.name !== "") {
- obj.name = message.name;
- }
- if (message.sourceDatabase !== "") {
- obj.sourceDatabase = message.sourceDatabase;
- }
- if (message.sourceBranch !== "") {
- obj.sourceBranch = message.sourceBranch;
- }
- if (message.mergedSchema !== "") {
- obj.mergedSchema = message.mergedSchema;
- }
- if (message.etag !== "") {
- obj.etag = message.etag;
- }
- if (message.validateOnly !== false) {
- obj.validateOnly = message.validateOnly;
- }
- return obj;
- },
-
- create(base?: DeepPartial<RebaseBranchRequest>): RebaseBranchRequest {
- return RebaseBranchRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<RebaseBranchRequest>): RebaseBranchRequest {
- const message = createBaseRebaseBranchRequest();
- message.name = object.name ?? "";
- message.sourceDatabase = object.sourceDatabase ?? "";
- message.sourceBranch = object.sourceBranch ?? "";
- message.mergedSchema = object.mergedSchema ?? "";
- message.etag = object.etag ?? "";
- message.validateOnly = object.validateOnly ?? false;
- return message;
- },
-};
-
-function createBaseRebaseBranchResponse(): RebaseBranchResponse {
- return { branch: undefined, conflictSchema: undefined };
-}
-
-export const RebaseBranchResponse: MessageFns<RebaseBranchResponse> = {
- encode(message: RebaseBranchResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.branch !== undefined) {
- Branch.encode(message.branch, writer.uint32(10).fork()).join();
- }
- if (message.conflictSchema !== undefined) {
- writer.uint32(18).string(message.conflictSchema);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): RebaseBranchResponse {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseRebaseBranchResponse();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.branch = Branch.decode(reader, reader.uint32());
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.conflictSchema = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): RebaseBranchResponse {
- return {
- branch: isSet(object.branch) ? Branch.fromJSON(object.branch) : undefined,
- conflictSchema: isSet(object.conflictSchema) ? globalThis.String(object.conflictSchema) : undefined,
- };
- },
-
- toJSON(message: RebaseBranchResponse): unknown {
- const obj: any = {};
- if (message.branch !== undefined) {
- obj.branch = Branch.toJSON(message.branch);
- }
- if (message.conflictSchema !== undefined) {
- obj.conflictSchema = message.conflictSchema;
- }
- return obj;
- },
-
- create(base?: DeepPartial<RebaseBranchResponse>): RebaseBranchResponse {
- return RebaseBranchResponse.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<RebaseBranchResponse>): RebaseBranchResponse {
- const message = createBaseRebaseBranchResponse();
- message.branch = (object.branch !== undefined && object.branch !== null)
- ? Branch.fromPartial(object.branch)
- : undefined;
- message.conflictSchema = object.conflictSchema ?? undefined;
- return message;
- },
-};
-
-function createBaseDeleteBranchRequest(): DeleteBranchRequest {
- return { name: "", force: false };
-}
-
-export const DeleteBranchRequest: MessageFns<DeleteBranchRequest> = {
- encode(message: DeleteBranchRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.name !== "") {
- writer.uint32(10).string(message.name);
- }
- if (message.force !== false) {
- writer.uint32(16).bool(message.force);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): DeleteBranchRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseDeleteBranchRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.name = reader.string();
- continue;
- }
- case 2: {
- if (tag !== 16) {
- break;
- }
-
- message.force = reader.bool();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): DeleteBranchRequest {
- return {
- name: isSet(object.name) ? globalThis.String(object.name) : "",
- force: isSet(object.force) ? globalThis.Boolean(object.force) : false,
- };
- },
-
- toJSON(message: DeleteBranchRequest): unknown {
- const obj: any = {};
- if (message.name !== "") {
- obj.name = message.name;
- }
- if (message.force !== false) {
- obj.force = message.force;
- }
- return obj;
- },
-
- create(base?: DeepPartial<DeleteBranchRequest>): DeleteBranchRequest {
- return DeleteBranchRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<DeleteBranchRequest>): DeleteBranchRequest {
- const message = createBaseDeleteBranchRequest();
- message.name = object.name ?? "";
- message.force = object.force ?? false;
- return message;
- },
-};
-
-function createBaseDiffDatabaseRequest(): DiffDatabaseRequest {
- return { name: "", database: "" };
-}
-
-export const DiffDatabaseRequest: MessageFns<DiffDatabaseRequest> = {
- encode(message: DiffDatabaseRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.name !== "") {
- writer.uint32(10).string(message.name);
- }
- if (message.database !== "") {
- writer.uint32(18).string(message.database);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): DiffDatabaseRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseDiffDatabaseRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.name = reader.string();
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.database = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): DiffDatabaseRequest {
- return {
- name: isSet(object.name) ? globalThis.String(object.name) : "",
- database: isSet(object.database) ? globalThis.String(object.database) : "",
- };
- },
-
- toJSON(message: DiffDatabaseRequest): unknown {
- const obj: any = {};
- if (message.name !== "") {
- obj.name = message.name;
- }
- if (message.database !== "") {
- obj.database = message.database;
- }
- return obj;
- },
-
- create(base?: DeepPartial<DiffDatabaseRequest>): DiffDatabaseRequest {
- return DiffDatabaseRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<DiffDatabaseRequest>): DiffDatabaseRequest {
- const message = createBaseDiffDatabaseRequest();
- message.name = object.name ?? "";
- message.database = object.database ?? "";
- return message;
- },
-};
-
-function createBaseDiffDatabaseResponse(): DiffDatabaseResponse {
- return { diff: "", schema: undefined, conflictSchema: undefined };
-}
-
-export const DiffDatabaseResponse: MessageFns<DiffDatabaseResponse> = {
- encode(message: DiffDatabaseResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.diff !== "") {
- writer.uint32(10).string(message.diff);
- }
- if (message.schema !== undefined) {
- writer.uint32(18).string(message.schema);
- }
- if (message.conflictSchema !== undefined) {
- writer.uint32(26).string(message.conflictSchema);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): DiffDatabaseResponse {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseDiffDatabaseResponse();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.diff = reader.string();
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.schema = reader.string();
- continue;
- }
- case 3: {
- if (tag !== 26) {
- break;
- }
-
- message.conflictSchema = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): DiffDatabaseResponse {
- return {
- diff: isSet(object.diff) ? globalThis.String(object.diff) : "",
- schema: isSet(object.schema) ? globalThis.String(object.schema) : undefined,
- conflictSchema: isSet(object.conflictSchema) ? globalThis.String(object.conflictSchema) : undefined,
- };
- },
-
- toJSON(message: DiffDatabaseResponse): unknown {
- const obj: any = {};
- if (message.diff !== "") {
- obj.diff = message.diff;
- }
- if (message.schema !== undefined) {
- obj.schema = message.schema;
- }
- if (message.conflictSchema !== undefined) {
- obj.conflictSchema = message.conflictSchema;
- }
- return obj;
- },
-
- create(base?: DeepPartial<DiffDatabaseResponse>): DiffDatabaseResponse {
- return DiffDatabaseResponse.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<DiffDatabaseResponse>): DiffDatabaseResponse {
- const message = createBaseDiffDatabaseResponse();
- message.diff = object.diff ?? "";
- message.schema = object.schema ?? undefined;
- message.conflictSchema = object.conflictSchema ?? undefined;
- return message;
- },
-};
-
-function createBaseDiffMetadataRequest(): DiffMetadataRequest {
- return {
- sourceMetadata: undefined,
- targetMetadata: undefined,
- engine: Engine.ENGINE_UNSPECIFIED,
- classificationFromConfig: false,
- };
-}
-
-export const DiffMetadataRequest: MessageFns<DiffMetadataRequest> = {
- encode(message: DiffMetadataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.sourceMetadata !== undefined) {
- DatabaseMetadata.encode(message.sourceMetadata, writer.uint32(10).fork()).join();
- }
- if (message.targetMetadata !== undefined) {
- DatabaseMetadata.encode(message.targetMetadata, writer.uint32(18).fork()).join();
- }
- if (message.engine !== Engine.ENGINE_UNSPECIFIED) {
- writer.uint32(24).int32(engineToNumber(message.engine));
- }
- if (message.classificationFromConfig !== false) {
- writer.uint32(32).bool(message.classificationFromConfig);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): DiffMetadataRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseDiffMetadataRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.sourceMetadata = DatabaseMetadata.decode(reader, reader.uint32());
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.targetMetadata = DatabaseMetadata.decode(reader, reader.uint32());
- continue;
- }
- case 3: {
- if (tag !== 24) {
- break;
- }
-
- message.engine = engineFromJSON(reader.int32());
- continue;
- }
- case 4: {
- if (tag !== 32) {
- break;
- }
-
- message.classificationFromConfig = reader.bool();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): DiffMetadataRequest {
- return {
- sourceMetadata: isSet(object.sourceMetadata) ? DatabaseMetadata.fromJSON(object.sourceMetadata) : undefined,
- targetMetadata: isSet(object.targetMetadata) ? DatabaseMetadata.fromJSON(object.targetMetadata) : undefined,
- engine: isSet(object.engine) ? engineFromJSON(object.engine) : Engine.ENGINE_UNSPECIFIED,
- classificationFromConfig: isSet(object.classificationFromConfig)
- ? globalThis.Boolean(object.classificationFromConfig)
- : false,
- };
- },
-
- toJSON(message: DiffMetadataRequest): unknown {
- const obj: any = {};
- if (message.sourceMetadata !== undefined) {
- obj.sourceMetadata = DatabaseMetadata.toJSON(message.sourceMetadata);
- }
- if (message.targetMetadata !== undefined) {
- obj.targetMetadata = DatabaseMetadata.toJSON(message.targetMetadata);
- }
- if (message.engine !== Engine.ENGINE_UNSPECIFIED) {
- obj.engine = engineToJSON(message.engine);
- }
- if (message.classificationFromConfig !== false) {
- obj.classificationFromConfig = message.classificationFromConfig;
- }
- return obj;
- },
-
- create(base?: DeepPartial<DiffMetadataRequest>): DiffMetadataRequest {
- return DiffMetadataRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<DiffMetadataRequest>): DiffMetadataRequest {
- const message = createBaseDiffMetadataRequest();
- message.sourceMetadata = (object.sourceMetadata !== undefined && object.sourceMetadata !== null)
- ? DatabaseMetadata.fromPartial(object.sourceMetadata)
- : undefined;
- message.targetMetadata = (object.targetMetadata !== undefined && object.targetMetadata !== null)
- ? DatabaseMetadata.fromPartial(object.targetMetadata)
- : undefined;
- message.engine = object.engine ?? Engine.ENGINE_UNSPECIFIED;
- message.classificationFromConfig = object.classificationFromConfig ?? false;
- return message;
- },
-};
-
-function createBaseDiffMetadataResponse(): DiffMetadataResponse {
- return { diff: "" };
-}
-
-export const DiffMetadataResponse: MessageFns<DiffMetadataResponse> = {
- encode(message: DiffMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.diff !== "") {
- writer.uint32(10).string(message.diff);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): DiffMetadataResponse {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseDiffMetadataResponse();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.diff = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): DiffMetadataResponse {
- return { diff: isSet(object.diff) ? globalThis.String(object.diff) : "" };
- },
-
- toJSON(message: DiffMetadataResponse): unknown {
- const obj: any = {};
- if (message.diff !== "") {
- obj.diff = message.diff;
- }
- return obj;
- },
-
- create(base?: DeepPartial<DiffMetadataResponse>): DiffMetadataResponse {
- return DiffMetadataResponse.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<DiffMetadataResponse>): DiffMetadataResponse {
- const message = createBaseDiffMetadataResponse();
- message.diff = object.diff ?? "";
- return message;
- },
-};
-
-export type BranchServiceDefinition = typeof BranchServiceDefinition;
-export const BranchServiceDefinition = {
- name: "BranchService",
- fullName: "bytebase.v1.BranchService",
- methods: {
- getBranch: {
- name: "GetBranch",
- requestType: GetBranchRequest,
- requestStream: false,
- responseType: Branch,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [new Uint8Array([4, 110, 97, 109, 101])],
- 800010: [new Uint8Array([15, 98, 98, 46, 98, 114, 97, 110, 99, 104, 101, 115, 46, 103, 101, 116])],
- 800016: [new Uint8Array([1])],
- 578365826: [
- new Uint8Array([
- 34,
- 18,
- 32,
- 47,
- 118,
- 49,
- 47,
- 123,
- 110,
- 97,
- 109,
- 101,
- 61,
- 112,
- 114,
- 111,
- 106,
- 101,
- 99,
- 116,
- 115,
- 47,
- 42,
- 47,
- 98,
- 114,
- 97,
- 110,
- 99,
- 104,
- 101,
- 115,
- 47,
- 42,
- 125,
- ]),
- ],
- },
- },
- },
- listBranches: {
- name: "ListBranches",
- requestType: ListBranchesRequest,
- requestStream: false,
- responseType: ListBranchesResponse,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [new Uint8Array([0])],
- 800010: [new Uint8Array([16, 98, 98, 46, 98, 114, 97, 110, 99, 104, 101, 115, 46, 108, 105, 115, 116])],
- 800016: [new Uint8Array([1])],
- 578365826: [
- new Uint8Array([
- 34,
- 18,
- 32,
- 47,
- 118,
- 49,
- 47,
- 123,
- 112,
- 97,
- 114,
- 101,
- 110,
- 116,
- 61,
- 112,
- 114,
- 111,
- 106,
- 101,
- 99,
- 116,
- 115,
- 47,
- 42,
- 125,
- 47,
- 98,
- 114,
- 97,
- 110,
- 99,
- 104,
- 101,
- 115,
- ]),
- ],
- },
- },
- },
- createBranch: {
- name: "CreateBranch",
- requestType: CreateBranchRequest,
- requestStream: false,
- responseType: Branch,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [new Uint8Array([13, 112, 97, 114, 101, 110, 116, 44, 98, 114, 97, 110, 99, 104])],
- 800010: [
- new Uint8Array([18, 98, 98, 46, 98, 114, 97, 110, 99, 104, 101, 115, 46, 99, 114, 101, 97, 116, 101]),
- ],
- 800016: [new Uint8Array([1])],
- 578365826: [
- new Uint8Array([
- 40,
- 58,
- 6,
- 98,
- 114,
- 97,
- 110,
- 99,
- 104,
- 34,
- 30,
- 47,
- 118,
- 49,
- 47,
- 123,
- 112,
- 97,
- 114,
- 101,
- 110,
- 116,
- 61,
- 112,
- 114,
- 111,
- 106,
- 101,
- 99,
- 116,
- 115,
- 47,
- 42,
- 125,
- 47,
- 98,
- 114,
- 97,
- 110,
- 99,
- 104,
- ]),
- ],
- },
- },
- },
- updateBranch: {
- name: "UpdateBranch",
- requestType: UpdateBranchRequest,
- requestStream: false,
- responseType: Branch,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [
- new Uint8Array([18, 98, 114, 97, 110, 99, 104, 44, 117, 112, 100, 97, 116, 101, 95, 109, 97, 115, 107]),
- ],
- 800010: [
- new Uint8Array([18, 98, 98, 46, 98, 114, 97, 110, 99, 104, 101, 115, 46, 117, 112, 100, 97, 116, 101]),
- ],
- 800016: [new Uint8Array([1])],
- 578365826: [
- new Uint8Array([
- 49,
- 58,
- 6,
- 98,
- 114,
- 97,
- 110,
- 99,
- 104,
- 50,
- 39,
- 47,
- 118,
- 49,
- 47,
- 123,
- 98,
- 114,
- 97,
- 110,
- 99,
- 104,
- 46,
- 110,
- 97,
- 109,
- 101,
- 61,
- 112,
- 114,
- 111,
- 106,
- 101,
- 99,
- 116,
- 115,
- 47,
- 42,
- 47,
- 98,
- 114,
- 97,
- 110,
- 99,
- 104,
- 101,
- 115,
- 47,
- 42,
- 125,
- ]),
- ],
- },
- },
- },
- mergeBranch: {
- name: "MergeBranch",
- requestType: MergeBranchRequest,
- requestStream: false,
- responseType: Branch,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [new Uint8Array([4, 110, 97, 109, 101])],
- 800010: [
- new Uint8Array([18, 98, 98, 46, 98, 114, 97, 110, 99, 104, 101, 115, 46, 117, 112, 100, 97, 116, 101]),
- ],
- 800016: [new Uint8Array([1])],
- 578365826: [
- new Uint8Array([
- 40,
- 34,
- 38,
- 47,
- 118,
- 49,
- 47,
- 123,
- 110,
- 97,
- 109,
- 101,
- 61,
- 112,
- 114,
- 111,
- 106,
- 101,
- 99,
- 116,
- 115,
- 47,
- 42,
- 47,
- 98,
- 114,
- 97,
- 110,
- 99,
- 104,
- 101,
- 115,
- 47,
- 42,
- 125,
- 58,
- 109,
- 101,
- 114,
- 103,
- 101,
- ]),
- ],
- },
- },
- },
- rebaseBranch: {
- name: "RebaseBranch",
- requestType: RebaseBranchRequest,
- requestStream: false,
- responseType: RebaseBranchResponse,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [new Uint8Array([4, 110, 97, 109, 101])],
- 800010: [
- new Uint8Array([18, 98, 98, 46, 98, 114, 97, 110, 99, 104, 101, 115, 46, 117, 112, 100, 97, 116, 101]),
- ],
- 800016: [new Uint8Array([1])],
- 578365826: [
- new Uint8Array([
- 41,
- 34,
- 39,
- 47,
- 118,
- 49,
- 47,
- 123,
- 110,
- 97,
- 109,
- 101,
- 61,
- 112,
- 114,
- 111,
- 106,
- 101,
- 99,
- 116,
- 115,
- 47,
- 42,
- 47,
- 98,
- 114,
- 97,
- 110,
- 99,
- 104,
- 101,
- 115,
- 47,
- 42,
- 125,
- 58,
- 114,
- 101,
- 98,
- 97,
- 115,
- 101,
- ]),
- ],
- },
- },
- },
- deleteBranch: {
- name: "DeleteBranch",
- requestType: DeleteBranchRequest,
- requestStream: false,
- responseType: Empty,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [new Uint8Array([4, 110, 97, 109, 101])],
- 800010: [
- new Uint8Array([18, 98, 98, 46, 98, 114, 97, 110, 99, 104, 101, 115, 46, 100, 101, 108, 101, 116, 101]),
- ],
- 800016: [new Uint8Array([1])],
- 578365826: [
- new Uint8Array([
- 34,
- 42,
- 32,
- 47,
- 118,
- 49,
- 47,
- 123,
- 110,
- 97,
- 109,
- 101,
- 61,
- 112,
- 114,
- 111,
- 106,
- 101,
- 99,
- 116,
- 115,
- 47,
- 42,
- 47,
- 98,
- 114,
- 97,
- 110,
- 99,
- 104,
- 101,
- 115,
- 47,
- 42,
- 125,
- ]),
- ],
- },
- },
- },
- diffMetadata: {
- name: "DiffMetadata",
- requestType: DiffMetadataRequest,
- requestStream: false,
- responseType: DiffMetadataResponse,
- responseStream: false,
- options: {
- _unknownFields: {
- 800000: [new Uint8Array([1])],
- 578365826: [
- new Uint8Array([
- 34,
- 58,
- 1,
- 42,
- 34,
- 29,
- 47,
- 118,
- 49,
- 47,
- 115,
- 99,
- 104,
- 101,
- 109,
- 97,
- 68,
- 101,
- 115,
- 105,
- 103,
- 110,
- 58,
- 100,
- 105,
- 102,
- 102,
- 77,
- 101,
- 116,
- 97,
- 100,
- 97,
- 116,
- 97,
- ]),
- ],
- },
- },
- },
- },
-} as const;
-
-type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
+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>>
@@ -2314,32 +276,6 @@ export type DeepPartial<T> = T extends Builtin ? T
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
-function toTimestamp(date: Date): Timestamp {
- const seconds = numberToLong(Math.trunc(date.getTime() / 1_000));
- const nanos = (date.getTime() % 1_000) * 1_000_000;
- return { seconds, nanos };
-}
-
-function fromTimestamp(t: Timestamp): Date {
- let millis = (t.seconds.toNumber() || 0) * 1_000;
- millis += (t.nanos || 0) / 1_000_000;
- return new globalThis.Date(millis);
-}
-
-function fromJsonTimestamp(o: any): Timestamp {
- if (o instanceof globalThis.Date) {
- return toTimestamp(o);
- } else if (typeof o === "string") {
- return toTimestamp(new globalThis.Date(o));
- } else {
- return Timestamp.fromJSON(o);
- }
-}
-
-function numberToLong(number: number) {
- return Long.fromNumber(number);
-}
-
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}
diff --git a/frontend/src/types/v1/schemaEditor/state.ts b/frontend/src/types/v1/schemaEditor/state.ts
index f50fc21e5e..021e5294cc 100644
--- a/frontend/src/types/v1/schemaEditor/state.ts
+++ b/frontend/src/types/v1/schemaEditor/state.ts
@@ -1,5 +1,4 @@
import type { ComposedDatabase } from "..";
-import type { Branch } from "../../proto/v1/branch_service";
import type { Schema } from "./atomType";
export enum SchemaEditorTabType {
@@ -35,9 +34,3 @@ export interface DatabaseSchema {
schemaList: Schema[];
originSchemaList: Schema[];
}
-
-export interface BranchSchema {
- branch: Branch;
- schemaList: Schema[];
- originSchemaList: Schema[];
-}
diff --git a/frontend/src/utils/v1/changelist.ts b/frontend/src/utils/v1/changelist.ts
index 336ccbaac9..334aa158a9 100644
--- a/frontend/src/utils/v1/changelist.ts
+++ b/frontend/src/utils/v1/changelist.ts
@@ -12,17 +12,12 @@ export const extractChangelistResourceName = (name: string) => {
export const isChangelogChangeSource = (change: Change) => {
return change.source.match(/(^|\/)changelogs\//);
};
-export const isBranchChangeSource = (change: Change) => {
- return change.source.match(/(^|\/)branches\//);
-};
export const getChangelistChangeSourceType = (
change: Change
): Changelist_Change_Source => {
if (isChangelogChangeSource(change)) {
return "CHANGELOG";
- } else if (isBranchChangeSource(change)) {
- return "BRANCH";
} else {
return "RAW_SQL";
}
diff --git a/frontend/src/views/branch/BranchDetail.vue b/frontend/src/views/branch/BranchDetail.vue
deleted file mode 100644
index bb5e49595d..0000000000
--- a/frontend/src/views/branch/BranchDetail.vue
+++ /dev/null
@@ -1,124 +0,0 @@
-<template>
- <template v-if="ready">
- <template v-if="isCreating">
- <BranchCreateView :project="project" v-bind="$attrs" />
- </template>
- <template v-else-if="branch">
- <BranchDetailView
- :key="detailViewKey"
- :project="project"
- :clean-branch="branch.clean"
- :dirty-branch="branch.dirty"
- v-bind="$attrs"
- @update:branch-id="handleUpdateBranchId"
- />
- </template>
- </template>
- <div v-else class="w-full h-full relative">
- <MaskSpinner />
- </div>
-</template>
-
-<script lang="ts" setup>
-import { useTitle } from "@vueuse/core";
-import { cloneDeep, uniqueId } from "lodash-es";
-import { computed, ref, watch } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
-import BranchCreateView from "@/components/Branch/BranchCreateView.vue";
-import BranchDetailView from "@/components/Branch/BranchDetailView.vue";
-import MaskSpinner from "@/components/misc/MaskSpinner.vue";
-import { PROJECT_V1_ROUTE_BRANCH_DETAIL } from "@/router/dashboard/projectV1";
-import { useProjectByName } from "@/store";
-import { useBranchStore } from "@/store/modules/branch";
-import { projectNamePrefix } from "@/store/modules/v1/common";
-import type { Branch } from "@/types/proto/v1/branch_service";
-
-const props = defineProps<{
- projectId: string;
- branchName: string;
-}>();
-
-const { t } = useI18n();
-const router = useRouter();
-const branchStore = useBranchStore();
-const { project } = useProjectByName(
- computed(() => `${projectNamePrefix}${props.projectId}`)
-);
-const branchFullName = ref<string>("");
-const ready = ref<boolean>(false);
-const detailViewKey = ref(uniqueId());
-const branch = ref<{ clean: Branch; dirty: Branch }>();
-
-const isCreating = computed(() => props.branchName === "new");
-
-const handleUpdateBranchId = (id: string) => {
- if (!branch.value) return;
- branch.value.clean.branchId = id;
- branch.value.dirty.branchId = id;
- router.replace({
- name: PROJECT_V1_ROUTE_BRANCH_DETAIL,
- params: {
- branchName: id,
- },
- });
-};
-
-watch(
- [() => props.projectId, () => props.branchName],
- async () => {
- if (isCreating.value) {
- return;
- }
-
- // Prepare branch name from route params.
- const branchId = props.branchName;
- if (!branchId || !project.value) {
- return;
- }
- branchFullName.value = `${project.value.name}/branches/${branchId}`;
- },
- {
- immediate: true,
- }
-);
-
-watch(
- () => branchFullName.value,
- async () => {
- ready.value = false;
- if (isCreating.value || !branchFullName.value) {
- ready.value = true;
- return;
- }
-
- const br = await branchStore.fetchBranchByName(
- branchFullName.value,
- false /* useCache */
- );
- branch.value = {
- clean: br,
- dirty: cloneDeep(br),
- };
- if (!br) {
- router.replace("error.404");
- }
- ready.value = true;
- },
- {
- immediate: true,
- }
-);
-
-const documentTitle = computed(() => {
- if (isCreating.value) {
- return t("schema-designer.new-branch");
- } else {
- if (branch.value) {
- return branch.value.clean.branchId;
- }
- }
- return t("common.loading");
-});
-useTitle(documentTitle);
-</script>
diff --git a/frontend/src/views/branch/BranchMerge.vue b/frontend/src/views/branch/BranchMerge.vue
deleted file mode 100644
index acabcb1193..0000000000
--- a/frontend/src/views/branch/BranchMerge.vue
+++ /dev/null
@@ -1,61 +0,0 @@
-<template>
- <div class="w-full h-full relative">
- <BranchMergeView
- :project="project"
- :head-branch-name="branchFullName"
- @update:head-branch-name="handleUpdateHeadBranchName"
- @merged="handleMerged"
- />
- </div>
-</template>
-
-<script lang="ts" setup>
-import { computed } from "vue";
-import { useRouter } from "vue-router";
-import BranchMergeView from "@/components/Branch/BranchMergeView";
-import {
- PROJECT_V1_ROUTE_BRANCH_MERGE,
- PROJECT_V1_ROUTE_BRANCH_DETAIL,
-} from "@/router/dashboard/projectV1";
-import { useProjectByName } from "@/store";
-import { getProjectAndBranchId } from "@/store/modules/v1/common";
-import { projectNamePrefix } from "@/store/modules/v1/common";
-import type { Branch } from "@/types/proto/v1/branch_service";
-
-const props = defineProps<{
- projectId: string;
- branchName: string;
-}>();
-
-const router = useRouter();
-const { project } = useProjectByName(
- computed(() => `${projectNamePrefix}${props.projectId}`)
-);
-
-const branchFullName = computed(() => {
- if (!project.value) return null;
- if (props.branchName === "-") return null;
- return `${project.value.name}/branches/${props.branchName}`;
-});
-
-const handleUpdateHeadBranchName = (branchName: string | null) => {
- const branchId = branchName ? getProjectAndBranchId(branchName)[1] : "-";
- router.replace({
- name: PROJECT_V1_ROUTE_BRANCH_MERGE,
- params: {
- branchName: branchId,
- },
- query: router.currentRoute.value.query,
- hash: router.currentRoute.value.hash,
- });
-};
-
-const handleMerged = (mergedBranch: Branch) => {
- router.replace({
- name: PROJECT_V1_ROUTE_BRANCH_DETAIL,
- params: {
- branchName: mergedBranch.branchId,
- },
- });
-};
-</script>
diff --git a/frontend/src/views/branch/BranchRebase.vue b/frontend/src/views/branch/BranchRebase.vue
deleted file mode 100644
index 482f559876..0000000000
--- a/frontend/src/views/branch/BranchRebase.vue
+++ /dev/null
@@ -1,61 +0,0 @@
-<template>
- <div class="w-full h-full relative">
- <BranchRebaseView
- :project="project"
- :head-branch-name="branchFullName"
- @update:head-branch-name="handleUpdateHeadBranchName"
- @rebased="handleRebased"
- />
- </div>
-</template>
-
-<script lang="ts" setup>
-import { computed } from "vue";
-import { useRouter } from "vue-router";
-import BranchRebaseView from "@/components/Branch/BranchRebaseView";
-import {
- PROJECT_V1_ROUTE_BRANCH_REBASE,
- PROJECT_V1_ROUTE_BRANCH_DETAIL,
-} from "@/router/dashboard/projectV1";
-import { useProjectByName } from "@/store";
-import { getProjectAndBranchId } from "@/store/modules/v1/common";
-import { projectNamePrefix } from "@/store/modules/v1/common";
-import type { Branch } from "@/types/proto/v1/branch_service";
-
-const props = defineProps<{
- projectId: string;
- branchName: string;
-}>();
-
-const router = useRouter();
-const { project } = useProjectByName(
- computed(() => `${projectNamePrefix}${props.projectId}`)
-);
-
-const branchFullName = computed(() => {
- if (!project.value) return null;
- if (props.branchName === "-") return null;
- return `${project.value.name}/branches/${props.branchName}`;
-});
-
-const handleUpdateHeadBranchName = (branchName: string | null) => {
- const branchId = branchName ? getProjectAndBranchId(branchName)[1] : "-";
- router.replace({
- name: PROJECT_V1_ROUTE_BRANCH_REBASE,
- params: {
- branchName: branchId,
- },
- query: router.currentRoute.value.query,
- hash: router.currentRoute.value.hash,
- });
-};
-
-const handleRebased = (rebasedBranch: Branch) => {
- router.replace({
- name: PROJECT_V1_ROUTE_BRANCH_DETAIL,
- params: {
- branchName: rebasedBranch.branchId,
- },
- });
-};
-</script>
diff --git a/frontend/src/views/branch/BranchRollout.vue b/frontend/src/views/branch/BranchRollout.vue
deleted file mode 100644
index 0a1fa16eb1..0000000000
--- a/frontend/src/views/branch/BranchRollout.vue
+++ /dev/null
@@ -1,81 +0,0 @@
-<template>
- <div class="w-full h-full relative">
- <BranchRolloutView
- v-if="ready && branch"
- :project="project"
- :branch="branch"
- v-bind="$attrs"
- />
- <MaskSpinner v-else />
- </div>
-</template>
-
-<script lang="ts" setup>
-import { useTitle } from "@vueuse/core";
-import { computed, ref, watch } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
-import BranchRolloutView from "@/components/Branch/BranchRolloutView";
-import MaskSpinner from "@/components/misc/MaskSpinner.vue";
-import { useProjectByName } from "@/store";
-import { useBranchStore } from "@/store/modules/branch";
-import { projectNamePrefix } from "@/store/modules/v1/common";
-import type { Branch } from "@/types/proto/v1/branch_service";
-
-const props = defineProps<{
- projectId: string;
- branchName: string;
-}>();
-
-const { t } = useI18n();
-const router = useRouter();
-const branchStore = useBranchStore();
-const branchFullName = ref<string>("");
-const { project } = useProjectByName(
- computed(() => `${projectNamePrefix}${props.projectId}`)
-);
-const ready = ref<boolean>(false);
-const branch = ref<Branch>();
-
-watch(
- [() => props.projectId, () => props.branchName],
- async () => {
- // Prepare branch name from route params.
- const branchId = props.branchName;
- if (!branchId || !project.value) {
- return;
- }
- branchFullName.value = `${project.value.name}/branches/${branchId}`;
- },
- {
- immediate: true,
- }
-);
-
-watch(
- () => branchFullName.value,
- async () => {
- ready.value = false;
- const br = await branchStore.fetchBranchByName(
- branchFullName.value,
- false /* useCache */
- );
- branch.value = br;
- if (!br) {
- router.replace("error.404");
- }
- ready.value = true;
- },
- {
- immediate: true,
- }
-);
-
-const documentTitle = computed(() => {
- if (branch.value) {
- return branch.value.branchId;
- }
- return t("common.loading");
-});
-useTitle(documentTitle);
-</script>
diff --git a/frontend/src/views/project/ProjectBranchDashboard.vue b/frontend/src/views/project/ProjectBranchDashboard.vue
deleted file mode 100644
index ca6995338c..0000000000
--- a/frontend/src/views/project/ProjectBranchDashboard.vue
+++ /dev/null
@@ -1,18 +0,0 @@
-<template>
- <ProjectBranchesPanel :project="project" />
-</template>
-
-<script setup lang="ts">
-import { computed } from "vue";
-import ProjectBranchesPanel from "@/components/ProjectBranchesPanel.vue";
-import { useProjectByName } from "@/store";
-import { projectNamePrefix } from "@/store/modules/v1/common";
-
-const props = defineProps<{
- projectId: string;
-}>();
-
-const { project } = useProjectByName(
- computed(() => `${projectNamePrefix}${props.projectId}`)
-);
-</script>
diff --git a/go.mod b/go.mod
index 774972ad2b..63ad66c309 100644
--- a/go.mod
+++ b/go.mod
@@ -36,7 +36,6 @@ require (
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/databricks/databricks-sdk-go v0.54.0
github.com/elastic/go-elasticsearch/v7 v7.17.10
- github.com/epiclabs-io/diff3 v0.0.0-20241115194849-280ec18688b6
github.com/github/gh-ost v1.1.6
github.com/go-ego/gse v0.80.3
github.com/go-ldap/ldap/v3 v3.4.10
diff --git a/go.sum b/go.sum
index 7e3e89e7cc..c476653c10 100644
--- a/go.sum
+++ b/go.sum
@@ -1006,8 +1006,6 @@ github.com/envoyproxy/protoc-gen-validate v0.9.1/go.mod h1:OKNgG7TCp5pF4d6XftA0+
github.com/envoyproxy/protoc-gen-validate v0.10.1/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss=
github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM=
github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4=
-github.com/epiclabs-io/diff3 v0.0.0-20241115194849-280ec18688b6 h1:xo6+EhYIEBFAydeR6rEiww6Gn3fYek9ZG6V323aeb5w=
-github.com/epiclabs-io/diff3 v0.0.0-20241115194849-280ec18688b6/go.mod h1:PdN6OIagE78n5wNNOgGb3udE+GAGpST4iGc64ZZ2TFc=
github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw=
github.com/fanixk/geohash v0.0.0-20150324002647-c1f9b5fa157a h1:Fyfh/dsHFrC6nkX7H7+nFdTd1wROlX/FxEIWVpKYf1U=
github.com/fanixk/geohash v0.0.0-20150324002647-c1f9b5fa157a/go.mod h1:UgNw+PTmmGN8rV7RvjvnBMsoTU8ZXXnaT3hYsDTBlgQ=
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index a26dad16d1..bd9a6c9b4b 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -3575,343 +3575,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Status'
- /v1/projects/{project}/branch:
- post:
- tags:
- - BranchService
- operationId: BranchService_CreateBranch
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
- schema:
- type: string
- - name: branchId
- in: query
- description: |-
- The ID to use for the branch, which will become the final component of
- the branch's resource name.
- Format: [a-zA-Z][a-zA-Z0-9-_/]+.
- schema:
- type: string
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Branch'
- required: true
- responses:
- "200":
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Branch'
- default:
- description: Default error response
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Status'
- /v1/projects/{project}/branches:
- get:
- tags:
- - BranchService
- operationId: BranchService_ListBranches
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
- schema:
- type: string
- - name: filter
- in: query
- description: To filter the search result.
- schema:
- type: string
- - name: pageSize
- in: query
- description: |-
- Not used.
- The maximum number of branches to return. The service may return fewer than
- this value.
- If unspecified, at most 50 branches will be returned.
- The maximum value is 1000; values above 1000 will be coerced to 1000.
- schema:
- type: integer
- format: int32
- - name: pageToken
- in: query
- description: |-
- Not used.
- A page token, received from a previous `ListBranches` call.
- Provide this to retrieve the subsequent page.
-
- When paginating, all other parameters provided to `ListBranches` must match
- the call that provided the page token.
- schema:
- type: string
- - name: view
- in: query
- schema:
- enum:
- - BRANCH_VIEW_UNSPECIFIED
- - BRANCH_VIEW_BASIC
- - BRANCH_VIEW_FULL
- type: string
- format: enum
- responses:
- "200":
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ListBranchesResponse'
- default:
- description: Default error response
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Status'
- /v1/projects/{project}/branches/{branche}:
- get:
- tags:
- - BranchService
- operationId: BranchService_GetBranch
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
- schema:
- type: string
- - name: branche
- in: path
- description: The branche id.
- required: true
- schema:
- type: string
- responses:
- "200":
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Branch'
- default:
- description: Default error response
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Status'
- delete:
- tags:
- - BranchService
- operationId: BranchService_DeleteBranch
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
- schema:
- type: string
- - name: branche
- in: path
- description: The branche id.
- required: true
- schema:
- type: string
- - name: force
- in: query
- description: |-
- By default, server will return `FAILED_PRECONDITION` error
- if delete the branch that is parent of other branches.
- If true, server will delete the branch forcely but will not delete its children branches.
- schema:
- type: boolean
- responses:
- "200":
- description: OK
- content: {}
- default:
- description: Default error response
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Status'
- patch:
- tags:
- - BranchService
- operationId: BranchService_UpdateBranch
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
- schema:
- type: string
- - name: branche
- in: path
- description: The branche id.
- required: true
- schema:
- type: string
- - name: updateMask
- in: query
- description: The list of fields to update.
- schema:
- type: string
- format: field-mask
- - name: etag
- in: query
- description: |-
- The current etag of the branch.
- If an etag is provided and does not match the current etag of the branch,
- the call will be blocked and an ABORTED error will be returned.
- The etag should be specified for using merged_schema. The etag should be the etag from named branch.
- schema:
- type: string
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Branch'
- required: true
- responses:
- "200":
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Branch'
- default:
- description: Default error response
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Status'
- /v1/projects/{project}/branches/{branche}:merge:
- post:
- tags:
- - BranchService
- operationId: BranchService_MergeBranch
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
- schema:
- type: string
- - name: branche
- in: path
- description: The branche id.
- required: true
- schema:
- type: string
- - name: headBranch
- in: query
- description: |-
- The head branch to merge from.
- Format: projects/{project}/branches/{branch}
- schema:
- type: string
- - name: etag
- in: query
- description: |-
- The current etag of the branch.
- If an etag is provided and does not match the current etag of the branch,
- the call will be blocked and an ABORTED error will be returned.
- The etag should be the etag from named branch.
- schema:
- type: string
- - name: validateOnly
- in: query
- description: validate_only determines if the merge can occur seamlessly without any conflicts.
- schema:
- type: boolean
- responses:
- "200":
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Branch'
- default:
- description: Default error response
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Status'
- /v1/projects/{project}/branches/{branche}:rebase:
- post:
- tags:
- - BranchService
- operationId: BranchService_RebaseBranch
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
- schema:
- type: string
- - name: branche
- in: path
- description: The branche id.
- required: true
- schema:
- type: string
- - name: sourceDatabase
- in: query
- description: |-
- The database (remote upstream) used to rebase.
- We use its schema as baseline and reapply the difference between base and head of the named branch.
- Format: instances/{instance}/databases/{database}
- schema:
- type: string
- - name: sourceBranch
- in: query
- description: |-
- The branch (remote upstream) used to rebase. We use its head as baseline.
- We use its head schema as baseline and reapply the difference between base and head of the named branch.
- Format: projects/{project}/branches/{branch}
- schema:
- type: string
- - name: mergedSchema
- in: query
- description: |-
- For failed merge, we will pass in this addition merged schema and use it for head.
- This has to be set together with source_database or source_branch.
- schema:
- type: string
- - name: etag
- in: query
- description: |-
- The current etag of the branch.
- If an etag is provided and does not match the current etag of the branch,
- the call will be blocked and an ABORTED error will be returned.
- The etag should be specified for using merged_schema. The etag should be the etag from named branch.
- schema:
- type: string
- - name: validateOnly
- in: query
- description: validate_only determines if the rebase can occur seamlessly without any conflicts.
- schema:
- type: boolean
- responses:
- "200":
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/RebaseBranchResponse'
- default:
- description: Default error response
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Status'
/v1/projects/{project}/changelists:
get:
tags:
@@ -9186,103 +8849,6 @@ components:
allOf:
- $ref: '#/components/schemas/Expr'
description: The parsed expression of the condition.
- Branch:
- type: object
- properties:
- name:
- type: string
- description: |-
- The name of the branch.
- Format: projects/{project}/branches/{branch}
- {branch} should be the id of a sheet.
- branchId:
- type: string
- description: The branch ID.
- schema:
- readOnly: true
- type: string
- description: The schema of branch. AKA sheet's statement.
- schemaMetadata:
- allOf:
- - $ref: '#/components/schemas/DatabaseMetadata'
- description: The metadata of the current editing schema.
- baselineSchema:
- readOnly: true
- type: string
- description: The baseline schema.
- baselineSchemaMetadata:
- readOnly: true
- allOf:
- - $ref: '#/components/schemas/DatabaseMetadata'
- description: The metadata of the baseline schema.
- engine:
- enum:
- - ENGINE_UNSPECIFIED
- - CLICKHOUSE
- - MYSQL
- - POSTGRES
- - SNOWFLAKE
- - SQLITE
- - TIDB
- - MONGODB
- - REDIS
- - ORACLE
- - SPANNER
- - MSSQL
- - REDSHIFT
- - MARIADB
- - OCEANBASE
- - DM
- - RISINGWAVE
- - OCEANBASE_ORACLE
- - STARROCKS
- - DORIS
- - HIVE
- - ELASTICSEARCH
- - BIGQUERY
- - DYNAMODB
- - DATABRICKS
- - COCKROACHDB
- - COSMOSDB
- type: string
- description: The database engine of the branch.
- format: enum
- baselineDatabase:
- type: string
- description: |-
- The name of the baseline database.
- Format: instances/{instance}/databases/{database}
- parentBranch:
- type: string
- description: |-
- The name of the parent branch.
- For main branch, it's empty.
- For child branch, its format will be: projects/{project}/branches/{branch}
- etag:
- type: string
- description: The etag of the branch.
- creator:
- readOnly: true
- type: string
- description: |-
- The creator of the branch.
- Format: users/{email}
- updater:
- readOnly: true
- type: string
- description: |-
- The updater of the branch.
- Format: users/{email}
- createTime:
- readOnly: true
- type: string
- description: The timestamp when the branch was created.
- format: date-time
- updateTime:
- readOnly: true
- type: string
- description: The timestamp when the branch was last updated.
- format: date-time
ChangeDatabaseConfig_PreUpdateBackupDetail:
type: object
properties:
@@ -11160,19 +10726,6 @@ components:
items:
type: string
description: Values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
- ListBranchesResponse:
- type: object
- properties:
- branches:
- type: array
- items:
- $ref: '#/components/schemas/Branch'
- description: The branches from the specified request.
- nextPageToken:
- type: string
- description: |-
- A token, which can be sent as `page_token` to retrieve the next page.
- If this field is omitted, there are no subsequent pages.
ListChangelistsResponse:
type: object
properties:
@@ -12635,21 +12188,6 @@ components:
substitution:
type: string
description: OriginalValue[start:end) would be replaced with replace_with.
- RebaseBranchResponse:
- type: object
- properties:
- branch:
- allOf:
- - $ref: '#/components/schemas/Branch'
- description: The rebased branch when rebase occurs seamlessly.
- conflictSchema:
- type: string
- description: |-
- The conflict schema when rebase has conflicts.
- The conflict section is enclosed by the following.
- <<<<< HEAD
- ====
- >>>>> main
RejectIssueRequest:
required:
- name
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index b3c8c1409f..a0d9cc320f 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -43,6 +43,36 @@
- [AuditLog.Severity](#bytebase-store-AuditLog-Severity)
+- [store/changelist.proto](#store_changelist-proto)
+ - [Changelist](#bytebase-store-Changelist)
+ - [Changelist.Change](#bytebase-store-Changelist-Change)
+
+- [store/changelog.proto](#store_changelog-proto)
+ - [ChangedResourceDatabase](#bytebase-store-ChangedResourceDatabase)
+ - [ChangedResourceFunction](#bytebase-store-ChangedResourceFunction)
+ - [ChangedResourceProcedure](#bytebase-store-ChangedResourceProcedure)
+ - [ChangedResourceSchema](#bytebase-store-ChangedResourceSchema)
+ - [ChangedResourceTable](#bytebase-store-ChangedResourceTable)
+ - [ChangedResourceView](#bytebase-store-ChangedResourceView)
+ - [ChangedResources](#bytebase-store-ChangedResources)
+ - [ChangelogPayload](#bytebase-store-ChangelogPayload)
+
+ - [ChangelogPayload.Type](#bytebase-store-ChangelogPayload-Type)
+
+- [store/data_source.proto](#store_data_source-proto)
+ - [DataSourceExternalSecret](#bytebase-store-DataSourceExternalSecret)
+ - [DataSourceExternalSecret.AppRoleAuthOption](#bytebase-store-DataSourceExternalSecret-AppRoleAuthOption)
+ - [DataSourceOptions](#bytebase-store-DataSourceOptions)
+ - [DataSourceOptions.Address](#bytebase-store-DataSourceOptions-Address)
+ - [KerberosConfig](#bytebase-store-KerberosConfig)
+ - [SASLConfig](#bytebase-store-SASLConfig)
+
+ - [DataSourceExternalSecret.AppRoleAuthOption.SecretType](#bytebase-store-DataSourceExternalSecret-AppRoleAuthOption-SecretType)
+ - [DataSourceExternalSecret.AuthType](#bytebase-store-DataSourceExternalSecret-AuthType)
+ - [DataSourceExternalSecret.SecretType](#bytebase-store-DataSourceExternalSecret-SecretType)
+ - [DataSourceOptions.AuthenticationType](#bytebase-store-DataSourceOptions-AuthenticationType)
+ - [DataSourceOptions.RedisType](#bytebase-store-DataSourceOptions-RedisType)
+
- [store/database.proto](#store_database-proto)
- [CheckConstraintMetadata](#bytebase-store-CheckConstraintMetadata)
- [ColumnCatalog](#bytebase-store-ColumnCatalog)
@@ -94,40 +124,6 @@
- [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/changelog.proto](#store_changelog-proto)
- - [ChangedResourceDatabase](#bytebase-store-ChangedResourceDatabase)
- - [ChangedResourceFunction](#bytebase-store-ChangedResourceFunction)
- - [ChangedResourceProcedure](#bytebase-store-ChangedResourceProcedure)
- - [ChangedResourceSchema](#bytebase-store-ChangedResourceSchema)
- - [ChangedResourceTable](#bytebase-store-ChangedResourceTable)
- - [ChangedResourceView](#bytebase-store-ChangedResourceView)
- - [ChangedResources](#bytebase-store-ChangedResources)
- - [ChangelogPayload](#bytebase-store-ChangelogPayload)
-
- - [ChangelogPayload.Type](#bytebase-store-ChangelogPayload-Type)
-
-- [store/data_source.proto](#store_data_source-proto)
- - [DataSourceExternalSecret](#bytebase-store-DataSourceExternalSecret)
- - [DataSourceExternalSecret.AppRoleAuthOption](#bytebase-store-DataSourceExternalSecret-AppRoleAuthOption)
- - [DataSourceOptions](#bytebase-store-DataSourceOptions)
- - [DataSourceOptions.Address](#bytebase-store-DataSourceOptions-Address)
- - [KerberosConfig](#bytebase-store-KerberosConfig)
- - [SASLConfig](#bytebase-store-SASLConfig)
-
- - [DataSourceExternalSecret.AppRoleAuthOption.SecretType](#bytebase-store-DataSourceExternalSecret-AppRoleAuthOption-SecretType)
- - [DataSourceExternalSecret.AuthType](#bytebase-store-DataSourceExternalSecret-AuthType)
- - [DataSourceExternalSecret.SecretType](#bytebase-store-DataSourceExternalSecret-SecretType)
- - [DataSourceOptions.AuthenticationType](#bytebase-store-DataSourceOptions-AuthenticationType)
- - [DataSourceOptions.RedisType](#bytebase-store-DataSourceOptions-RedisType)
-
- [store/db_group.proto](#store_db_group-proto)
- [DatabaseGroupPayload](#bytebase-store-DatabaseGroupPayload)
@@ -894,650 +890,640 @@ Metadata about the request.
-<a name="store_database-proto"></a>
+<a name="store_changelist-proto"></a>
<p align="right"><a href="#top">Top</a></p>
-## store/database.proto
+## store/changelist.proto
-<a name="bytebase-store-CheckConstraintMetadata"></a>
+<a name="bytebase-store-Changelist"></a>
-### CheckConstraintMetadata
+### Changelist
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of a check constraint. |
-| expression | [string](#string) | | The expression is the expression of a check constraint. |
+| description | [string](#string) | | |
+| changes | [Changelist.Change](#bytebase-store-Changelist-Change) | repeated | |
-<a name="bytebase-store-ColumnCatalog"></a>
+<a name="bytebase-store-Changelist-Change"></a>
-### ColumnCatalog
+### Changelist.Change
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of a column. |
-| semantic_type | [string](#string) | | |
-| labels | [ColumnCatalog.LabelsEntry](#bytebase-store-ColumnCatalog-LabelsEntry) | repeated | The user labels for a column. |
-| classification | [string](#string) | | |
-| object_schema | [ObjectSchema](#bytebase-store-ObjectSchema) | optional | |
-| masking_level | [MaskingLevel](#bytebase-store-MaskingLevel) | | Deprecated. |
-| full_masking_algorithm_id | [string](#string) | | Deprecated. |
-| partial_masking_algorithm_id | [string](#string) | | Deprecated. |
+| sheet | [string](#string) | | The name of a sheet. |
+| source | [string](#string) | | The source of origin. 1) changes: instances/{instance}/databases/{database}/changelogs/{changelog}. 2) raw SQL if empty. |
+| version | [string](#string) | | The migration version for a change. |
+
-<a name="bytebase-store-ColumnCatalog-LabelsEntry"></a>
+
-### ColumnCatalog.LabelsEntry
+
+
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| key | [string](#string) | | |
-| value | [string](#string) | | |
+<a name="store_changelog-proto"></a>
+<p align="right"><a href="#top">Top</a></p>
+## store/changelog.proto
+<a name="bytebase-store-ChangedResourceDatabase"></a>
-<a name="bytebase-store-ColumnMetadata"></a>
+### ChangedResourceDatabase
-### ColumnMetadata
-ColumnMetadata is the metadata for columns.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of a column. |
-| position | [int32](#int32) | | The position is the position in columns. |
-| default | [google.protobuf.StringValue](#google-protobuf-StringValue) | | The default is the default of a column. Use google.protobuf.StringValue to distinguish between an empty string default value or no default. |
-| default_null | [bool](#bool) | | |
-| default_expression | [string](#string) | | |
-| on_update | [string](#string) | | The on_update is the on update action of a column. For MySQL like databases, it&#39;s only supported for TIMESTAMP columns with CURRENT_TIMESTAMP as on update value. |
-| nullable | [bool](#bool) | | The nullable is the nullable of a column. |
-| type | [string](#string) | | The type is the type of a column. |
-| character_set | [string](#string) | | The character_set is the character_set of a column. |
-| collation | [string](#string) | | The collation is the collation of a column. |
-| comment | [string](#string) | | The comment is the comment of a column. classification and user_comment is parsed from the comment. |
-| user_comment | [string](#string) | | The user_comment is the user comment of a table parsed from the comment. |
-| generation | [GenerationMetadata](#bytebase-store-GenerationMetadata) | | The generation is for generated columns. |
+| name | [string](#string) | | |
+| schemas | [ChangedResourceSchema](#bytebase-store-ChangedResourceSchema) | repeated | |
-<a name="bytebase-store-DatabaseConfig"></a>
+<a name="bytebase-store-ChangedResourceFunction"></a>
-### DatabaseConfig
+### ChangedResourceFunction
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| name | [string](#string) | | |
-| schemas | [SchemaCatalog](#bytebase-store-SchemaCatalog) | repeated | The schema_configs is the list of configs for schemas in a database. |
+| ranges | [Range](#bytebase-store-Range) | repeated | The ranges of sub-strings correspond to the statements on the sheet. |
-<a name="bytebase-store-DatabaseMetadata"></a>
+<a name="bytebase-store-ChangedResourceProcedure"></a>
+
+### ChangedResourceProcedure
-### DatabaseMetadata
-DatabaseMetadata is the metadata for databases.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| labels | [DatabaseMetadata.LabelsEntry](#bytebase-store-DatabaseMetadata-LabelsEntry) | repeated | |
-| last_sync_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
-| backup_available | [bool](#bool) | | |
+| name | [string](#string) | | |
+| ranges | [Range](#bytebase-store-Range) | repeated | The ranges of sub-strings correspond to the statements on the sheet. |
-<a name="bytebase-store-DatabaseMetadata-LabelsEntry"></a>
+<a name="bytebase-store-ChangedResourceSchema"></a>
-### DatabaseMetadata.LabelsEntry
+### ChangedResourceSchema
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| key | [string](#string) | | |
-| value | [string](#string) | | |
+| name | [string](#string) | | |
+| tables | [ChangedResourceTable](#bytebase-store-ChangedResourceTable) | repeated | |
+| views | [ChangedResourceView](#bytebase-store-ChangedResourceView) | repeated | |
+| functions | [ChangedResourceFunction](#bytebase-store-ChangedResourceFunction) | repeated | |
+| procedures | [ChangedResourceProcedure](#bytebase-store-ChangedResourceProcedure) | repeated | |
-<a name="bytebase-store-DatabaseSchemaMetadata"></a>
+<a name="bytebase-store-ChangedResourceTable"></a>
+
+### ChangedResourceTable
-### DatabaseSchemaMetadata
-DatabaseSchemaMetadata is the schema metadata for databases.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| name | [string](#string) | | |
-| schemas | [SchemaMetadata](#bytebase-store-SchemaMetadata) | repeated | The schemas is the list of schemas in a database. |
-| character_set | [string](#string) | | The character_set is the character set of a database. |
-| collation | [string](#string) | | The collation is the collation of a database. |
-| extensions | [ExtensionMetadata](#bytebase-store-ExtensionMetadata) | repeated | The extensions is the list of extensions in a database. |
-| datashare | [bool](#bool) | | The database belongs to a datashare. |
-| service_name | [string](#string) | | The service name of the database. It&#39;s the Oracle specific concept. |
-| linked_databases | [LinkedDatabaseMetadata](#bytebase-store-LinkedDatabaseMetadata) | repeated | |
-| owner | [string](#string) | | |
+| table_rows | [int64](#int64) | | estimated row count of the table |
+| ranges | [Range](#bytebase-store-Range) | repeated | The ranges of sub-strings correspond to the statements on the sheet. |
-<a name="bytebase-store-DependencyColumn"></a>
+<a name="bytebase-store-ChangedResourceView"></a>
+
+### ChangedResourceView
-### DependencyColumn
-DependencyColumn is the metadata for dependency columns.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| schema | [string](#string) | | The schema is the schema of a reference column. |
-| table | [string](#string) | | The table is the table of a reference column. |
-| column | [string](#string) | | The column is the name of a reference column. |
+| name | [string](#string) | | |
+| ranges | [Range](#bytebase-store-Range) | repeated | The ranges of sub-strings correspond to the statements on the sheet. |
-<a name="bytebase-store-DependencyTable"></a>
+<a name="bytebase-store-ChangedResources"></a>
-### DependencyTable
+### ChangedResources
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| schema | [string](#string) | | The schema is the schema of a reference table. |
-| table | [string](#string) | | The table is the name of a reference table. |
+| databases | [ChangedResourceDatabase](#bytebase-store-ChangedResourceDatabase) | repeated | |
-<a name="bytebase-store-EnumTypeMetadata"></a>
+<a name="bytebase-store-ChangelogPayload"></a>
-### EnumTypeMetadata
+### ChangelogPayload
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name of a type. |
-| values | [string](#string) | repeated | The enum values of a type. |
-| comment | [string](#string) | | |
+| task_run | [string](#string) | | Format: projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskruns/{taskrun} |
+| issue | [string](#string) | | Format: projects/{project}/issues/{issue} |
+| revision | [int64](#int64) | | The revision uid. optional |
+| changed_resources | [ChangedResources](#bytebase-store-ChangedResources) | | |
+| sheet | [string](#string) | | The sheet that holds the content. Format: projects/{project}/sheets/{sheet} |
+| version | [string](#string) | | |
+| type | [ChangelogPayload.Type](#bytebase-store-ChangelogPayload-Type) | | |
+
-<a name="bytebase-store-EventMetadata"></a>
-### EventMetadata
+<a name="bytebase-store-ChangelogPayload-Type"></a>
+### ChangelogPayload.Type
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name of the event. |
-| definition | [string](#string) | | The schedule of the event. |
-| time_zone | [string](#string) | | The time zone of the event. |
-| sql_mode | [string](#string) | | |
-| character_set_client | [string](#string) | | |
-| collation_connection | [string](#string) | | |
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| TYPE_UNSPECIFIED | 0 | |
+| BASELINE | 1 | |
+| MIGRATE | 2 | |
+| MIGRATE_SDL | 3 | |
+| MIGRATE_GHOST | 4 | |
+| DATA | 6 | |
+
+
+
-<a name="bytebase-store-ExtensionMetadata"></a>
-### ExtensionMetadata
-ExtensionMetadata is the metadata for extensions.
+<a name="store_data_source-proto"></a>
+<p align="right"><a href="#top">Top</a></p>
+## store/data_source.proto
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of an extension. |
-| schema | [string](#string) | | The schema is the extension that is installed to. But the extension usage is not limited to the schema. |
-| version | [string](#string) | | The version is the version of an extension. |
-| description | [string](#string) | | The description is the description of an extension. |
+<a name="bytebase-store-DataSourceExternalSecret"></a>
+### DataSourceExternalSecret
-<a name="bytebase-store-ExternalTableMetadata"></a>
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| secret_type | [DataSourceExternalSecret.SecretType](#bytebase-store-DataSourceExternalSecret-SecretType) | | |
+| url | [string](#string) | | |
+| auth_type | [DataSourceExternalSecret.AuthType](#bytebase-store-DataSourceExternalSecret-AuthType) | | |
+| app_role | [DataSourceExternalSecret.AppRoleAuthOption](#bytebase-store-DataSourceExternalSecret-AppRoleAuthOption) | | |
+| token | [string](#string) | | |
+| engine_name | [string](#string) | | engine name is the name for secret engine. |
+| secret_name | [string](#string) | | the secret name in the engine to store the password. |
+| password_key_name | [string](#string) | | the key name for the password. |
-### ExternalTableMetadata
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of a external table. |
-| external_server_name | [string](#string) | | The external_server_name is the name of the external server. |
-| external_database_name | [string](#string) | | The external_database_name is the name of the external database. |
-| columns | [ColumnMetadata](#bytebase-store-ColumnMetadata) | repeated | The columns is the ordered list of columns in a foreign table. |
+<a name="bytebase-store-DataSourceExternalSecret-AppRoleAuthOption"></a>
+### DataSourceExternalSecret.AppRoleAuthOption
-<a name="bytebase-store-ForeignKeyMetadata"></a>
-
-### ForeignKeyMetadata
-ForeignKeyMetadata is the metadata for foreign keys.
-
-
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of a foreign key. |
-| columns | [string](#string) | repeated | The columns are the ordered referencing columns of a foreign key. |
-| referenced_schema | [string](#string) | | The referenced_schema is the referenced schema name of a foreign key. It is an empty string for databases without such concept such as MySQL. |
-| referenced_table | [string](#string) | | The referenced_table is the referenced table name of a foreign key. |
-| referenced_columns | [string](#string) | repeated | The referenced_columns are the ordered referenced columns of a foreign key. |
-| on_delete | [string](#string) | | The on_delete is the on delete action of a foreign key. |
-| on_update | [string](#string) | | The on_update is the on update action of a foreign key. |
-| match_type | [string](#string) | | The match_type is the match type of a foreign key. The match_type is the PostgreSQL specific field. It&#39;s empty string for other databases. |
+| role_id | [string](#string) | | |
+| secret_id | [string](#string) | | the secret id for the role without ttl. |
+| type | [DataSourceExternalSecret.AppRoleAuthOption.SecretType](#bytebase-store-DataSourceExternalSecret-AppRoleAuthOption-SecretType) | | |
+| mount_path | [string](#string) | | The path where the approle auth method is mounted. |
-<a name="bytebase-store-FunctionConfig"></a>
+<a name="bytebase-store-DataSourceOptions"></a>
-### FunctionConfig
+### DataSourceOptions
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of a function. |
-| updater | [string](#string) | | The last updater of the function in branch. Format: users/{userUID}. |
-| source_branch | [string](#string) | | The last change come from branch. Format: projcets/{project}/branches/{branch} |
-| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The timestamp when the function is updated in branch. |
+| 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;). |
+| authentication_private_key_obfuscated | [string](#string) | | PKCS#8 private key in PEM format. If it&#39;s empty string, no private key is required. Used for authentication when connecting to the data source. |
+| external_secret | [DataSourceExternalSecret](#bytebase-store-DataSourceExternalSecret) | | |
+| authentication_type | [DataSourceOptions.AuthenticationType](#bytebase-store-DataSourceOptions-AuthenticationType) | | |
+| sasl_config | [SASLConfig](#bytebase-store-SASLConfig) | | |
+| additional_addresses | [DataSourceOptions.Address](#bytebase-store-DataSourceOptions-Address) | repeated | additional_addresses is used for MongoDB replica set. |
+| replica_set | [string](#string) | | replica_set is used for MongoDB replica set. |
+| direct_connection | [bool](#bool) | | direct_connection is used for MongoDB to dispatch all the operations to the node specified in the connection string. |
+| region | [string](#string) | | region is the location of where the DB is, works for AWS RDS. For example, us-east-1. |
+| warehouse_id | [string](#string) | | warehouse_id is used by Databricks. |
+| master_name | [string](#string) | | master_name is the master name used by connecting redis-master via redis sentinel. |
+| master_username | [string](#string) | | master_username and master_obfuscated_password are master credentials used by redis sentinel mode. |
+| master_obfuscated_password | [string](#string) | | |
+| redis_type | [DataSourceOptions.RedisType](#bytebase-store-DataSourceOptions-RedisType) | | |
+| use_ssl | [bool](#bool) | | Use SSL to connect to the data source. By default, we use system default SSL configuration. |
+| cluster | [string](#string) | | Cluster is the cluster name for the data source. Used by CockroachDB. |
-<a name="bytebase-store-FunctionMetadata"></a>
+<a name="bytebase-store-DataSourceOptions-Address"></a>
+
+### DataSourceOptions.Address
-### FunctionMetadata
-FunctionMetadata is the metadata for functions.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of a function. |
-| definition | [string](#string) | | The definition is the definition of a function. |
-| signature | [string](#string) | | The signature is the name with the number and type of input arguments the function takes. |
-| character_set_client | [string](#string) | | MySQL specific metadata. |
-| collation_connection | [string](#string) | | |
-| database_collation | [string](#string) | | |
-| sql_mode | [string](#string) | | |
-| comment | [string](#string) | | |
-| dependency_tables | [DependencyTable](#bytebase-store-DependencyTable) | repeated | The dependency_tables is the list of dependency tables of a function. For PostgreSQL, it&#39;s the list of tables that the function depends on the return type definition. |
+| host | [string](#string) | | |
+| port | [string](#string) | | |
-<a name="bytebase-store-GenerationMetadata"></a>
+<a name="bytebase-store-KerberosConfig"></a>
-### GenerationMetadata
+### KerberosConfig
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| type | [GenerationMetadata.Type](#bytebase-store-GenerationMetadata-Type) | | |
-| expression | [string](#string) | | |
+| primary | [string](#string) | | |
+| instance | [string](#string) | | |
+| realm | [string](#string) | | |
+| keytab | [bytes](#bytes) | | |
+| kdc_host | [string](#string) | | |
+| kdc_port | [string](#string) | | |
+| kdc_transport_protocol | [string](#string) | | |
-<a name="bytebase-store-IndexMetadata"></a>
+<a name="bytebase-store-SASLConfig"></a>
+
+### SASLConfig
-### IndexMetadata
-IndexMetadata is the metadata for indexes.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of an index. |
-| expressions | [string](#string) | repeated | The expressions are the ordered columns or expressions of an index. This could refer to a column or an expression. |
-| key_length | [int64](#int64) | repeated | The key_lengths are the ordered key lengths of an index. If the key length is not specified, it&#39;s -1. |
-| descending | [bool](#bool) | repeated | The descending is the ordered descending of an index. |
-| type | [string](#string) | | The type is the type of an index. |
-| unique | [bool](#bool) | | The unique is whether the index is unique. |
-| primary | [bool](#bool) | | The primary is whether the index is a primary key index. |
-| visible | [bool](#bool) | | The visible is whether the index is visible. |
-| comment | [string](#string) | | The comment is the comment of an index. |
-| definition | [string](#string) | | The definition of an index. |
-| parent_index_schema | [string](#string) | | The schema name of the parent index. |
-| parent_index_name | [string](#string) | | The index name of the parent index. |
-| granularity | [int64](#int64) | | The number of granules in the block. It&#39;s a ClickHouse specific field. |
-| is_constraint | [bool](#bool) | | It&#39;s a PostgreSQL specific field. The unique constraint and unique index are not the same thing in PostgreSQL. |
+| krb_config | [KerberosConfig](#bytebase-store-KerberosConfig) | | |
+
-<a name="bytebase-store-InstanceRoleMetadata"></a>
-### InstanceRoleMetadata
-InstanceRoleMetadata is the message for instance role.
+<a name="bytebase-store-DataSourceExternalSecret-AppRoleAuthOption-SecretType"></a>
+### DataSourceExternalSecret.AppRoleAuthOption.SecretType
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The role name. It&#39;s unique within the instance. |
-| grant | [string](#string) | | The grant display string on the instance. It&#39;s generated by database engine. |
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| SECRET_TYPE_UNSPECIFIED | 0 | |
+| PLAIN | 1 | |
+| ENVIRONMENT | 2 | |
+<a name="bytebase-store-DataSourceExternalSecret-AuthType"></a>
+### DataSourceExternalSecret.AuthType
-<a name="bytebase-store-LinkedDatabaseMetadata"></a>
-### LinkedDatabaseMetadata
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| AUTH_TYPE_UNSPECIFIED | 0 | |
+| TOKEN | 1 | ref: https://developer.hashicorp.com/vault/docs/auth/token |
+| VAULT_APP_ROLE | 2 | ref: https://developer.hashicorp.com/vault/docs/auth/approle |
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | |
-| username | [string](#string) | | |
-| host | [string](#string) | | |
+<a name="bytebase-store-DataSourceExternalSecret-SecretType"></a>
+### DataSourceExternalSecret.SecretType
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| SAECRET_TYPE_UNSPECIFIED | 0 | |
+| VAULT_KV_V2 | 1 | ref: https://developer.hashicorp.com/vault/api-docs/secret/kv/kv-v2 |
+| AWS_SECRETS_MANAGER | 2 | ref: https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html |
+| GCP_SECRET_MANAGER | 3 | ref: https://cloud.google.com/secret-manager/docs |
-<a name="bytebase-store-MaterializedViewMetadata"></a>
+<a name="bytebase-store-DataSourceOptions-AuthenticationType"></a>
-### MaterializedViewMetadata
-MaterializedViewMetadata is the metadata for materialized views.
+### DataSourceOptions.AuthenticationType
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of a view. |
-| definition | [string](#string) | | The definition is the definition of a view. |
-| comment | [string](#string) | | The comment is the comment of a view. |
-| dependency_columns | [DependencyColumn](#bytebase-store-DependencyColumn) | repeated | The dependency_columns is the list of dependency columns of a view. |
-| triggers | [TriggerMetadata](#bytebase-store-TriggerMetadata) | repeated | The columns is the ordered list of columns in a table. |
-| indexes | [IndexMetadata](#bytebase-store-IndexMetadata) | repeated | The indexes is the list of indexes in a table. |
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| AUTHENTICATION_UNSPECIFIED | 0 | |
+| PASSWORD | 1 | |
+| GOOGLE_CLOUD_SQL_IAM | 2 | |
+| AWS_RDS_IAM | 3 | |
+<a name="bytebase-store-DataSourceOptions-RedisType"></a>
+### DataSourceOptions.RedisType
-<a name="bytebase-store-ObjectSchema"></a>
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| REDIS_TYPE_UNSPECIFIED | 0 | |
+| STANDALONE | 1 | |
+| SENTINEL | 2 | |
+| CLUSTER | 3 | |
-### ObjectSchema
+
+
+
+
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| type | [ObjectSchema.Type](#bytebase-store-ObjectSchema-Type) | | |
-| struct_kind | [ObjectSchema.StructKind](#bytebase-store-ObjectSchema-StructKind) | | |
-| array_kind | [ObjectSchema.ArrayKind](#bytebase-store-ObjectSchema-ArrayKind) | | |
-| semantic_type | [string](#string) | | |
+<a name="store_database-proto"></a>
+<p align="right"><a href="#top">Top</a></p>
+## store/database.proto
-<a name="bytebase-store-ObjectSchema-ArrayKind"></a>
+<a name="bytebase-store-CheckConstraintMetadata"></a>
-### ObjectSchema.ArrayKind
+### CheckConstraintMetadata
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| kind | [ObjectSchema](#bytebase-store-ObjectSchema) | | |
+| name | [string](#string) | | The name is the name of a check constraint. |
+| expression | [string](#string) | | The expression is the expression of a check constraint. |
-<a name="bytebase-store-ObjectSchema-StructKind"></a>
+<a name="bytebase-store-ColumnCatalog"></a>
-### ObjectSchema.StructKind
+### ColumnCatalog
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| properties | [ObjectSchema.StructKind.PropertiesEntry](#bytebase-store-ObjectSchema-StructKind-PropertiesEntry) | repeated | |
+| name | [string](#string) | | The name is the name of a column. |
+| semantic_type | [string](#string) | | |
+| labels | [ColumnCatalog.LabelsEntry](#bytebase-store-ColumnCatalog-LabelsEntry) | repeated | The user labels for a column. |
+| classification | [string](#string) | | |
+| object_schema | [ObjectSchema](#bytebase-store-ObjectSchema) | optional | |
+| masking_level | [MaskingLevel](#bytebase-store-MaskingLevel) | | Deprecated. |
+| full_masking_algorithm_id | [string](#string) | | Deprecated. |
+| partial_masking_algorithm_id | [string](#string) | | Deprecated. |
-<a name="bytebase-store-ObjectSchema-StructKind-PropertiesEntry"></a>
+<a name="bytebase-store-ColumnCatalog-LabelsEntry"></a>
-### ObjectSchema.StructKind.PropertiesEntry
+### ColumnCatalog.LabelsEntry
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| key | [string](#string) | | |
-| value | [ObjectSchema](#bytebase-store-ObjectSchema) | | |
+| value | [string](#string) | | |
-<a name="bytebase-store-PackageMetadata"></a>
+<a name="bytebase-store-ColumnMetadata"></a>
-### PackageMetadata
-PackageMetadata is the metadata for packages.
+### ColumnMetadata
+ColumnMetadata is the metadata for columns.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of a package. |
-| definition | [string](#string) | | The definition is the definition of a package. |
+| name | [string](#string) | | The name is the name of a column. |
+| position | [int32](#int32) | | The position is the position in columns. |
+| default | [google.protobuf.StringValue](#google-protobuf-StringValue) | | The default is the default of a column. Use google.protobuf.StringValue to distinguish between an empty string default value or no default. |
+| default_null | [bool](#bool) | | |
+| default_expression | [string](#string) | | |
+| on_update | [string](#string) | | The on_update is the on update action of a column. For MySQL like databases, it&#39;s only supported for TIMESTAMP columns with CURRENT_TIMESTAMP as on update value. |
+| nullable | [bool](#bool) | | The nullable is the nullable of a column. |
+| type | [string](#string) | | The type is the type of a column. |
+| character_set | [string](#string) | | The character_set is the character_set of a column. |
+| collation | [string](#string) | | The collation is the collation of a column. |
+| comment | [string](#string) | | The comment is the comment of a column. classification and user_comment is parsed from the comment. |
+| user_comment | [string](#string) | | The user_comment is the user comment of a table parsed from the comment. |
+| generation | [GenerationMetadata](#bytebase-store-GenerationMetadata) | | The generation is for generated columns. |
-<a name="bytebase-store-ProcedureConfig"></a>
+<a name="bytebase-store-DatabaseConfig"></a>
-### ProcedureConfig
+### DatabaseConfig
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of a procedure. |
-| updater | [string](#string) | | The last updater of the procedure in branch. Format: users/{userUID}. |
-| source_branch | [string](#string) | | The last change come from branch. Format: projcets/{project}/branches/{branch} |
-| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The timestamp when the procedure is updated in branch. |
+| name | [string](#string) | | |
+| schemas | [SchemaCatalog](#bytebase-store-SchemaCatalog) | repeated | The schema_configs is the list of configs for schemas in a database. |
-<a name="bytebase-store-ProcedureMetadata"></a>
+<a name="bytebase-store-DatabaseMetadata"></a>
-### ProcedureMetadata
-ProcedureMetadata is the metadata for procedures.
+### DatabaseMetadata
+DatabaseMetadata is the metadata for databases.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of a procedure. |
-| definition | [string](#string) | | The definition is the definition of a procedure. |
-| signature | [string](#string) | | The signature is the name with the number and type of input arguments the function takes. |
-| character_set_client | [string](#string) | | MySQL specific metadata. |
-| collation_connection | [string](#string) | | |
-| database_collation | [string](#string) | | |
-| sql_mode | [string](#string) | | |
+| labels | [DatabaseMetadata.LabelsEntry](#bytebase-store-DatabaseMetadata-LabelsEntry) | repeated | |
+| last_sync_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
+| backup_available | [bool](#bool) | | |
-<a name="bytebase-store-SchemaCatalog"></a>
+<a name="bytebase-store-DatabaseMetadata-LabelsEntry"></a>
-### SchemaCatalog
+### DatabaseMetadata.LabelsEntry
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the schema name. It is an empty string for databases without such concept such as MySQL. |
-| tables | [TableCatalog](#bytebase-store-TableCatalog) | repeated | The table_configs is the list of configs for tables in a schema. |
-| function_configs | [FunctionConfig](#bytebase-store-FunctionConfig) | repeated | |
-| procedure_configs | [ProcedureConfig](#bytebase-store-ProcedureConfig) | repeated | |
-| view_configs | [ViewConfig](#bytebase-store-ViewConfig) | repeated | |
+| key | [string](#string) | | |
+| value | [string](#string) | | |
-<a name="bytebase-store-SchemaMetadata"></a>
+<a name="bytebase-store-DatabaseSchemaMetadata"></a>
-### SchemaMetadata
-SchemaMetadata is the metadata for schemas.
-This is the concept of schema in Postgres, but it&#39;s a no-op for MySQL.
+### DatabaseSchemaMetadata
+DatabaseSchemaMetadata is the schema metadata for databases.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the schema name. It is an empty string for databases without such concept such as MySQL. |
-| tables | [TableMetadata](#bytebase-store-TableMetadata) | repeated | The tables is the list of tables in a schema. |
-| external_tables | [ExternalTableMetadata](#bytebase-store-ExternalTableMetadata) | repeated | The external_tables is the list of external tables in a schema. |
-| views | [ViewMetadata](#bytebase-store-ViewMetadata) | repeated | The views is the list of views in a schema. |
-| functions | [FunctionMetadata](#bytebase-store-FunctionMetadata) | repeated | The functions is the list of functions in a schema. |
-| procedures | [ProcedureMetadata](#bytebase-store-ProcedureMetadata) | repeated | The procedures is the list of procedures in a schema. |
-| streams | [StreamMetadata](#bytebase-store-StreamMetadata) | repeated | The streams is the list of streams in a schema, currently, only used for Snowflake. |
-| tasks | [TaskMetadata](#bytebase-store-TaskMetadata) | repeated | The routines is the list of routines in a schema, currently, only used for Snowflake. |
-| materialized_views | [MaterializedViewMetadata](#bytebase-store-MaterializedViewMetadata) | repeated | The materialized_views is the list of materialized views in a schema. |
-| sequences | [SequenceMetadata](#bytebase-store-SequenceMetadata) | repeated | The sequences is the list of sequences in a schema. |
-| packages | [PackageMetadata](#bytebase-store-PackageMetadata) | repeated | The packages is the list of packages in a schema. |
+| name | [string](#string) | | |
+| schemas | [SchemaMetadata](#bytebase-store-SchemaMetadata) | repeated | The schemas is the list of schemas in a database. |
+| character_set | [string](#string) | | The character_set is the character set of a database. |
+| collation | [string](#string) | | The collation is the collation of a database. |
+| extensions | [ExtensionMetadata](#bytebase-store-ExtensionMetadata) | repeated | The extensions is the list of extensions in a database. |
+| datashare | [bool](#bool) | | The database belongs to a datashare. |
+| service_name | [string](#string) | | The service name of the database. It&#39;s the Oracle specific concept. |
+| linked_databases | [LinkedDatabaseMetadata](#bytebase-store-LinkedDatabaseMetadata) | repeated | |
| owner | [string](#string) | | |
-| events | [EventMetadata](#bytebase-store-EventMetadata) | repeated | |
-| enum_types | [EnumTypeMetadata](#bytebase-store-EnumTypeMetadata) | repeated | |
-
-<a name="bytebase-store-SecretItem"></a>
-### SecretItem
+<a name="bytebase-store-DependencyColumn"></a>
+### DependencyColumn
+DependencyColumn is the metadata for dependency columns.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of the secret. |
-| value | [string](#string) | | The value is the value of the secret. |
-| description | [string](#string) | | The description is the description of the secret. |
+| schema | [string](#string) | | The schema is the schema of a reference column. |
+| table | [string](#string) | | The table is the table of a reference column. |
+| column | [string](#string) | | The column is the name of a reference column. |
-<a name="bytebase-store-Secrets"></a>
+<a name="bytebase-store-DependencyTable"></a>
-### Secrets
+### DependencyTable
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| items | [SecretItem](#bytebase-store-SecretItem) | repeated | The list of secrets. |
+| schema | [string](#string) | | The schema is the schema of a reference table. |
+| table | [string](#string) | | The table is the name of a reference table. |
-<a name="bytebase-store-SequenceMetadata"></a>
+<a name="bytebase-store-EnumTypeMetadata"></a>
-### SequenceMetadata
+### EnumTypeMetadata
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name of a sequence. |
-| data_type | [string](#string) | | The data type of a sequence. |
-| start | [string](#string) | | The start value of a sequence. |
-| min_value | [string](#string) | | The minimum value of a sequence. |
-| max_value | [string](#string) | | The maximum value of a sequence. |
-| increment | [string](#string) | | Increment value of a sequence. |
-| cycle | [bool](#bool) | | Cycle is whether the sequence cycles. |
-| cache_size | [string](#string) | | Cache size of a sequence. |
-| last_value | [string](#string) | | Last value of a sequence. |
-| owner_table | [string](#string) | | The owner table of the sequence. |
-| owner_column | [string](#string) | | The owner column of the sequence. |
+| name | [string](#string) | | The name of a type. |
+| values | [string](#string) | repeated | The enum values of a type. |
| comment | [string](#string) | | |
@@ -1545,758 +1531,720 @@ This is the concept of schema in Postgres, but it&#39;s a no-op for MySQL.
-<a name="bytebase-store-StreamMetadata"></a>
+<a name="bytebase-store-EventMetadata"></a>
-### StreamMetadata
+### EventMetadata
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of a stream. |
-| table_name | [string](#string) | | The table_name is the name of the table/view that the stream is created on. |
-| owner | [string](#string) | | The owner of the stream. |
-| comment | [string](#string) | | The comment of the stream. |
-| type | [StreamMetadata.Type](#bytebase-store-StreamMetadata-Type) | | The type of the stream. |
-| stale | [bool](#bool) | | Indicates whether the stream was last read before the `stale_after` time. |
-| mode | [StreamMetadata.Mode](#bytebase-store-StreamMetadata-Mode) | | The mode of the stream. |
-| definition | [string](#string) | | The definition of the stream. |
-
+| name | [string](#string) | | The name of the event. |
+| definition | [string](#string) | | The schedule of the event. |
+| time_zone | [string](#string) | | The time zone of the event. |
+| sql_mode | [string](#string) | | |
+| character_set_client | [string](#string) | | |
+| collation_connection | [string](#string) | | |
-<a name="bytebase-store-TableCatalog"></a>
-### TableCatalog
+<a name="bytebase-store-ExtensionMetadata"></a>
+### ExtensionMetadata
+ExtensionMetadata is the metadata for extensions.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of a table. |
-| columns | [ColumnCatalog](#bytebase-store-ColumnCatalog) | repeated | The column_configs is the ordered list of configs for columns in a table. |
-| object_schema | [ObjectSchema](#bytebase-store-ObjectSchema) | optional | |
-| classification | [string](#string) | | |
-| updater | [string](#string) | | The last updater of the table in branch. Format: users/{userUID}. |
-| source_branch | [string](#string) | | The last change come from branch. Format: projcets/{project}/branches/{branch} |
-| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The timestamp when the table is updated in branch. |
+| name | [string](#string) | | The name is the name of an extension. |
+| schema | [string](#string) | | The schema is the extension that is installed to. But the extension usage is not limited to the schema. |
+| version | [string](#string) | | The version is the version of an extension. |
+| description | [string](#string) | | The description is the description of an extension. |
-<a name="bytebase-store-TableMetadata"></a>
+<a name="bytebase-store-ExternalTableMetadata"></a>
+
+### ExternalTableMetadata
-### TableMetadata
-TableMetadata is the metadata for tables.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of a table. |
-| columns | [ColumnMetadata](#bytebase-store-ColumnMetadata) | repeated | The columns is the ordered list of columns in a table. |
-| indexes | [IndexMetadata](#bytebase-store-IndexMetadata) | repeated | The indexes is the list of indexes in a table. |
-| engine | [string](#string) | | The engine is the engine of a table. |
-| collation | [string](#string) | | The collation is the collation of a table. |
-| charset | [string](#string) | | The character set of table. |
-| row_count | [int64](#int64) | | The row_count is the estimated number of rows of a table. |
-| data_size | [int64](#int64) | | The data_size is the estimated data size of a table. |
-| index_size | [int64](#int64) | | The index_size is the estimated index size of a table. |
-| data_free | [int64](#int64) | | The data_free is the estimated free data size of a table. |
-| create_options | [string](#string) | | The create_options is the create option of a table. |
-| comment | [string](#string) | | The comment is the comment of a table. classification and user_comment is parsed from the comment. |
-| user_comment | [string](#string) | | The user_comment is the user comment of a table parsed from the comment. |
-| foreign_keys | [ForeignKeyMetadata](#bytebase-store-ForeignKeyMetadata) | repeated | The foreign_keys is the list of foreign keys in a table. |
-| partitions | [TablePartitionMetadata](#bytebase-store-TablePartitionMetadata) | repeated | The partitions is the list of partitions in a table. |
-| check_constraints | [CheckConstraintMetadata](#bytebase-store-CheckConstraintMetadata) | repeated | The check_constraints is the list of check constraints in a table. |
-| owner | [string](#string) | | |
-| sorting_keys | [string](#string) | repeated | The sorting_keys is a tuple of column names or arbitrary expressions. ClickHouse specific field. Reference: https://clickhouse.com/docs/en/engines/table-engines/mergetree-family/mergetree#order_by |
-| triggers | [TriggerMetadata](#bytebase-store-TriggerMetadata) | repeated | |
+| name | [string](#string) | | The name is the name of a external table. |
+| external_server_name | [string](#string) | | The external_server_name is the name of the external server. |
+| external_database_name | [string](#string) | | The external_database_name is the name of the external database. |
+| columns | [ColumnMetadata](#bytebase-store-ColumnMetadata) | repeated | The columns is the ordered list of columns in a foreign table. |
-<a name="bytebase-store-TablePartitionMetadata"></a>
+<a name="bytebase-store-ForeignKeyMetadata"></a>
-### TablePartitionMetadata
-TablePartitionMetadata is the metadata for table partitions.
+### ForeignKeyMetadata
+ForeignKeyMetadata is the metadata for foreign keys.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of a table partition. |
-| type | [TablePartitionMetadata.Type](#bytebase-store-TablePartitionMetadata-Type) | | The type of a table partition. |
-| expression | [string](#string) | | The expression is the expression of a table partition. For PostgreSQL, the expression is the text of {FOR VALUES partition_bound_spec}, see https://www.postgresql.org/docs/current/sql-createtable.html. For MySQL, the expression is the `expr` or `column_list` of the following syntax. PARTITION BY { [LINEAR] HASH(expr) | [LINEAR] KEY [ALGORITHM={1 | 2}] (column_list) | RANGE{(expr) | COLUMNS(column_list)} | LIST{(expr) | COLUMNS(column_list)} }. |
-| value | [string](#string) | | The value is the value of a table partition. For MySQL, the value is for RANGE and LIST partition types, - For a RANGE partition, it contains the value set in the partition&#39;s VALUES LESS THAN clause, which can be either an integer or MAXVALUE. - For a LIST partition, this column contains the values defined in the partition&#39;s VALUES IN clause, which is a list of comma-separated integer values. - For others, it&#39;s an empty string. |
-| use_default | [string](#string) | | The use_default is whether the users use the default partition, it stores the different value for different database engines. For MySQL, it&#39;s [INT] type, 0 means not use default partition, otherwise, it&#39;s equals to number in syntax [SUB]PARTITION {number}. |
-| subpartitions | [TablePartitionMetadata](#bytebase-store-TablePartitionMetadata) | repeated | The subpartitions is the list of subpartitions in a table partition. |
-| indexes | [IndexMetadata](#bytebase-store-IndexMetadata) | repeated | |
+| name | [string](#string) | | The name is the name of a foreign key. |
+| columns | [string](#string) | repeated | The columns are the ordered referencing columns of a foreign key. |
+| referenced_schema | [string](#string) | | The referenced_schema is the referenced schema name of a foreign key. It is an empty string for databases without such concept such as MySQL. |
+| referenced_table | [string](#string) | | The referenced_table is the referenced table name of a foreign key. |
+| referenced_columns | [string](#string) | repeated | The referenced_columns are the ordered referenced columns of a foreign key. |
+| on_delete | [string](#string) | | The on_delete is the on delete action of a foreign key. |
+| on_update | [string](#string) | | The on_update is the on update action of a foreign key. |
+| match_type | [string](#string) | | The match_type is the match type of a foreign key. The match_type is the PostgreSQL specific field. It&#39;s empty string for other databases. |
-<a name="bytebase-store-TaskMetadata"></a>
+<a name="bytebase-store-FunctionConfig"></a>
-### TaskMetadata
+### FunctionConfig
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of a task. |
-| id | [string](#string) | | The id is the snowflake-generated id of a task. Example: 01ad32a0-1bb6-5e93-0000-000000000001 |
-| owner | [string](#string) | | The owner of the task. |
-| comment | [string](#string) | | The comment of the task. |
-| warehouse | [string](#string) | | The warehouse of the task. |
-| schedule | [string](#string) | | The schedule interval of the task. |
-| predecessors | [string](#string) | repeated | The predecessor tasks of the task. |
-| state | [TaskMetadata.State](#bytebase-store-TaskMetadata-State) | | The state of the task. |
-| condition | [string](#string) | | The condition of the task. |
-| definition | [string](#string) | | The definition of the task. |
-
+| name | [string](#string) | | The name is the name of a function. |
+| updater | [string](#string) | | The last updater of the function in branch. Format: users/{userUID}. |
+| source_branch | [string](#string) | | The last change come from branch. Format: projcets/{project}/branches/{branch} |
+| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The timestamp when the function is updated in branch. |
-<a name="bytebase-store-TriggerMetadata"></a>
-### TriggerMetadata
+<a name="bytebase-store-FunctionMetadata"></a>
+### FunctionMetadata
+FunctionMetadata is the metadata for functions.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of the trigger. |
-| event | [string](#string) | | The event is the event of the trigger, such as INSERT, UPDATE, DELETE, TRUNCATE. |
-| timing | [string](#string) | | The timing is the timing of the trigger, such as BEFORE, AFTER. |
-| body | [string](#string) | | The body is the body of the trigger. |
-| sql_mode | [string](#string) | | |
-| character_set_client | [string](#string) | | |
+| name | [string](#string) | | The name is the name of a function. |
+| definition | [string](#string) | | The definition is the definition of a function. |
+| signature | [string](#string) | | The signature is the name with the number and type of input arguments the function takes. |
+| character_set_client | [string](#string) | | MySQL specific metadata. |
| collation_connection | [string](#string) | | |
+| database_collation | [string](#string) | | |
+| sql_mode | [string](#string) | | |
| comment | [string](#string) | | |
+| dependency_tables | [DependencyTable](#bytebase-store-DependencyTable) | repeated | The dependency_tables is the list of dependency tables of a function. For PostgreSQL, it&#39;s the list of tables that the function depends on the return type definition. |
-<a name="bytebase-store-ViewConfig"></a>
+<a name="bytebase-store-GenerationMetadata"></a>
-### ViewConfig
+### GenerationMetadata
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of a view. |
-| updater | [string](#string) | | The last updater of the view in branch. Format: users/{userUID}. |
-| source_branch | [string](#string) | | The last change come from branch. Format: projcets/{project}/branches/{branch} |
-| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The timestamp when the view is updated in branch. |
+| type | [GenerationMetadata.Type](#bytebase-store-GenerationMetadata-Type) | | |
+| expression | [string](#string) | | |
-<a name="bytebase-store-ViewMetadata"></a>
+<a name="bytebase-store-IndexMetadata"></a>
-### ViewMetadata
-ViewMetadata is the metadata for views.
+### IndexMetadata
+IndexMetadata is the metadata for indexes.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name is the name of a view. |
-| definition | [string](#string) | | The definition is the definition of a view. |
-| comment | [string](#string) | | The comment is the comment of a view. |
-| dependency_columns | [DependencyColumn](#bytebase-store-DependencyColumn) | repeated | The dependency_columns is the list of dependency columns of a view. |
-| columns | [ColumnMetadata](#bytebase-store-ColumnMetadata) | repeated | The columns is the ordered list of columns in a table. |
-| triggers | [TriggerMetadata](#bytebase-store-TriggerMetadata) | repeated | The triggers is the list of triggers in a view. |
+| name | [string](#string) | | The name is the name of an index. |
+| expressions | [string](#string) | repeated | The expressions are the ordered columns or expressions of an index. This could refer to a column or an expression. |
+| key_length | [int64](#int64) | repeated | The key_lengths are the ordered key lengths of an index. If the key length is not specified, it&#39;s -1. |
+| descending | [bool](#bool) | repeated | The descending is the ordered descending of an index. |
+| type | [string](#string) | | The type is the type of an index. |
+| unique | [bool](#bool) | | The unique is whether the index is unique. |
+| primary | [bool](#bool) | | The primary is whether the index is a primary key index. |
+| visible | [bool](#bool) | | The visible is whether the index is visible. |
+| comment | [string](#string) | | The comment is the comment of an index. |
+| definition | [string](#string) | | The definition of an index. |
+| parent_index_schema | [string](#string) | | The schema name of the parent index. |
+| parent_index_name | [string](#string) | | The index name of the parent index. |
+| granularity | [int64](#int64) | | The number of granules in the block. It&#39;s a ClickHouse specific field. |
+| is_constraint | [bool](#bool) | | It&#39;s a PostgreSQL specific field. The unique constraint and unique index are not the same thing in PostgreSQL. |
-
+<a name="bytebase-store-InstanceRoleMetadata"></a>
-<a name="bytebase-store-GenerationMetadata-Type"></a>
+### InstanceRoleMetadata
+InstanceRoleMetadata is the message for instance role.
-### GenerationMetadata.Type
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| name | [string](#string) | | The role name. It&#39;s unique within the instance. |
+| grant | [string](#string) | | The grant display string on the instance. It&#39;s generated by database engine. |
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| TYPE_UNSPECIFIED | 0 | |
-| TYPE_VIRTUAL | 1 | |
-| TYPE_STORED | 2 | |
-<a name="bytebase-store-ObjectSchema-Type"></a>
-### ObjectSchema.Type
+<a name="bytebase-store-LinkedDatabaseMetadata"></a>
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| TYPE_UNSPECIFIED | 0 | |
-| STRING | 1 | |
-| NUMBER | 2 | |
-| BOOLEAN | 3 | |
-| OBJECT | 4 | |
-| ARRAY | 5 | |
+### LinkedDatabaseMetadata
-<a name="bytebase-store-StreamMetadata-Mode"></a>
-
-### StreamMetadata.Mode
-
-
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| MODE_UNSPECIFIED | 0 | |
-| MODE_DEFAULT | 1 | |
-| MODE_APPEND_ONLY | 2 | |
-| MODE_INSERT_ONLY | 3 | |
-
-
-
-<a name="bytebase-store-StreamMetadata-Type"></a>
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| name | [string](#string) | | |
+| username | [string](#string) | | |
+| host | [string](#string) | | |
-### StreamMetadata.Type
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| TYPE_UNSPECIFIED | 0 | |
-| TYPE_DELTA | 1 | |
-<a name="bytebase-store-TablePartitionMetadata-Type"></a>
+<a name="bytebase-store-MaterializedViewMetadata"></a>
-### TablePartitionMetadata.Type
-Type is the type of a table partition, some database engines may not
-support all types. Only avilable for the following database engines now:
-MySQL: RANGE, RANGE COLUMNS, LIST, LIST COLUMNS, HASH, LINEAR HASH, KEY,
-LINEAR_KEY
-(https://dev.mysql.com/doc/refman/8.0/en/partitioning-types.html) TiDB:
-RANGE, RANGE COLUMNS, LIST, LIST COLUMNS, HASH, KEY PostgreSQL: RANGE,
-LIST, HASH (https://www.postgresql.org/docs/current/ddl-partitioning.html)
+### MaterializedViewMetadata
+MaterializedViewMetadata is the metadata for materialized views.
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| TYPE_UNSPECIFIED | 0 | |
-| RANGE | 1 | |
-| RANGE_COLUMNS | 2 | |
-| LIST | 3 | |
-| LIST_COLUMNS | 4 | |
-| HASH | 5 | |
-| LINEAR_HASH | 6 | |
-| KEY | 7 | |
-| LINEAR_KEY | 8 | |
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| name | [string](#string) | | The name is the name of a view. |
+| definition | [string](#string) | | The definition is the definition of a view. |
+| comment | [string](#string) | | The comment is the comment of a view. |
+| dependency_columns | [DependencyColumn](#bytebase-store-DependencyColumn) | repeated | The dependency_columns is the list of dependency columns of a view. |
+| triggers | [TriggerMetadata](#bytebase-store-TriggerMetadata) | repeated | The columns is the ordered list of columns in a table. |
+| indexes | [IndexMetadata](#bytebase-store-IndexMetadata) | repeated | The indexes is the list of indexes in a table. |
-<a name="bytebase-store-TaskMetadata-State"></a>
-### TaskMetadata.State
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| STATE_UNSPECIFIED | 0 | |
-| STATE_STARTED | 1 | |
-| STATE_SUSPENDED | 2 | |
+<a name="bytebase-store-ObjectSchema"></a>
-
+### ObjectSchema
-
-
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| type | [ObjectSchema.Type](#bytebase-store-ObjectSchema-Type) | | |
+| struct_kind | [ObjectSchema.StructKind](#bytebase-store-ObjectSchema-StructKind) | | |
+| array_kind | [ObjectSchema.ArrayKind](#bytebase-store-ObjectSchema-ArrayKind) | | |
+| semantic_type | [string](#string) | | |
-<a name="store_branch-proto"></a>
-<p align="right"><a href="#top">Top</a></p>
-## store/branch.proto
-<a name="bytebase-store-BranchConfig"></a>
+<a name="bytebase-store-ObjectSchema-ArrayKind"></a>
-### BranchConfig
+### ObjectSchema.ArrayKind
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| source_database | [string](#string) | | The name of source database. Optional. Example: instances/instance-id/databases/database-name. |
-| source_branch | [string](#string) | | The name of the source branch. Optional. Example: projects/project-id/branches/branch-id. |
+| kind | [ObjectSchema](#bytebase-store-ObjectSchema) | | |
-<a name="bytebase-store-BranchSnapshot"></a>
+<a name="bytebase-store-ObjectSchema-StructKind"></a>
-### BranchSnapshot
+### ObjectSchema.StructKind
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| metadata | [DatabaseSchemaMetadata](#bytebase-store-DatabaseSchemaMetadata) | | |
-| database_config | [DatabaseConfig](#bytebase-store-DatabaseConfig) | | |
-
-
-
-
-
-
-
-
-
-
-
-
-
+| properties | [ObjectSchema.StructKind.PropertiesEntry](#bytebase-store-ObjectSchema-StructKind-PropertiesEntry) | repeated | |
-<a name="store_changelist-proto"></a>
-<p align="right"><a href="#top">Top</a></p>
-## store/changelist.proto
-<a name="bytebase-store-Changelist"></a>
+<a name="bytebase-store-ObjectSchema-StructKind-PropertiesEntry"></a>
-### Changelist
+### ObjectSchema.StructKind.PropertiesEntry
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| description | [string](#string) | | |
-| changes | [Changelist.Change](#bytebase-store-Changelist-Change) | repeated | |
-
+| key | [string](#string) | | |
+| value | [ObjectSchema](#bytebase-store-ObjectSchema) | | |
-<a name="bytebase-store-Changelist-Change"></a>
-### Changelist.Change
+<a name="bytebase-store-PackageMetadata"></a>
+### PackageMetadata
+PackageMetadata is the metadata for packages.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| sheet | [string](#string) | | The name of a sheet. |
-| source | [string](#string) | | The source of origin. 1) changes: instances/{instance}/databases/{database}/changelogs/{changelog}. 2) raw SQL if empty. |
-| version | [string](#string) | | The migration version for a change. |
+| name | [string](#string) | | The name is the name of a package. |
+| definition | [string](#string) | | The definition is the definition of a package. |
-
-
+<a name="bytebase-store-ProcedureConfig"></a>
-
+### ProcedureConfig
-
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| name | [string](#string) | | The name is the name of a procedure. |
+| updater | [string](#string) | | The last updater of the procedure in branch. Format: users/{userUID}. |
+| source_branch | [string](#string) | | The last change come from branch. Format: projcets/{project}/branches/{branch} |
+| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The timestamp when the procedure is updated in branch. |
-<a name="store_changelog-proto"></a>
-<p align="right"><a href="#top">Top</a></p>
-## store/changelog.proto
-<a name="bytebase-store-ChangedResourceDatabase"></a>
-### ChangedResourceDatabase
+<a name="bytebase-store-ProcedureMetadata"></a>
+### ProcedureMetadata
+ProcedureMetadata is the metadata for procedures.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | |
-| schemas | [ChangedResourceSchema](#bytebase-store-ChangedResourceSchema) | repeated | |
+| name | [string](#string) | | The name is the name of a procedure. |
+| definition | [string](#string) | | The definition is the definition of a procedure. |
+| signature | [string](#string) | | The signature is the name with the number and type of input arguments the function takes. |
+| character_set_client | [string](#string) | | MySQL specific metadata. |
+| collation_connection | [string](#string) | | |
+| database_collation | [string](#string) | | |
+| sql_mode | [string](#string) | | |
-<a name="bytebase-store-ChangedResourceFunction"></a>
+<a name="bytebase-store-SchemaCatalog"></a>
-### ChangedResourceFunction
+### SchemaCatalog
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | |
-| ranges | [Range](#bytebase-store-Range) | repeated | The ranges of sub-strings correspond to the statements on the sheet. |
-
+| name | [string](#string) | | The name is the schema name. It is an empty string for databases without such concept such as MySQL. |
+| tables | [TableCatalog](#bytebase-store-TableCatalog) | repeated | The table_configs is the list of configs for tables in a schema. |
+| function_configs | [FunctionConfig](#bytebase-store-FunctionConfig) | repeated | |
+| procedure_configs | [ProcedureConfig](#bytebase-store-ProcedureConfig) | repeated | |
+| view_configs | [ViewConfig](#bytebase-store-ViewConfig) | repeated | |
-<a name="bytebase-store-ChangedResourceProcedure"></a>
-### ChangedResourceProcedure
+<a name="bytebase-store-SchemaMetadata"></a>
+### SchemaMetadata
+SchemaMetadata is the metadata for schemas.
+This is the concept of schema in Postgres, but it&#39;s a no-op for MySQL.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | |
-| ranges | [Range](#bytebase-store-Range) | repeated | The ranges of sub-strings correspond to the statements on the sheet. |
+| name | [string](#string) | | The name is the schema name. It is an empty string for databases without such concept such as MySQL. |
+| tables | [TableMetadata](#bytebase-store-TableMetadata) | repeated | The tables is the list of tables in a schema. |
+| external_tables | [ExternalTableMetadata](#bytebase-store-ExternalTableMetadata) | repeated | The external_tables is the list of external tables in a schema. |
+| views | [ViewMetadata](#bytebase-store-ViewMetadata) | repeated | The views is the list of views in a schema. |
+| functions | [FunctionMetadata](#bytebase-store-FunctionMetadata) | repeated | The functions is the list of functions in a schema. |
+| procedures | [ProcedureMetadata](#bytebase-store-ProcedureMetadata) | repeated | The procedures is the list of procedures in a schema. |
+| streams | [StreamMetadata](#bytebase-store-StreamMetadata) | repeated | The streams is the list of streams in a schema, currently, only used for Snowflake. |
+| tasks | [TaskMetadata](#bytebase-store-TaskMetadata) | repeated | The routines is the list of routines in a schema, currently, only used for Snowflake. |
+| materialized_views | [MaterializedViewMetadata](#bytebase-store-MaterializedViewMetadata) | repeated | The materialized_views is the list of materialized views in a schema. |
+| sequences | [SequenceMetadata](#bytebase-store-SequenceMetadata) | repeated | The sequences is the list of sequences in a schema. |
+| packages | [PackageMetadata](#bytebase-store-PackageMetadata) | repeated | The packages is the list of packages in a schema. |
+| owner | [string](#string) | | |
+| events | [EventMetadata](#bytebase-store-EventMetadata) | repeated | |
+| enum_types | [EnumTypeMetadata](#bytebase-store-EnumTypeMetadata) | repeated | |
-<a name="bytebase-store-ChangedResourceSchema"></a>
+<a name="bytebase-store-SecretItem"></a>
-### ChangedResourceSchema
+### SecretItem
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | |
-| tables | [ChangedResourceTable](#bytebase-store-ChangedResourceTable) | repeated | |
-| views | [ChangedResourceView](#bytebase-store-ChangedResourceView) | repeated | |
-| functions | [ChangedResourceFunction](#bytebase-store-ChangedResourceFunction) | repeated | |
-| procedures | [ChangedResourceProcedure](#bytebase-store-ChangedResourceProcedure) | repeated | |
+| name | [string](#string) | | The name is the name of the secret. |
+| value | [string](#string) | | The value is the value of the secret. |
+| description | [string](#string) | | The description is the description of the secret. |
-<a name="bytebase-store-ChangedResourceTable"></a>
+<a name="bytebase-store-Secrets"></a>
-### ChangedResourceTable
+### Secrets
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | |
-| table_rows | [int64](#int64) | | estimated row count of the table |
-| ranges | [Range](#bytebase-store-Range) | repeated | The ranges of sub-strings correspond to the statements on the sheet. |
+| items | [SecretItem](#bytebase-store-SecretItem) | repeated | The list of secrets. |
-<a name="bytebase-store-ChangedResourceView"></a>
+<a name="bytebase-store-SequenceMetadata"></a>
-### ChangedResourceView
+### SequenceMetadata
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | |
-| ranges | [Range](#bytebase-store-Range) | repeated | The ranges of sub-strings correspond to the statements on the sheet. |
+| name | [string](#string) | | The name of a sequence. |
+| data_type | [string](#string) | | The data type of a sequence. |
+| start | [string](#string) | | The start value of a sequence. |
+| min_value | [string](#string) | | The minimum value of a sequence. |
+| max_value | [string](#string) | | The maximum value of a sequence. |
+| increment | [string](#string) | | Increment value of a sequence. |
+| cycle | [bool](#bool) | | Cycle is whether the sequence cycles. |
+| cache_size | [string](#string) | | Cache size of a sequence. |
+| last_value | [string](#string) | | Last value of a sequence. |
+| owner_table | [string](#string) | | The owner table of the sequence. |
+| owner_column | [string](#string) | | The owner column of the sequence. |
+| comment | [string](#string) | | |
-<a name="bytebase-store-ChangedResources"></a>
+<a name="bytebase-store-StreamMetadata"></a>
-### ChangedResources
+### StreamMetadata
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| databases | [ChangedResourceDatabase](#bytebase-store-ChangedResourceDatabase) | repeated | |
+| name | [string](#string) | | The name is the name of a stream. |
+| table_name | [string](#string) | | The table_name is the name of the table/view that the stream is created on. |
+| owner | [string](#string) | | The owner of the stream. |
+| comment | [string](#string) | | The comment of the stream. |
+| type | [StreamMetadata.Type](#bytebase-store-StreamMetadata-Type) | | The type of the stream. |
+| stale | [bool](#bool) | | Indicates whether the stream was last read before the `stale_after` time. |
+| mode | [StreamMetadata.Mode](#bytebase-store-StreamMetadata-Mode) | | The mode of the stream. |
+| definition | [string](#string) | | The definition of the stream. |
-<a name="bytebase-store-ChangelogPayload"></a>
+<a name="bytebase-store-TableCatalog"></a>
-### ChangelogPayload
+### TableCatalog
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| task_run | [string](#string) | | Format: projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskruns/{taskrun} |
-| issue | [string](#string) | | Format: projects/{project}/issues/{issue} |
-| revision | [int64](#int64) | | The revision uid. optional |
-| changed_resources | [ChangedResources](#bytebase-store-ChangedResources) | | |
-| sheet | [string](#string) | | The sheet that holds the content. Format: projects/{project}/sheets/{sheet} |
-| version | [string](#string) | | |
-| type | [ChangelogPayload.Type](#bytebase-store-ChangelogPayload-Type) | | |
-
-
-
-
+| name | [string](#string) | | The name is the name of a table. |
+| columns | [ColumnCatalog](#bytebase-store-ColumnCatalog) | repeated | The column_configs is the ordered list of configs for columns in a table. |
+| object_schema | [ObjectSchema](#bytebase-store-ObjectSchema) | optional | |
+| classification | [string](#string) | | |
+| updater | [string](#string) | | The last updater of the table in branch. Format: users/{userUID}. |
+| source_branch | [string](#string) | | The last change come from branch. Format: projcets/{project}/branches/{branch} |
+| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The timestamp when the table is updated in branch. |
-
-<a name="bytebase-store-ChangelogPayload-Type"></a>
-### ChangelogPayload.Type
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| TYPE_UNSPECIFIED | 0 | |
-| BASELINE | 1 | |
-| MIGRATE | 2 | |
-| MIGRATE_SDL | 3 | |
-| MIGRATE_GHOST | 4 | |
-| DATA | 6 | |
-
-
-
-
-
+<a name="bytebase-store-TableMetadata"></a>
-
+### TableMetadata
+TableMetadata is the metadata for tables.
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| name | [string](#string) | | The name is the name of a table. |
+| columns | [ColumnMetadata](#bytebase-store-ColumnMetadata) | repeated | The columns is the ordered list of columns in a table. |
+| indexes | [IndexMetadata](#bytebase-store-IndexMetadata) | repeated | The indexes is the list of indexes in a table. |
+| engine | [string](#string) | | The engine is the engine of a table. |
+| collation | [string](#string) | | The collation is the collation of a table. |
+| charset | [string](#string) | | The character set of table. |
+| row_count | [int64](#int64) | | The row_count is the estimated number of rows of a table. |
+| data_size | [int64](#int64) | | The data_size is the estimated data size of a table. |
+| index_size | [int64](#int64) | | The index_size is the estimated index size of a table. |
+| data_free | [int64](#int64) | | The data_free is the estimated free data size of a table. |
+| create_options | [string](#string) | | The create_options is the create option of a table. |
+| comment | [string](#string) | | The comment is the comment of a table. classification and user_comment is parsed from the comment. |
+| user_comment | [string](#string) | | The user_comment is the user comment of a table parsed from the comment. |
+| foreign_keys | [ForeignKeyMetadata](#bytebase-store-ForeignKeyMetadata) | repeated | The foreign_keys is the list of foreign keys in a table. |
+| partitions | [TablePartitionMetadata](#bytebase-store-TablePartitionMetadata) | repeated | The partitions is the list of partitions in a table. |
+| check_constraints | [CheckConstraintMetadata](#bytebase-store-CheckConstraintMetadata) | repeated | The check_constraints is the list of check constraints in a table. |
+| owner | [string](#string) | | |
+| sorting_keys | [string](#string) | repeated | The sorting_keys is a tuple of column names or arbitrary expressions. ClickHouse specific field. Reference: https://clickhouse.com/docs/en/engines/table-engines/mergetree-family/mergetree#order_by |
+| triggers | [TriggerMetadata](#bytebase-store-TriggerMetadata) | repeated | |
-<a name="store_data_source-proto"></a>
-<p align="right"><a href="#top">Top</a></p>
-## store/data_source.proto
-<a name="bytebase-store-DataSourceExternalSecret"></a>
-### DataSourceExternalSecret
+<a name="bytebase-store-TablePartitionMetadata"></a>
+### TablePartitionMetadata
+TablePartitionMetadata is the metadata for table partitions.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| secret_type | [DataSourceExternalSecret.SecretType](#bytebase-store-DataSourceExternalSecret-SecretType) | | |
-| url | [string](#string) | | |
-| auth_type | [DataSourceExternalSecret.AuthType](#bytebase-store-DataSourceExternalSecret-AuthType) | | |
-| app_role | [DataSourceExternalSecret.AppRoleAuthOption](#bytebase-store-DataSourceExternalSecret-AppRoleAuthOption) | | |
-| token | [string](#string) | | |
-| engine_name | [string](#string) | | engine name is the name for secret engine. |
-| secret_name | [string](#string) | | the secret name in the engine to store the password. |
-| password_key_name | [string](#string) | | the key name for the password. |
+| name | [string](#string) | | The name is the name of a table partition. |
+| type | [TablePartitionMetadata.Type](#bytebase-store-TablePartitionMetadata-Type) | | The type of a table partition. |
+| expression | [string](#string) | | The expression is the expression of a table partition. For PostgreSQL, the expression is the text of {FOR VALUES partition_bound_spec}, see https://www.postgresql.org/docs/current/sql-createtable.html. For MySQL, the expression is the `expr` or `column_list` of the following syntax. PARTITION BY { [LINEAR] HASH(expr) | [LINEAR] KEY [ALGORITHM={1 | 2}] (column_list) | RANGE{(expr) | COLUMNS(column_list)} | LIST{(expr) | COLUMNS(column_list)} }. |
+| value | [string](#string) | | The value is the value of a table partition. For MySQL, the value is for RANGE and LIST partition types, - For a RANGE partition, it contains the value set in the partition&#39;s VALUES LESS THAN clause, which can be either an integer or MAXVALUE. - For a LIST partition, this column contains the values defined in the partition&#39;s VALUES IN clause, which is a list of comma-separated integer values. - For others, it&#39;s an empty string. |
+| use_default | [string](#string) | | The use_default is whether the users use the default partition, it stores the different value for different database engines. For MySQL, it&#39;s [INT] type, 0 means not use default partition, otherwise, it&#39;s equals to number in syntax [SUB]PARTITION {number}. |
+| subpartitions | [TablePartitionMetadata](#bytebase-store-TablePartitionMetadata) | repeated | The subpartitions is the list of subpartitions in a table partition. |
+| indexes | [IndexMetadata](#bytebase-store-IndexMetadata) | repeated | |
-<a name="bytebase-store-DataSourceExternalSecret-AppRoleAuthOption"></a>
+<a name="bytebase-store-TaskMetadata"></a>
-### DataSourceExternalSecret.AppRoleAuthOption
+### TaskMetadata
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| role_id | [string](#string) | | |
-| secret_id | [string](#string) | | the secret id for the role without ttl. |
-| type | [DataSourceExternalSecret.AppRoleAuthOption.SecretType](#bytebase-store-DataSourceExternalSecret-AppRoleAuthOption-SecretType) | | |
-| mount_path | [string](#string) | | The path where the approle auth method is mounted. |
+| name | [string](#string) | | The name is the name of a task. |
+| id | [string](#string) | | The id is the snowflake-generated id of a task. Example: 01ad32a0-1bb6-5e93-0000-000000000001 |
+| owner | [string](#string) | | The owner of the task. |
+| comment | [string](#string) | | The comment of the task. |
+| warehouse | [string](#string) | | The warehouse of the task. |
+| schedule | [string](#string) | | The schedule interval of the task. |
+| predecessors | [string](#string) | repeated | The predecessor tasks of the task. |
+| state | [TaskMetadata.State](#bytebase-store-TaskMetadata-State) | | The state of the task. |
+| condition | [string](#string) | | The condition of the task. |
+| definition | [string](#string) | | The definition of the task. |
-<a name="bytebase-store-DataSourceOptions"></a>
+<a name="bytebase-store-TriggerMetadata"></a>
-### DataSourceOptions
+### TriggerMetadata
| 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;). |
-| authentication_private_key_obfuscated | [string](#string) | | PKCS#8 private key in PEM format. If it&#39;s empty string, no private key is required. Used for authentication when connecting to the data source. |
-| external_secret | [DataSourceExternalSecret](#bytebase-store-DataSourceExternalSecret) | | |
-| authentication_type | [DataSourceOptions.AuthenticationType](#bytebase-store-DataSourceOptions-AuthenticationType) | | |
-| sasl_config | [SASLConfig](#bytebase-store-SASLConfig) | | |
-| additional_addresses | [DataSourceOptions.Address](#bytebase-store-DataSourceOptions-Address) | repeated | additional_addresses is used for MongoDB replica set. |
-| replica_set | [string](#string) | | replica_set is used for MongoDB replica set. |
-| direct_connection | [bool](#bool) | | direct_connection is used for MongoDB to dispatch all the operations to the node specified in the connection string. |
-| region | [string](#string) | | region is the location of where the DB is, works for AWS RDS. For example, us-east-1. |
-| warehouse_id | [string](#string) | | warehouse_id is used by Databricks. |
-| master_name | [string](#string) | | master_name is the master name used by connecting redis-master via redis sentinel. |
-| master_username | [string](#string) | | master_username and master_obfuscated_password are master credentials used by redis sentinel mode. |
-| master_obfuscated_password | [string](#string) | | |
-| redis_type | [DataSourceOptions.RedisType](#bytebase-store-DataSourceOptions-RedisType) | | |
-| use_ssl | [bool](#bool) | | Use SSL to connect to the data source. By default, we use system default SSL configuration. |
-| cluster | [string](#string) | | Cluster is the cluster name for the data source. Used by CockroachDB. |
+| name | [string](#string) | | The name is the name of the trigger. |
+| event | [string](#string) | | The event is the event of the trigger, such as INSERT, UPDATE, DELETE, TRUNCATE. |
+| timing | [string](#string) | | The timing is the timing of the trigger, such as BEFORE, AFTER. |
+| body | [string](#string) | | The body is the body of the trigger. |
+| sql_mode | [string](#string) | | |
+| character_set_client | [string](#string) | | |
+| collation_connection | [string](#string) | | |
+| comment | [string](#string) | | |
-<a name="bytebase-store-DataSourceOptions-Address"></a>
+<a name="bytebase-store-ViewConfig"></a>
-### DataSourceOptions.Address
+### ViewConfig
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| host | [string](#string) | | |
-| port | [string](#string) | | |
-
+| name | [string](#string) | | The name is the name of a view. |
+| updater | [string](#string) | | The last updater of the view in branch. Format: users/{userUID}. |
+| source_branch | [string](#string) | | The last change come from branch. Format: projcets/{project}/branches/{branch} |
+| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The timestamp when the view is updated in branch. |
-<a name="bytebase-store-KerberosConfig"></a>
-### KerberosConfig
+<a name="bytebase-store-ViewMetadata"></a>
+### ViewMetadata
+ViewMetadata is the metadata for views.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| primary | [string](#string) | | |
-| instance | [string](#string) | | |
-| realm | [string](#string) | | |
-| keytab | [bytes](#bytes) | | |
-| kdc_host | [string](#string) | | |
-| kdc_port | [string](#string) | | |
-| kdc_transport_protocol | [string](#string) | | |
-
-
-
-
+| name | [string](#string) | | The name is the name of a view. |
+| definition | [string](#string) | | The definition is the definition of a view. |
+| comment | [string](#string) | | The comment is the comment of a view. |
+| dependency_columns | [DependencyColumn](#bytebase-store-DependencyColumn) | repeated | The dependency_columns is the list of dependency columns of a view. |
+| columns | [ColumnMetadata](#bytebase-store-ColumnMetadata) | repeated | The columns is the ordered list of columns in a table. |
+| triggers | [TriggerMetadata](#bytebase-store-TriggerMetadata) | repeated | The triggers is the list of triggers in a view. |
-<a name="bytebase-store-SASLConfig"></a>
-### SASLConfig
+
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| krb_config | [KerberosConfig](#bytebase-store-KerberosConfig) | | |
+<a name="bytebase-store-GenerationMetadata-Type"></a>
+### GenerationMetadata.Type
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| TYPE_UNSPECIFIED | 0 | |
+| TYPE_VIRTUAL | 1 | |
+| TYPE_STORED | 2 | |
-
-<a name="bytebase-store-DataSourceExternalSecret-AppRoleAuthOption-SecretType"></a>
+<a name="bytebase-store-ObjectSchema-Type"></a>
-### DataSourceExternalSecret.AppRoleAuthOption.SecretType
+### ObjectSchema.Type
| Name | Number | Description |
| ---- | ------ | ----------- |
-| SECRET_TYPE_UNSPECIFIED | 0 | |
-| PLAIN | 1 | |
-| ENVIRONMENT | 2 | |
+| TYPE_UNSPECIFIED | 0 | |
+| STRING | 1 | |
+| NUMBER | 2 | |
+| BOOLEAN | 3 | |
+| OBJECT | 4 | |
+| ARRAY | 5 | |
-<a name="bytebase-store-DataSourceExternalSecret-AuthType"></a>
+<a name="bytebase-store-StreamMetadata-Mode"></a>
-### DataSourceExternalSecret.AuthType
+### StreamMetadata.Mode
| Name | Number | Description |
| ---- | ------ | ----------- |
-| AUTH_TYPE_UNSPECIFIED | 0 | |
-| TOKEN | 1 | ref: https://developer.hashicorp.com/vault/docs/auth/token |
-| VAULT_APP_ROLE | 2 | ref: https://developer.hashicorp.com/vault/docs/auth/approle |
+| MODE_UNSPECIFIED | 0 | |
+| MODE_DEFAULT | 1 | |
+| MODE_APPEND_ONLY | 2 | |
+| MODE_INSERT_ONLY | 3 | |
-<a name="bytebase-store-DataSourceExternalSecret-SecretType"></a>
+<a name="bytebase-store-StreamMetadata-Type"></a>
-### DataSourceExternalSecret.SecretType
+### StreamMetadata.Type
| Name | Number | Description |
| ---- | ------ | ----------- |
-| SAECRET_TYPE_UNSPECIFIED | 0 | |
-| VAULT_KV_V2 | 1 | ref: https://developer.hashicorp.com/vault/api-docs/secret/kv/kv-v2 |
-| AWS_SECRETS_MANAGER | 2 | ref: https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html |
-| GCP_SECRET_MANAGER | 3 | ref: https://cloud.google.com/secret-manager/docs |
-
+| TYPE_UNSPECIFIED | 0 | |
+| TYPE_DELTA | 1 | |
-<a name="bytebase-store-DataSourceOptions-AuthenticationType"></a>
-### DataSourceOptions.AuthenticationType
+<a name="bytebase-store-TablePartitionMetadata-Type"></a>
+### TablePartitionMetadata.Type
+Type is the type of a table partition, some database engines may not
+support all types. Only avilable for the following database engines now:
+MySQL: RANGE, RANGE COLUMNS, LIST, LIST COLUMNS, HASH, LINEAR HASH, KEY,
+LINEAR_KEY
+(https://dev.mysql.com/doc/refman/8.0/en/partitioning-types.html) TiDB:
+RANGE, RANGE COLUMNS, LIST, LIST COLUMNS, HASH, KEY PostgreSQL: RANGE,
+LIST, HASH (https://www.postgresql.org/docs/current/ddl-partitioning.html)
| Name | Number | Description |
| ---- | ------ | ----------- |
-| AUTHENTICATION_UNSPECIFIED | 0 | |
-| PASSWORD | 1 | |
-| GOOGLE_CLOUD_SQL_IAM | 2 | |
-| AWS_RDS_IAM | 3 | |
+| TYPE_UNSPECIFIED | 0 | |
+| RANGE | 1 | |
+| RANGE_COLUMNS | 2 | |
+| LIST | 3 | |
+| LIST_COLUMNS | 4 | |
+| HASH | 5 | |
+| LINEAR_HASH | 6 | |
+| KEY | 7 | |
+| LINEAR_KEY | 8 | |
-<a name="bytebase-store-DataSourceOptions-RedisType"></a>
+<a name="bytebase-store-TaskMetadata-State"></a>
-### DataSourceOptions.RedisType
+### TaskMetadata.State
| Name | Number | Description |
| ---- | ------ | ----------- |
-| REDIS_TYPE_UNSPECIFIED | 0 | |
-| STANDALONE | 1 | |
-| SENTINEL | 2 | |
-| CLUSTER | 3 | |
+| STATE_UNSPECIFIED | 0 | |
+| STATE_STARTED | 1 | |
+| STATE_SUSPENDED | 2 | |
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index 6661c14d86..f566373f3b 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -334,340 +334,321 @@
<li>
- <a href="#store%2fdatabase.proto">store/database.proto</a>
+ <a href="#store%2fchangelist.proto">store/changelist.proto</a>
<ul>
<li>
- <a href="#bytebase.store.CheckConstraintMetadata"><span class="badge">M</span>CheckConstraintMetadata</a>
+ <a href="#bytebase.store.Changelist"><span class="badge">M</span>Changelist</a>
</li>
<li>
- <a href="#bytebase.store.ColumnCatalog"><span class="badge">M</span>ColumnCatalog</a>
+ <a href="#bytebase.store.Changelist.Change"><span class="badge">M</span>Changelist.Change</a>
</li>
- <li>
- <a href="#bytebase.store.ColumnCatalog.LabelsEntry"><span class="badge">M</span>ColumnCatalog.LabelsEntry</a>
- </li>
- <li>
- <a href="#bytebase.store.ColumnMetadata"><span class="badge">M</span>ColumnMetadata</a>
- </li>
+
+
+ </ul>
+ </li>
+
+
+ <li>
+ <a href="#store%2fchangelog.proto">store/changelog.proto</a>
+ <ul>
<li>
- <a href="#bytebase.store.DatabaseConfig"><span class="badge">M</span>DatabaseConfig</a>
+ <a href="#bytebase.store.ChangedResourceDatabase"><span class="badge">M</span>ChangedResourceDatabase</a>
</li>
<li>
- <a href="#bytebase.store.DatabaseMetadata"><span class="badge">M</span>DatabaseMetadata</a>
+ <a href="#bytebase.store.ChangedResourceFunction"><span class="badge">M</span>ChangedResourceFunction</a>
</li>
<li>
- <a href="#bytebase.store.DatabaseMetadata.LabelsEntry"><span class="badge">M</span>DatabaseMetadata.LabelsEntry</a>
+ <a href="#bytebase.store.ChangedResourceProcedure"><span class="badge">M</span>ChangedResourceProcedure</a>
</li>
<li>
- <a href="#bytebase.store.DatabaseSchemaMetadata"><span class="badge">M</span>DatabaseSchemaMetadata</a>
+ <a href="#bytebase.store.ChangedResourceSchema"><span class="badge">M</span>ChangedResourceSchema</a>
</li>
<li>
- <a href="#bytebase.store.DependencyColumn"><span class="badge">M</span>DependencyColumn</a>
+ <a href="#bytebase.store.ChangedResourceTable"><span class="badge">M</span>ChangedResourceTable</a>
</li>
<li>
- <a href="#bytebase.store.DependencyTable"><span class="badge">M</span>DependencyTable</a>
+ <a href="#bytebase.store.ChangedResourceView"><span class="badge">M</span>ChangedResourceView</a>
</li>
<li>
- <a href="#bytebase.store.EnumTypeMetadata"><span class="badge">M</span>EnumTypeMetadata</a>
+ <a href="#bytebase.store.ChangedResources"><span class="badge">M</span>ChangedResources</a>
</li>
<li>
- <a href="#bytebase.store.EventMetadata"><span class="badge">M</span>EventMetadata</a>
+ <a href="#bytebase.store.ChangelogPayload"><span class="badge">M</span>ChangelogPayload</a>
</li>
+
<li>
- <a href="#bytebase.store.ExtensionMetadata"><span class="badge">M</span>ExtensionMetadata</a>
+ <a href="#bytebase.store.ChangelogPayload.Type"><span class="badge">E</span>ChangelogPayload.Type</a>
</li>
+
+
+ </ul>
+ </li>
+
+
+ <li>
+ <a href="#store%2fdata_source.proto">store/data_source.proto</a>
+ <ul>
+
<li>
- <a href="#bytebase.store.ExternalTableMetadata"><span class="badge">M</span>ExternalTableMetadata</a>
+ <a href="#bytebase.store.DataSourceExternalSecret"><span class="badge">M</span>DataSourceExternalSecret</a>
</li>
<li>
- <a href="#bytebase.store.ForeignKeyMetadata"><span class="badge">M</span>ForeignKeyMetadata</a>
+ <a href="#bytebase.store.DataSourceExternalSecret.AppRoleAuthOption"><span class="badge">M</span>DataSourceExternalSecret.AppRoleAuthOption</a>
</li>
<li>
- <a href="#bytebase.store.FunctionConfig"><span class="badge">M</span>FunctionConfig</a>
+ <a href="#bytebase.store.DataSourceOptions"><span class="badge">M</span>DataSourceOptions</a>
</li>
<li>
- <a href="#bytebase.store.FunctionMetadata"><span class="badge">M</span>FunctionMetadata</a>
+ <a href="#bytebase.store.DataSourceOptions.Address"><span class="badge">M</span>DataSourceOptions.Address</a>
</li>
<li>
- <a href="#bytebase.store.GenerationMetadata"><span class="badge">M</span>GenerationMetadata</a>
+ <a href="#bytebase.store.KerberosConfig"><span class="badge">M</span>KerberosConfig</a>
</li>
<li>
- <a href="#bytebase.store.IndexMetadata"><span class="badge">M</span>IndexMetadata</a>
+ <a href="#bytebase.store.SASLConfig"><span class="badge">M</span>SASLConfig</a>
</li>
+
<li>
- <a href="#bytebase.store.InstanceRoleMetadata"><span class="badge">M</span>InstanceRoleMetadata</a>
+ <a href="#bytebase.store.DataSourceExternalSecret.AppRoleAuthOption.SecretType"><span class="badge">E</span>DataSourceExternalSecret.AppRoleAuthOption.SecretType</a>
</li>
<li>
- <a href="#bytebase.store.LinkedDatabaseMetadata"><span class="badge">M</span>LinkedDatabaseMetadata</a>
+ <a href="#bytebase.store.DataSourceExternalSecret.AuthType"><span class="badge">E</span>DataSourceExternalSecret.AuthType</a>
</li>
<li>
- <a href="#bytebase.store.MaterializedViewMetadata"><span class="badge">M</span>MaterializedViewMetadata</a>
+ <a href="#bytebase.store.DataSourceExternalSecret.SecretType"><span class="badge">E</span>DataSourceExternalSecret.SecretType</a>
</li>
<li>
- <a href="#bytebase.store.ObjectSchema"><span class="badge">M</span>ObjectSchema</a>
+ <a href="#bytebase.store.DataSourceOptions.AuthenticationType"><span class="badge">E</span>DataSourceOptions.AuthenticationType</a>
</li>
<li>
- <a href="#bytebase.store.ObjectSchema.ArrayKind"><span class="badge">M</span>ObjectSchema.ArrayKind</a>
+ <a href="#bytebase.store.DataSourceOptions.RedisType"><span class="badge">E</span>DataSourceOptions.RedisType</a>
</li>
+
+
+ </ul>
+ </li>
+
+
+ <li>
+ <a href="#store%2fdatabase.proto">store/database.proto</a>
+ <ul>
+
<li>
- <a href="#bytebase.store.ObjectSchema.StructKind"><span class="badge">M</span>ObjectSchema.StructKind</a>
+ <a href="#bytebase.store.CheckConstraintMetadata"><span class="badge">M</span>CheckConstraintMetadata</a>
</li>
<li>
- <a href="#bytebase.store.ObjectSchema.StructKind.PropertiesEntry"><span class="badge">M</span>ObjectSchema.StructKind.PropertiesEntry</a>
+ <a href="#bytebase.store.ColumnCatalog"><span class="badge">M</span>ColumnCatalog</a>
</li>
<li>
- <a href="#bytebase.store.PackageMetadata"><span class="badge">M</span>PackageMetadata</a>
+ <a href="#bytebase.store.ColumnCatalog.LabelsEntry"><span class="badge">M</span>ColumnCatalog.LabelsEntry</a>
</li>
<li>
- <a href="#bytebase.store.ProcedureConfig"><span class="badge">M</span>ProcedureConfig</a>
+ <a href="#bytebase.store.ColumnMetadata"><span class="badge">M</span>ColumnMetadata</a>
</li>
<li>
- <a href="#bytebase.store.ProcedureMetadata"><span class="badge">M</span>ProcedureMetadata</a>
+ <a href="#bytebase.store.DatabaseConfig"><span class="badge">M</span>DatabaseConfig</a>
</li>
<li>
- <a href="#bytebase.store.SchemaCatalog"><span class="badge">M</span>SchemaCatalog</a>
+ <a href="#bytebase.store.DatabaseMetadata"><span class="badge">M</span>DatabaseMetadata</a>
</li>
<li>
- <a href="#bytebase.store.SchemaMetadata"><span class="badge">M</span>SchemaMetadata</a>
+ <a href="#bytebase.store.DatabaseMetadata.LabelsEntry"><span class="badge">M</span>DatabaseMetadata.LabelsEntry</a>
</li>
<li>
- <a href="#bytebase.store.SecretItem"><span class="badge">M</span>SecretItem</a>
+ <a href="#bytebase.store.DatabaseSchemaMetadata"><span class="badge">M</span>DatabaseSchemaMetadata</a>
</li>
<li>
- <a href="#bytebase.store.Secrets"><span class="badge">M</span>Secrets</a>
+ <a href="#bytebase.store.DependencyColumn"><span class="badge">M</span>DependencyColumn</a>
</li>
<li>
- <a href="#bytebase.store.SequenceMetadata"><span class="badge">M</span>SequenceMetadata</a>
+ <a href="#bytebase.store.DependencyTable"><span class="badge">M</span>DependencyTable</a>
</li>
<li>
- <a href="#bytebase.store.StreamMetadata"><span class="badge">M</span>StreamMetadata</a>
+ <a href="#bytebase.store.EnumTypeMetadata"><span class="badge">M</span>EnumTypeMetadata</a>
</li>
<li>
- <a href="#bytebase.store.TableCatalog"><span class="badge">M</span>TableCatalog</a>
+ <a href="#bytebase.store.EventMetadata"><span class="badge">M</span>EventMetadata</a>
</li>
<li>
- <a href="#bytebase.store.TableMetadata"><span class="badge">M</span>TableMetadata</a>
+ <a href="#bytebase.store.ExtensionMetadata"><span class="badge">M</span>ExtensionMetadata</a>
</li>
<li>
- <a href="#bytebase.store.TablePartitionMetadata"><span class="badge">M</span>TablePartitionMetadata</a>
+ <a href="#bytebase.store.ExternalTableMetadata"><span class="badge">M</span>ExternalTableMetadata</a>
</li>
<li>
- <a href="#bytebase.store.TaskMetadata"><span class="badge">M</span>TaskMetadata</a>
+ <a href="#bytebase.store.ForeignKeyMetadata"><span class="badge">M</span>ForeignKeyMetadata</a>
</li>
<li>
- <a href="#bytebase.store.TriggerMetadata"><span class="badge">M</span>TriggerMetadata</a>
+ <a href="#bytebase.store.FunctionConfig"><span class="badge">M</span>FunctionConfig</a>
</li>
<li>
- <a href="#bytebase.store.ViewConfig"><span class="badge">M</span>ViewConfig</a>
+ <a href="#bytebase.store.FunctionMetadata"><span class="badge">M</span>FunctionMetadata</a>
</li>
<li>
- <a href="#bytebase.store.ViewMetadata"><span class="badge">M</span>ViewMetadata</a>
+ <a href="#bytebase.store.GenerationMetadata"><span class="badge">M</span>GenerationMetadata</a>
</li>
-
<li>
- <a href="#bytebase.store.GenerationMetadata.Type"><span class="badge">E</span>GenerationMetadata.Type</a>
+ <a href="#bytebase.store.IndexMetadata"><span class="badge">M</span>IndexMetadata</a>
</li>
<li>
- <a href="#bytebase.store.ObjectSchema.Type"><span class="badge">E</span>ObjectSchema.Type</a>
+ <a href="#bytebase.store.InstanceRoleMetadata"><span class="badge">M</span>InstanceRoleMetadata</a>
</li>
<li>
- <a href="#bytebase.store.StreamMetadata.Mode"><span class="badge">E</span>StreamMetadata.Mode</a>
+ <a href="#bytebase.store.LinkedDatabaseMetadata"><span class="badge">M</span>LinkedDatabaseMetadata</a>
</li>
<li>
- <a href="#bytebase.store.StreamMetadata.Type"><span class="badge">E</span>StreamMetadata.Type</a>
+ <a href="#bytebase.store.MaterializedViewMetadata"><span class="badge">M</span>MaterializedViewMetadata</a>
</li>
<li>
- <a href="#bytebase.store.TablePartitionMetadata.Type"><span class="badge">E</span>TablePartitionMetadata.Type</a>
+ <a href="#bytebase.store.ObjectSchema"><span class="badge">M</span>ObjectSchema</a>
</li>
<li>
- <a href="#bytebase.store.TaskMetadata.State"><span class="badge">E</span>TaskMetadata.State</a>
+ <a href="#bytebase.store.ObjectSchema.ArrayKind"><span class="badge">M</span>ObjectSchema.ArrayKind</a>
</li>
-
-
- </ul>
- </li>
-
-
- <li>
- <a href="#store%2fbranch.proto">store/branch.proto</a>
- <ul>
-
<li>
- <a href="#bytebase.store.BranchConfig"><span class="badge">M</span>BranchConfig</a>
+ <a href="#bytebase.store.ObjectSchema.StructKind"><span class="badge">M</span>ObjectSchema.StructKind</a>
</li>
<li>
- <a href="#bytebase.store.BranchSnapshot"><span class="badge">M</span>BranchSnapshot</a>
+ <a href="#bytebase.store.ObjectSchema.StructKind.PropertiesEntry"><span class="badge">M</span>ObjectSchema.StructKind.PropertiesEntry</a>
</li>
-
-
-
- </ul>
- </li>
-
-
- <li>
- <a href="#store%2fchangelist.proto">store/changelist.proto</a>
- <ul>
-
<li>
- <a href="#bytebase.store.Changelist"><span class="badge">M</span>Changelist</a>
+ <a href="#bytebase.store.PackageMetadata"><span class="badge">M</span>PackageMetadata</a>
</li>
<li>
- <a href="#bytebase.store.Changelist.Change"><span class="badge">M</span>Changelist.Change</a>
+ <a href="#bytebase.store.ProcedureConfig"><span class="badge">M</span>ProcedureConfig</a>
</li>
-
-
-
- </ul>
- </li>
-
-
- <li>
- <a href="#store%2fchangelog.proto">store/changelog.proto</a>
- <ul>
-
<li>
- <a href="#bytebase.store.ChangedResourceDatabase"><span class="badge">M</span>ChangedResourceDatabase</a>
+ <a href="#bytebase.store.ProcedureMetadata"><span class="badge">M</span>ProcedureMetadata</a>
</li>
<li>
- <a href="#bytebase.store.ChangedResourceFunction"><span class="badge">M</span>ChangedResourceFunction</a>
+ <a href="#bytebase.store.SchemaCatalog"><span class="badge">M</span>SchemaCatalog</a>
</li>
<li>
- <a href="#bytebase.store.ChangedResourceProcedure"><span class="badge">M</span>ChangedResourceProcedure</a>
+ <a href="#bytebase.store.SchemaMetadata"><span class="badge">M</span>SchemaMetadata</a>
</li>
<li>
- <a href="#bytebase.store.ChangedResourceSchema"><span class="badge">M</span>ChangedResourceSchema</a>
+ <a href="#bytebase.store.SecretItem"><span class="badge">M</span>SecretItem</a>
</li>
<li>
- <a href="#bytebase.store.ChangedResourceTable"><span class="badge">M</span>ChangedResourceTable</a>
+ <a href="#bytebase.store.Secrets"><span class="badge">M</span>Secrets</a>
</li>
<li>
- <a href="#bytebase.store.ChangedResourceView"><span class="badge">M</span>ChangedResourceView</a>
+ <a href="#bytebase.store.SequenceMetadata"><span class="badge">M</span>SequenceMetadata</a>
</li>
<li>
- <a href="#bytebase.store.ChangedResources"><span class="badge">M</span>ChangedResources</a>
+ <a href="#bytebase.store.StreamMetadata"><span class="badge">M</span>StreamMetadata</a>
</li>
<li>
- <a href="#bytebase.store.ChangelogPayload"><span class="badge">M</span>ChangelogPayload</a>
+ <a href="#bytebase.store.TableCatalog"><span class="badge">M</span>TableCatalog</a>
</li>
-
<li>
- <a href="#bytebase.store.ChangelogPayload.Type"><span class="badge">E</span>ChangelogPayload.Type</a>
+ <a href="#bytebase.store.TableMetadata"><span class="badge">M</span>TableMetadata</a>
</li>
-
-
- </ul>
- </li>
-
-
- <li>
- <a href="#store%2fdata_source.proto">store/data_source.proto</a>
- <ul>
-
<li>
- <a href="#bytebase.store.DataSourceExternalSecret"><span class="badge">M</span>DataSourceExternalSecret</a>
+ <a href="#bytebase.store.TablePartitionMetadata"><span class="badge">M</span>TablePartitionMetadata</a>
</li>
<li>
- <a href="#bytebase.store.DataSourceExternalSecret.AppRoleAuthOption"><span class="badge">M</span>DataSourceExternalSecret.AppRoleAuthOption</a>
+ <a href="#bytebase.store.TaskMetadata"><span class="badge">M</span>TaskMetadata</a>
</li>
<li>
- <a href="#bytebase.store.DataSourceOptions"><span class="badge">M</span>DataSourceOptions</a>
+ <a href="#bytebase.store.TriggerMetadata"><span class="badge">M</span>TriggerMetadata</a>
</li>
<li>
- <a href="#bytebase.store.DataSourceOptions.Address"><span class="badge">M</span>DataSourceOptions.Address</a>
+ <a href="#bytebase.store.ViewConfig"><span class="badge">M</span>ViewConfig</a>
</li>
<li>
- <a href="#bytebase.store.KerberosConfig"><span class="badge">M</span>KerberosConfig</a>
+ <a href="#bytebase.store.ViewMetadata"><span class="badge">M</span>ViewMetadata</a>
</li>
+
<li>
- <a href="#bytebase.store.SASLConfig"><span class="badge">M</span>SASLConfig</a>
+ <a href="#bytebase.store.GenerationMetadata.Type"><span class="badge">E</span>GenerationMetadata.Type</a>
</li>
-
<li>
- <a href="#bytebase.store.DataSourceExternalSecret.AppRoleAuthOption.SecretType"><span class="badge">E</span>DataSourceExternalSecret.AppRoleAuthOption.SecretType</a>
+ <a href="#bytebase.store.ObjectSchema.Type"><span class="badge">E</span>ObjectSchema.Type</a>
</li>
<li>
- <a href="#bytebase.store.DataSourceExternalSecret.AuthType"><span class="badge">E</span>DataSourceExternalSecret.AuthType</a>
+ <a href="#bytebase.store.StreamMetadata.Mode"><span class="badge">E</span>StreamMetadata.Mode</a>
</li>
<li>
- <a href="#bytebase.store.DataSourceExternalSecret.SecretType"><span class="badge">E</span>DataSourceExternalSecret.SecretType</a>
+ <a href="#bytebase.store.StreamMetadata.Type"><span class="badge">E</span>StreamMetadata.Type</a>
</li>
<li>
- <a href="#bytebase.store.DataSourceOptions.AuthenticationType"><span class="badge">E</span>DataSourceOptions.AuthenticationType</a>
+ <a href="#bytebase.store.TablePartitionMetadata.Type"><span class="badge">E</span>TablePartitionMetadata.Type</a>
</li>
<li>
- <a href="#bytebase.store.DataSourceOptions.RedisType"><span class="badge">E</span>DataSourceOptions.RedisType</a>
+ <a href="#bytebase.store.TaskMetadata.State"><span class="badge">E</span>TaskMetadata.State</a>
</li>
@@ -2876,12 +2857,12 @@ This information is not authenticated and should be treated accordingly. </p></t
<div class="file-heading">
- <h2 id="store/database.proto">store/database.proto</h2><a href="#title">Top</a>
+ <h2 id="store/changelist.proto">store/changelist.proto</h2><a href="#title">Top</a>
</div>
<p></p>
- <h3 id="bytebase.store.CheckConstraintMetadata">CheckConstraintMetadata</h3>
+ <h3 id="bytebase.store.Changelist">Changelist</h3>
<p></p>
@@ -2892,17 +2873,17 @@ This information is not authenticated and should be treated accordingly. </p></t
<tbody>
<tr>
- <td>name</td>
+ <td>description</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the name of a check constraint. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>expression</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The expression is the expression of a check constraint. </p></td>
+ <td>changes</td>
+ <td><a href="#bytebase.store.Changelist.Change">Changelist.Change</a></td>
+ <td>repeated</td>
+ <td><p> </p></td>
</tr>
</tbody>
@@ -2912,7 +2893,7 @@ This information is not authenticated and should be treated accordingly. </p></t
- <h3 id="bytebase.store.ColumnCatalog">ColumnCatalog</h3>
+ <h3 id="bytebase.store.Changelist.Change">Changelist.Change</h3>
<p></p>
@@ -2923,59 +2904,26 @@ This information is not authenticated and should be treated accordingly. </p></t
<tbody>
<tr>
- <td>name</td>
+ <td>sheet</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the name of a column. </p></td>
+ <td><p>The name of a sheet. </p></td>
</tr>
<tr>
- <td>semantic_type</td>
+ <td>source</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The source of origin.
+1) changes: instances/{instance}/databases/{database}/changelogs/{changelog}.
+2) raw SQL if empty. </p></td>
</tr>
<tr>
- <td>labels</td>
- <td><a href="#bytebase.store.ColumnCatalog.LabelsEntry">ColumnCatalog.LabelsEntry</a></td>
- <td>repeated</td>
- <td><p>The user labels for a column. </p></td>
- </tr>
-
- <tr>
- <td>classification</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>object_schema</td>
- <td><a href="#bytebase.store.ObjectSchema">ObjectSchema</a></td>
- <td>optional</td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>masking_level</td>
- <td><a href="#bytebase.store.MaskingLevel">MaskingLevel</a></td>
- <td></td>
- <td><p>Deprecated. </p></td>
- </tr>
-
- <tr>
- <td>full_masking_algorithm_id</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>Deprecated. </p></td>
- </tr>
-
- <tr>
- <td>partial_masking_algorithm_id</td>
+ <td>version</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>Deprecated. </p></td>
+ <td><p>The migration version for a change. </p></td>
</tr>
</tbody>
@@ -2985,7 +2933,21 @@ This information is not authenticated and should be treated accordingly. </p></t
- <h3 id="bytebase.store.ColumnCatalog.LabelsEntry">ColumnCatalog.LabelsEntry</h3>
+
+
+
+
+
+
+
+
+ <div class="file-heading">
+ <h2 id="store/changelog.proto">store/changelog.proto</h2><a href="#title">Top</a>
+ </div>
+ <p></p>
+
+
+ <h3 id="bytebase.store.ChangedResourceDatabase">ChangedResourceDatabase</h3>
<p></p>
@@ -2996,16 +2958,16 @@ This information is not authenticated and should be treated accordingly. </p></t
<tbody>
<tr>
- <td>key</td>
+ <td>name</td>
<td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>value</td>
- <td><a href="#string">string</a></td>
- <td></td>
+ <td>schemas</td>
+ <td><a href="#bytebase.store.ChangedResourceSchema">ChangedResourceSchema</a></td>
+ <td>repeated</td>
<td><p> </p></td>
</tr>
@@ -3016,8 +2978,8 @@ This information is not authenticated and should be treated accordingly. </p></t
- <h3 id="bytebase.store.ColumnMetadata">ColumnMetadata</h3>
- <p>ColumnMetadata is the metadata for columns.</p>
+ <h3 id="bytebase.store.ChangedResourceFunction">ChangedResourceFunction</h3>
+ <p></p>
<table class="field-table">
@@ -3030,95 +2992,97 @@ This information is not authenticated and should be treated accordingly. </p></t
<td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the name of a column. </p></td>
- </tr>
-
- <tr>
- <td>position</td>
- <td><a href="#int32">int32</a></td>
- <td></td>
- <td><p>The position is the position in columns. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>default</td>
- <td><a href="#google.protobuf.StringValue">google.protobuf.StringValue</a></td>
- <td></td>
- <td><p>The default is the default of a column. Use google.protobuf.StringValue
-to distinguish between an empty string default value or no default. </p></td>
+ <td>ranges</td>
+ <td><a href="#bytebase.store.Range">Range</a></td>
+ <td>repeated</td>
+ <td><p>The ranges of sub-strings correspond to the statements on the sheet. </p></td>
</tr>
- <tr>
- <td>default_null</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.store.ChangedResourceProcedure">ChangedResourceProcedure</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>default_expression</td>
+ <td>name</td>
<td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>on_update</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The on_update is the on update action of a column.
-For MySQL like databases, it&#39;s only supported for TIMESTAMP columns with
-CURRENT_TIMESTAMP as on update value. </p></td>
- </tr>
-
- <tr>
- <td>nullable</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>The nullable is the nullable of a column. </p></td>
+ <td>ranges</td>
+ <td><a href="#bytebase.store.Range">Range</a></td>
+ <td>repeated</td>
+ <td><p>The ranges of sub-strings correspond to the statements on the sheet. </p></td>
</tr>
- <tr>
- <td>type</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The type is the type of a column. </p></td>
- </tr>
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.store.ChangedResourceSchema">ChangedResourceSchema</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>character_set</td>
+ <td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The character_set is the character_set of a column. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>collation</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The collation is the collation of a column. </p></td>
+ <td>tables</td>
+ <td><a href="#bytebase.store.ChangedResourceTable">ChangedResourceTable</a></td>
+ <td>repeated</td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>comment</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The comment is the comment of a column.
-classification and user_comment is parsed from the comment. </p></td>
+ <td>views</td>
+ <td><a href="#bytebase.store.ChangedResourceView">ChangedResourceView</a></td>
+ <td>repeated</td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>user_comment</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The user_comment is the user comment of a table parsed from the comment. </p></td>
+ <td>functions</td>
+ <td><a href="#bytebase.store.ChangedResourceFunction">ChangedResourceFunction</a></td>
+ <td>repeated</td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>generation</td>
- <td><a href="#bytebase.store.GenerationMetadata">GenerationMetadata</a></td>
- <td></td>
- <td><p>The generation is for generated columns. </p></td>
+ <td>procedures</td>
+ <td><a href="#bytebase.store.ChangedResourceProcedure">ChangedResourceProcedure</a></td>
+ <td>repeated</td>
+ <td><p> </p></td>
</tr>
</tbody>
@@ -3128,7 +3092,7 @@ classification and user_comment is parsed from the comment. </p></td>
- <h3 id="bytebase.store.DatabaseConfig">DatabaseConfig</h3>
+ <h3 id="bytebase.store.ChangedResourceTable">ChangedResourceTable</h3>
<p></p>
@@ -3146,10 +3110,17 @@ classification and user_comment is parsed from the comment. </p></td>
</tr>
<tr>
- <td>schemas</td>
- <td><a href="#bytebase.store.SchemaCatalog">SchemaCatalog</a></td>
+ <td>table_rows</td>
+ <td><a href="#int64">int64</a></td>
+ <td></td>
+ <td><p>estimated row count of the table </p></td>
+ </tr>
+
+ <tr>
+ <td>ranges</td>
+ <td><a href="#bytebase.store.Range">Range</a></td>
<td>repeated</td>
- <td><p>The schema_configs is the list of configs for schemas in a database. </p></td>
+ <td><p>The ranges of sub-strings correspond to the statements on the sheet. </p></td>
</tr>
</tbody>
@@ -3159,8 +3130,8 @@ classification and user_comment is parsed from the comment. </p></td>
- <h3 id="bytebase.store.DatabaseMetadata">DatabaseMetadata</h3>
- <p>DatabaseMetadata is the metadata for databases.</p>
+ <h3 id="bytebase.store.ChangedResourceView">ChangedResourceView</h3>
+ <p></p>
<table class="field-table">
@@ -3170,24 +3141,17 @@ classification and user_comment is parsed from the comment. </p></td>
<tbody>
<tr>
- <td>labels</td>
- <td><a href="#bytebase.store.DatabaseMetadata.LabelsEntry">DatabaseMetadata.LabelsEntry</a></td>
- <td>repeated</td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>last_sync_time</td>
- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
+ <td>name</td>
+ <td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>backup_available</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p> </p></td>
+ <td>ranges</td>
+ <td><a href="#bytebase.store.Range">Range</a></td>
+ <td>repeated</td>
+ <td><p>The ranges of sub-strings correspond to the statements on the sheet. </p></td>
</tr>
</tbody>
@@ -3197,7 +3161,7 @@ classification and user_comment is parsed from the comment. </p></td>
- <h3 id="bytebase.store.DatabaseMetadata.LabelsEntry">DatabaseMetadata.LabelsEntry</h3>
+ <h3 id="bytebase.store.ChangedResources">ChangedResources</h3>
<p></p>
@@ -3208,16 +3172,9 @@ classification and user_comment is parsed from the comment. </p></td>
<tbody>
<tr>
- <td>key</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>value</td>
- <td><a href="#string">string</a></td>
- <td></td>
+ <td>databases</td>
+ <td><a href="#bytebase.store.ChangedResourceDatabase">ChangedResourceDatabase</a></td>
+ <td>repeated</td>
<td><p> </p></td>
</tr>
@@ -3228,8 +3185,8 @@ classification and user_comment is parsed from the comment. </p></td>
- <h3 id="bytebase.store.DatabaseSchemaMetadata">DatabaseSchemaMetadata</h3>
- <p>DatabaseSchemaMetadata is the schema metadata for databases.</p>
+ <h3 id="bytebase.store.ChangelogPayload">ChangelogPayload</h3>
+ <p></p>
<table class="field-table">
@@ -3239,64 +3196,52 @@ classification and user_comment is parsed from the comment. </p></td>
<tbody>
<tr>
- <td>name</td>
+ <td>task_run</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>Format: projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskruns/{taskrun} </p></td>
</tr>
<tr>
- <td>schemas</td>
- <td><a href="#bytebase.store.SchemaMetadata">SchemaMetadata</a></td>
- <td>repeated</td>
- <td><p>The schemas is the list of schemas in a database. </p></td>
+ <td>issue</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>Format: projects/{project}/issues/{issue} </p></td>
</tr>
<tr>
- <td>character_set</td>
- <td><a href="#string">string</a></td>
+ <td>revision</td>
+ <td><a href="#int64">int64</a></td>
<td></td>
- <td><p>The character_set is the character set of a database. </p></td>
+ <td><p>The revision uid.
+optional </p></td>
</tr>
<tr>
- <td>collation</td>
- <td><a href="#string">string</a></td>
+ <td>changed_resources</td>
+ <td><a href="#bytebase.store.ChangedResources">ChangedResources</a></td>
<td></td>
- <td><p>The collation is the collation of a database. </p></td>
- </tr>
-
- <tr>
- <td>extensions</td>
- <td><a href="#bytebase.store.ExtensionMetadata">ExtensionMetadata</a></td>
- <td>repeated</td>
- <td><p>The extensions is the list of extensions in a database. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>datashare</td>
- <td><a href="#bool">bool</a></td>
+ <td>sheet</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p>The database belongs to a datashare. </p></td>
+ <td><p>The sheet that holds the content.
+Format: projects/{project}/sheets/{sheet} </p></td>
</tr>
<tr>
- <td>service_name</td>
+ <td>version</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The service name of the database. It&#39;s the Oracle specific concept. </p></td>
- </tr>
-
- <tr>
- <td>linked_databases</td>
- <td><a href="#bytebase.store.LinkedDatabaseMetadata">LinkedDatabaseMetadata</a></td>
- <td>repeated</td>
<td><p> </p></td>
</tr>
<tr>
- <td>owner</td>
- <td><a href="#string">string</a></td>
+ <td>type</td>
+ <td><a href="#bytebase.store.ChangelogPayload.Type">ChangelogPayload.Type</a></td>
<td></td>
<td><p> </p></td>
</tr>
@@ -3308,8 +3253,69 @@ classification and user_comment is parsed from the comment. </p></td>
- <h3 id="bytebase.store.DependencyColumn">DependencyColumn</h3>
- <p>DependencyColumn is the metadata for dependency columns.</p>
+
+
+ <h3 id="bytebase.store.ChangelogPayload.Type">ChangelogPayload.Type</h3>
+ <p></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>BASELINE</td>
+ <td>1</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>MIGRATE</td>
+ <td>2</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>MIGRATE_SDL</td>
+ <td>3</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>MIGRATE_GHOST</td>
+ <td>4</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>DATA</td>
+ <td>6</td>
+ <td><p></p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
+
+
+ <div class="file-heading">
+ <h2 id="store/data_source.proto">store/data_source.proto</h2><a href="#title">Top</a>
+ </div>
+ <p></p>
+
+
+ <h3 id="bytebase.store.DataSourceExternalSecret">DataSourceExternalSecret</h3>
+ <p></p>
<table class="field-table">
@@ -3319,93 +3325,59 @@ classification and user_comment is parsed from the comment. </p></td>
<tbody>
<tr>
- <td>schema</td>
- <td><a href="#string">string</a></td>
+ <td>secret_type</td>
+ <td><a href="#bytebase.store.DataSourceExternalSecret.SecretType">DataSourceExternalSecret.SecretType</a></td>
<td></td>
- <td><p>The schema is the schema of a reference column. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>table</td>
+ <td>url</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The table is the table of a reference column. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>column</td>
- <td><a href="#string">string</a></td>
+ <td>auth_type</td>
+ <td><a href="#bytebase.store.DataSourceExternalSecret.AuthType">DataSourceExternalSecret.AuthType</a></td>
<td></td>
- <td><p>The column is the name of a reference column. </p></td>
+ <td><p> </p></td>
</tr>
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.store.DependencyTable">DependencyTable</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>schema</td>
- <td><a href="#string">string</a></td>
+ <td>app_role</td>
+ <td><a href="#bytebase.store.DataSourceExternalSecret.AppRoleAuthOption">DataSourceExternalSecret.AppRoleAuthOption</a></td>
<td></td>
- <td><p>The schema is the schema of a reference table. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>table</td>
+ <td>token</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The table is the name of a reference table. </p></td>
+ <td><p> </p></td>
</tr>
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.store.EnumTypeMetadata">EnumTypeMetadata</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>name</td>
+ <td>engine_name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name of a type. </p></td>
+ <td><p>engine name is the name for secret engine. </p></td>
</tr>
<tr>
- <td>values</td>
+ <td>secret_name</td>
<td><a href="#string">string</a></td>
- <td>repeated</td>
- <td><p>The enum values of a type. </p></td>
+ <td></td>
+ <td><p>the secret name in the engine to store the password. </p></td>
</tr>
<tr>
- <td>comment</td>
+ <td>password_key_name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>the key name for the password. </p></td>
</tr>
</tbody>
@@ -3415,7 +3387,7 @@ classification and user_comment is parsed from the comment. </p></td>
- <h3 id="bytebase.store.EventMetadata">EventMetadata</h3>
+ <h3 id="bytebase.store.DataSourceExternalSecret.AppRoleAuthOption">DataSourceExternalSecret.AppRoleAuthOption</h3>
<p></p>
@@ -3426,45 +3398,31 @@ classification and user_comment is parsed from the comment. </p></td>
<tbody>
<tr>
- <td>name</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The name of the event. </p></td>
- </tr>
-
- <tr>
- <td>definition</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The schedule of the event. </p></td>
- </tr>
-
- <tr>
- <td>time_zone</td>
+ <td>role_id</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The time zone of the event. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>sql_mode</td>
+ <td>secret_id</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>the secret id for the role without ttl. </p></td>
</tr>
<tr>
- <td>character_set_client</td>
- <td><a href="#string">string</a></td>
+ <td>type</td>
+ <td><a href="#bytebase.store.DataSourceExternalSecret.AppRoleAuthOption.SecretType">DataSourceExternalSecret.AppRoleAuthOption.SecretType</a></td>
<td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>collation_connection</td>
+ <td>mount_path</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The path where the approle auth method is mounted. </p></td>
</tr>
</tbody>
@@ -3474,8 +3432,8 @@ classification and user_comment is parsed from the comment. </p></td>
- <h3 id="bytebase.store.ExtensionMetadata">ExtensionMetadata</h3>
- <p>ExtensionMetadata is the metadata for extensions.</p>
+ <h3 id="bytebase.store.DataSourceOptions">DataSourceOptions</h3>
+ <p></p>
<table class="field-table">
@@ -3485,282 +3443,173 @@ classification and user_comment is parsed from the comment. </p></td>
<tbody>
<tr>
- <td>name</td>
- <td><a href="#string">string</a></td>
+ <td>srv</td>
+ <td><a href="#bool">bool</a></td>
<td></td>
- <td><p>The name is the name of an extension. </p></td>
+ <td><p>srv is a boolean flag that indicates whether the host is a DNS SRV record. </p></td>
</tr>
<tr>
- <td>schema</td>
+ <td>authentication_database</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The schema is the extension that is installed to. But the extension usage
-is not limited to the schema. </p></td>
+ <td><p>authentication_database is the database name to authenticate against, which stores the user credentials. </p></td>
</tr>
<tr>
- <td>version</td>
+ <td>sid</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The version is the version of an extension. </p></td>
+ <td><p>sid and service_name are used for Oracle. </p></td>
</tr>
<tr>
- <td>description</td>
+ <td>service_name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The description is the description of an extension. </p></td>
+ <td><p> </p></td>
</tr>
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.store.ExternalTableMetadata">ExternalTableMetadata</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>name</td>
+ <td>ssh_host</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the name of a external table. </p></td>
+ <td><p>SSH related
+The hostname of the SSH server agent. </p></td>
</tr>
<tr>
- <td>external_server_name</td>
+ <td>ssh_port</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The external_server_name is the name of the external server. </p></td>
+ <td><p>The port of the SSH server agent. It&#39;s 22 typically. </p></td>
</tr>
<tr>
- <td>external_database_name</td>
+ <td>ssh_user</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The external_database_name is the name of the external database. </p></td>
+ <td><p>The user to login the server. </p></td>
</tr>
<tr>
- <td>columns</td>
- <td><a href="#bytebase.store.ColumnMetadata">ColumnMetadata</a></td>
- <td>repeated</td>
- <td><p>The columns is the ordered list of columns in a foreign table. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.store.ForeignKeyMetadata">ForeignKeyMetadata</h3>
- <p>ForeignKeyMetadata is the metadata for foreign keys.</p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>name</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The name is the name of a foreign key. </p></td>
- </tr>
-
- <tr>
- <td>columns</td>
- <td><a href="#string">string</a></td>
- <td>repeated</td>
- <td><p>The columns are the ordered referencing columns of a foreign key. </p></td>
- </tr>
-
- <tr>
- <td>referenced_schema</td>
+ <td>ssh_obfuscated_password</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The referenced_schema is the referenced schema name of a foreign key.
-It is an empty string for databases without such concept such as MySQL. </p></td>
+ <td><p>The password to login the server. If it&#39;s empty string, no password is required. </p></td>
</tr>
<tr>
- <td>referenced_table</td>
+ <td>ssh_obfuscated_private_key</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The referenced_table is the referenced table name of a foreign key. </p></td>
- </tr>
-
- <tr>
- <td>referenced_columns</td>
- <td><a href="#string">string</a></td>
- <td>repeated</td>
- <td><p>The referenced_columns are the ordered referenced columns of a foreign key. </p></td>
+ <td><p>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;). </p></td>
</tr>
<tr>
- <td>on_delete</td>
+ <td>authentication_private_key_obfuscated</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The on_delete is the on delete action of a foreign key. </p></td>
+ <td><p>PKCS#8 private key in PEM format. If it&#39;s empty string, no private key is required.
+Used for authentication when connecting to the data source. </p></td>
</tr>
<tr>
- <td>on_update</td>
- <td><a href="#string">string</a></td>
+ <td>external_secret</td>
+ <td><a href="#bytebase.store.DataSourceExternalSecret">DataSourceExternalSecret</a></td>
<td></td>
- <td><p>The on_update is the on update action of a foreign key. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>match_type</td>
- <td><a href="#string">string</a></td>
+ <td>authentication_type</td>
+ <td><a href="#bytebase.store.DataSourceOptions.AuthenticationType">DataSourceOptions.AuthenticationType</a></td>
<td></td>
- <td><p>The match_type is the match type of a foreign key.
-The match_type is the PostgreSQL specific field.
-It&#39;s empty string for other databases. </p></td>
+ <td><p> </p></td>
</tr>
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.store.FunctionConfig">FunctionConfig</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>name</td>
- <td><a href="#string">string</a></td>
+ <td>sasl_config</td>
+ <td><a href="#bytebase.store.SASLConfig">SASLConfig</a></td>
<td></td>
- <td><p>The name is the name of a function. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>updater</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The last updater of the function in branch.
-Format: users/{userUID}. </p></td>
+ <td>additional_addresses</td>
+ <td><a href="#bytebase.store.DataSourceOptions.Address">DataSourceOptions.Address</a></td>
+ <td>repeated</td>
+ <td><p>additional_addresses is used for MongoDB replica set. </p></td>
</tr>
<tr>
- <td>source_branch</td>
+ <td>replica_set</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The last change come from branch.
-Format: projcets/{project}/branches/{branch} </p></td>
+ <td><p>replica_set is used for MongoDB replica set. </p></td>
</tr>
<tr>
- <td>update_time</td>
- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
+ <td>direct_connection</td>
+ <td><a href="#bool">bool</a></td>
<td></td>
- <td><p>The timestamp when the function is updated in branch. </p></td>
+ <td><p>direct_connection is used for MongoDB to dispatch all the operations to the node specified in the connection string. </p></td>
</tr>
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.store.FunctionMetadata">FunctionMetadata</h3>
- <p>FunctionMetadata is the metadata for functions.</p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
<tr>
- <td>name</td>
+ <td>region</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the name of a function. </p></td>
+ <td><p>region is the location of where the DB is, works for AWS RDS. For example, us-east-1. </p></td>
</tr>
<tr>
- <td>definition</td>
+ <td>warehouse_id</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The definition is the definition of a function. </p></td>
+ <td><p>warehouse_id is used by Databricks. </p></td>
</tr>
<tr>
- <td>signature</td>
+ <td>master_name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The signature is the name with the number and type of input arguments the
-function takes. </p></td>
+ <td><p>master_name is the master name used by connecting redis-master via redis sentinel. </p></td>
</tr>
<tr>
- <td>character_set_client</td>
+ <td>master_username</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>MySQL specific metadata. </p></td>
+ <td><p>master_username and master_obfuscated_password are master credentials used by redis sentinel mode. </p></td>
</tr>
<tr>
- <td>collation_connection</td>
+ <td>master_obfuscated_password</td>
<td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>database_collation</td>
- <td><a href="#string">string</a></td>
+ <td>redis_type</td>
+ <td><a href="#bytebase.store.DataSourceOptions.RedisType">DataSourceOptions.RedisType</a></td>
<td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>sql_mode</td>
- <td><a href="#string">string</a></td>
+ <td>use_ssl</td>
+ <td><a href="#bool">bool</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>Use SSL to connect to the data source. By default, we use system default SSL configuration. </p></td>
</tr>
<tr>
- <td>comment</td>
+ <td>cluster</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>dependency_tables</td>
- <td><a href="#bytebase.store.DependencyTable">DependencyTable</a></td>
- <td>repeated</td>
- <td><p>The dependency_tables is the list of dependency tables of a function.
-For PostgreSQL, it&#39;s the list of tables that the function depends on the return type definition. </p></td>
+ <td><p>Cluster is the cluster name for the data source. Used by CockroachDB. </p></td>
</tr>
</tbody>
@@ -3770,7 +3619,7 @@ For PostgreSQL, it&#39;s the list of tables that the function depends on the ret
- <h3 id="bytebase.store.GenerationMetadata">GenerationMetadata</h3>
+ <h3 id="bytebase.store.DataSourceOptions.Address">DataSourceOptions.Address</h3>
<p></p>
@@ -3781,14 +3630,14 @@ For PostgreSQL, it&#39;s the list of tables that the function depends on the ret
<tbody>
<tr>
- <td>type</td>
- <td><a href="#bytebase.store.GenerationMetadata.Type">GenerationMetadata.Type</a></td>
+ <td>host</td>
+ <td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>expression</td>
+ <td>port</td>
<td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
@@ -3801,8 +3650,8 @@ For PostgreSQL, it&#39;s the list of tables that the function depends on the ret
- <h3 id="bytebase.store.IndexMetadata">IndexMetadata</h3>
- <p>IndexMetadata is the metadata for indexes.</p>
+ <h3 id="bytebase.store.KerberosConfig">KerberosConfig</h3>
+ <p></p>
<table class="field-table">
@@ -3812,104 +3661,52 @@ For PostgreSQL, it&#39;s the list of tables that the function depends on the ret
<tbody>
<tr>
- <td>name</td>
+ <td>primary</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the name of an index. </p></td>
- </tr>
-
- <tr>
- <td>expressions</td>
- <td><a href="#string">string</a></td>
- <td>repeated</td>
- <td><p>The expressions are the ordered columns or expressions of an index.
-This could refer to a column or an expression. </p></td>
- </tr>
-
- <tr>
- <td>key_length</td>
- <td><a href="#int64">int64</a></td>
- <td>repeated</td>
- <td><p>The key_lengths are the ordered key lengths of an index.
-If the key length is not specified, it&#39;s -1. </p></td>
- </tr>
-
- <tr>
- <td>descending</td>
- <td><a href="#bool">bool</a></td>
- <td>repeated</td>
- <td><p>The descending is the ordered descending of an index. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>type</td>
+ <td>instance</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The type is the type of an index. </p></td>
- </tr>
-
- <tr>
- <td>unique</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>The unique is whether the index is unique. </p></td>
- </tr>
-
- <tr>
- <td>primary</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>The primary is whether the index is a primary key index. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>visible</td>
- <td><a href="#bool">bool</a></td>
+ <td>realm</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p>The visible is whether the index is visible. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>comment</td>
- <td><a href="#string">string</a></td>
+ <td>keytab</td>
+ <td><a href="#bytes">bytes</a></td>
<td></td>
- <td><p>The comment is the comment of an index. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>definition</td>
+ <td>kdc_host</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The definition of an index. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>parent_index_schema</td>
+ <td>kdc_port</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The schema name of the parent index. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>parent_index_name</td>
+ <td>kdc_transport_protocol</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The index name of the parent index. </p></td>
- </tr>
-
- <tr>
- <td>granularity</td>
- <td><a href="#int64">int64</a></td>
- <td></td>
- <td><p>The number of granules in the block. It&#39;s a ClickHouse specific field. </p></td>
- </tr>
-
- <tr>
- <td>is_constraint</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>It&#39;s a PostgreSQL specific field.
-The unique constraint and unique index are not the same thing in PostgreSQL. </p></td>
+ <td><p> </p></td>
</tr>
</tbody>
@@ -3919,8 +3716,8 @@ The unique constraint and unique index are not the same thing in PostgreSQL. </p
- <h3 id="bytebase.store.InstanceRoleMetadata">InstanceRoleMetadata</h3>
- <p>InstanceRoleMetadata is the message for instance role.</p>
+ <h3 id="bytebase.store.SASLConfig">SASLConfig</h3>
+ <p></p>
<table class="field-table">
@@ -3930,18 +3727,10 @@ The unique constraint and unique index are not the same thing in PostgreSQL. </p
<tbody>
<tr>
- <td>name</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The role name. It&#39;s unique within the instance. </p></td>
- </tr>
-
- <tr>
- <td>grant</td>
- <td><a href="#string">string</a></td>
+ <td>krb_config</td>
+ <td><a href="#bytebase.store.KerberosConfig">KerberosConfig</a></td>
<td></td>
- <td><p>The grant display string on the instance. It&#39;s generated by database
-engine. </p></td>
+ <td><p> </p></td>
</tr>
</tbody>
@@ -3951,7 +3740,184 @@ engine. </p></td>
- <h3 id="bytebase.store.LinkedDatabaseMetadata">LinkedDatabaseMetadata</h3>
+
+
+ <h3 id="bytebase.store.DataSourceExternalSecret.AppRoleAuthOption.SecretType">DataSourceExternalSecret.AppRoleAuthOption.SecretType</h3>
+ <p></p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>SECRET_TYPE_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>PLAIN</td>
+ <td>1</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>ENVIRONMENT</td>
+ <td>2</td>
+ <td><p></p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+ <h3 id="bytebase.store.DataSourceExternalSecret.AuthType">DataSourceExternalSecret.AuthType</h3>
+ <p></p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>AUTH_TYPE_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>TOKEN</td>
+ <td>1</td>
+ <td><p>ref: https://developer.hashicorp.com/vault/docs/auth/token</p></td>
+ </tr>
+
+ <tr>
+ <td>VAULT_APP_ROLE</td>
+ <td>2</td>
+ <td><p>ref: https://developer.hashicorp.com/vault/docs/auth/approle</p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+ <h3 id="bytebase.store.DataSourceExternalSecret.SecretType">DataSourceExternalSecret.SecretType</h3>
+ <p></p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>SAECRET_TYPE_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>VAULT_KV_V2</td>
+ <td>1</td>
+ <td><p>ref: https://developer.hashicorp.com/vault/api-docs/secret/kv/kv-v2</p></td>
+ </tr>
+
+ <tr>
+ <td>AWS_SECRETS_MANAGER</td>
+ <td>2</td>
+ <td><p>ref: https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html</p></td>
+ </tr>
+
+ <tr>
+ <td>GCP_SECRET_MANAGER</td>
+ <td>3</td>
+ <td><p>ref: https://cloud.google.com/secret-manager/docs</p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+ <h3 id="bytebase.store.DataSourceOptions.AuthenticationType">DataSourceOptions.AuthenticationType</h3>
+ <p></p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>AUTHENTICATION_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>PASSWORD</td>
+ <td>1</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>GOOGLE_CLOUD_SQL_IAM</td>
+ <td>2</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>AWS_RDS_IAM</td>
+ <td>3</td>
+ <td><p></p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+ <h3 id="bytebase.store.DataSourceOptions.RedisType">DataSourceOptions.RedisType</h3>
+ <p></p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>REDIS_TYPE_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>STANDALONE</td>
+ <td>1</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>SENTINEL</td>
+ <td>2</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>CLUSTER</td>
+ <td>3</td>
+ <td><p></p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
+
+
+ <div class="file-heading">
+ <h2 id="store/database.proto">store/database.proto</h2><a href="#title">Top</a>
+ </div>
+ <p></p>
+
+
+ <h3 id="bytebase.store.CheckConstraintMetadata">CheckConstraintMetadata</h3>
<p></p>
@@ -3965,21 +3931,14 @@ engine. </p></td>
<td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>username</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p> </p></td>
+ <td><p>The name is the name of a check constraint. </p></td>
</tr>
<tr>
- <td>host</td>
+ <td>expression</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The expression is the expression of a check constraint. </p></td>
</tr>
</tbody>
@@ -3989,8 +3948,8 @@ engine. </p></td>
- <h3 id="bytebase.store.MaterializedViewMetadata">MaterializedViewMetadata</h3>
- <p>MaterializedViewMetadata is the metadata for materialized views.</p>
+ <h3 id="bytebase.store.ColumnCatalog">ColumnCatalog</h3>
+ <p></p>
<table class="field-table">
@@ -4003,42 +3962,56 @@ engine. </p></td>
<td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the name of a view. </p></td>
+ <td><p>The name is the name of a column. </p></td>
</tr>
<tr>
- <td>definition</td>
+ <td>semantic_type</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The definition is the definition of a view. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>comment</td>
+ <td>labels</td>
+ <td><a href="#bytebase.store.ColumnCatalog.LabelsEntry">ColumnCatalog.LabelsEntry</a></td>
+ <td>repeated</td>
+ <td><p>The user labels for a column. </p></td>
+ </tr>
+
+ <tr>
+ <td>classification</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The comment is the comment of a view. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>dependency_columns</td>
- <td><a href="#bytebase.store.DependencyColumn">DependencyColumn</a></td>
- <td>repeated</td>
- <td><p>The dependency_columns is the list of dependency columns of a view. </p></td>
+ <td>object_schema</td>
+ <td><a href="#bytebase.store.ObjectSchema">ObjectSchema</a></td>
+ <td>optional</td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>triggers</td>
- <td><a href="#bytebase.store.TriggerMetadata">TriggerMetadata</a></td>
- <td>repeated</td>
- <td><p>The columns is the ordered list of columns in a table. </p></td>
+ <td>masking_level</td>
+ <td><a href="#bytebase.store.MaskingLevel">MaskingLevel</a></td>
+ <td></td>
+ <td><p>Deprecated. </p></td>
</tr>
<tr>
- <td>indexes</td>
- <td><a href="#bytebase.store.IndexMetadata">IndexMetadata</a></td>
- <td>repeated</td>
- <td><p>The indexes is the list of indexes in a table. </p></td>
+ <td>full_masking_algorithm_id</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>Deprecated. </p></td>
+ </tr>
+
+ <tr>
+ <td>partial_masking_algorithm_id</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>Deprecated. </p></td>
</tr>
</tbody>
@@ -4048,7 +4021,7 @@ engine. </p></td>
- <h3 id="bytebase.store.ObjectSchema">ObjectSchema</h3>
+ <h3 id="bytebase.store.ColumnCatalog.LabelsEntry">ColumnCatalog.LabelsEntry</h3>
<p></p>
@@ -4059,28 +4032,14 @@ engine. </p></td>
<tbody>
<tr>
- <td>type</td>
- <td><a href="#bytebase.store.ObjectSchema.Type">ObjectSchema.Type</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>struct_kind</td>
- <td><a href="#bytebase.store.ObjectSchema.StructKind">ObjectSchema.StructKind</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>array_kind</td>
- <td><a href="#bytebase.store.ObjectSchema.ArrayKind">ObjectSchema.ArrayKind</a></td>
+ <td>key</td>
+ <td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>semantic_type</td>
+ <td>value</td>
<td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
@@ -4093,8 +4052,8 @@ engine. </p></td>
- <h3 id="bytebase.store.ObjectSchema.ArrayKind">ObjectSchema.ArrayKind</h3>
- <p></p>
+ <h3 id="bytebase.store.ColumnMetadata">ColumnMetadata</h3>
+ <p>ColumnMetadata is the metadata for columns.</p>
<table class="field-table">
@@ -4104,12 +4063,100 @@ engine. </p></td>
<tbody>
<tr>
- <td>kind</td>
- <td><a href="#bytebase.store.ObjectSchema">ObjectSchema</a></td>
+ <td>name</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The name is the name of a column. </p></td>
+ </tr>
+
+ <tr>
+ <td>position</td>
+ <td><a href="#int32">int32</a></td>
+ <td></td>
+ <td><p>The position is the position in columns. </p></td>
+ </tr>
+
+ <tr>
+ <td>default</td>
+ <td><a href="#google.protobuf.StringValue">google.protobuf.StringValue</a></td>
+ <td></td>
+ <td><p>The default is the default of a column. Use google.protobuf.StringValue
+to distinguish between an empty string default value or no default. </p></td>
+ </tr>
+
+ <tr>
+ <td>default_null</td>
+ <td><a href="#bool">bool</a></td>
<td></td>
<td><p> </p></td>
</tr>
+ <tr>
+ <td>default_expression</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
+ <tr>
+ <td>on_update</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The on_update is the on update action of a column.
+For MySQL like databases, it&#39;s only supported for TIMESTAMP columns with
+CURRENT_TIMESTAMP as on update value. </p></td>
+ </tr>
+
+ <tr>
+ <td>nullable</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>The nullable is the nullable of a column. </p></td>
+ </tr>
+
+ <tr>
+ <td>type</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The type is the type of a column. </p></td>
+ </tr>
+
+ <tr>
+ <td>character_set</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The character_set is the character_set of a column. </p></td>
+ </tr>
+
+ <tr>
+ <td>collation</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The collation is the collation of a column. </p></td>
+ </tr>
+
+ <tr>
+ <td>comment</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The comment is the comment of a column.
+classification and user_comment is parsed from the comment. </p></td>
+ </tr>
+
+ <tr>
+ <td>user_comment</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The user_comment is the user comment of a table parsed from the comment. </p></td>
+ </tr>
+
+ <tr>
+ <td>generation</td>
+ <td><a href="#bytebase.store.GenerationMetadata">GenerationMetadata</a></td>
+ <td></td>
+ <td><p>The generation is for generated columns. </p></td>
+ </tr>
+
</tbody>
</table>
@@ -4117,7 +4164,7 @@ engine. </p></td>
- <h3 id="bytebase.store.ObjectSchema.StructKind">ObjectSchema.StructKind</h3>
+ <h3 id="bytebase.store.DatabaseConfig">DatabaseConfig</h3>
<p></p>
@@ -4128,12 +4175,19 @@ engine. </p></td>
<tbody>
<tr>
- <td>properties</td>
- <td><a href="#bytebase.store.ObjectSchema.StructKind.PropertiesEntry">ObjectSchema.StructKind.PropertiesEntry</a></td>
- <td>repeated</td>
+ <td>name</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
<td><p> </p></td>
</tr>
+ <tr>
+ <td>schemas</td>
+ <td><a href="#bytebase.store.SchemaCatalog">SchemaCatalog</a></td>
+ <td>repeated</td>
+ <td><p>The schema_configs is the list of configs for schemas in a database. </p></td>
+ </tr>
+
</tbody>
</table>
@@ -4141,8 +4195,8 @@ engine. </p></td>
- <h3 id="bytebase.store.ObjectSchema.StructKind.PropertiesEntry">ObjectSchema.StructKind.PropertiesEntry</h3>
- <p></p>
+ <h3 id="bytebase.store.DatabaseMetadata">DatabaseMetadata</h3>
+ <p>DatabaseMetadata is the metadata for databases.</p>
<table class="field-table">
@@ -4152,15 +4206,22 @@ engine. </p></td>
<tbody>
<tr>
- <td>key</td>
- <td><a href="#string">string</a></td>
+ <td>labels</td>
+ <td><a href="#bytebase.store.DatabaseMetadata.LabelsEntry">DatabaseMetadata.LabelsEntry</a></td>
+ <td>repeated</td>
+ <td><p> </p></td>
+ </tr>
+
+ <tr>
+ <td>last_sync_time</td>
+ <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
<td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>value</td>
- <td><a href="#bytebase.store.ObjectSchema">ObjectSchema</a></td>
+ <td>backup_available</td>
+ <td><a href="#bool">bool</a></td>
<td></td>
<td><p> </p></td>
</tr>
@@ -4172,8 +4233,8 @@ engine. </p></td>
- <h3 id="bytebase.store.PackageMetadata">PackageMetadata</h3>
- <p>PackageMetadata is the metadata for packages.</p>
+ <h3 id="bytebase.store.DatabaseMetadata.LabelsEntry">DatabaseMetadata.LabelsEntry</h3>
+ <p></p>
<table class="field-table">
@@ -4183,17 +4244,17 @@ engine. </p></td>
<tbody>
<tr>
- <td>name</td>
+ <td>key</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the name of a package. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>definition</td>
+ <td>value</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The definition is the definition of a package. </p></td>
+ <td><p> </p></td>
</tr>
</tbody>
@@ -4203,8 +4264,8 @@ engine. </p></td>
- <h3 id="bytebase.store.ProcedureConfig">ProcedureConfig</h3>
- <p></p>
+ <h3 id="bytebase.store.DatabaseSchemaMetadata">DatabaseSchemaMetadata</h3>
+ <p>DatabaseSchemaMetadata is the schema metadata for databases.</p>
<table class="field-table">
@@ -4217,30 +4278,63 @@ engine. </p></td>
<td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the name of a procedure. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>updater</td>
+ <td>schemas</td>
+ <td><a href="#bytebase.store.SchemaMetadata">SchemaMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The schemas is the list of schemas in a database. </p></td>
+ </tr>
+
+ <tr>
+ <td>character_set</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The last updater of the procedure in branch.
-Format: users/{userUID}. </p></td>
+ <td><p>The character_set is the character set of a database. </p></td>
</tr>
<tr>
- <td>source_branch</td>
+ <td>collation</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The last change come from branch.
-Format: projcets/{project}/branches/{branch} </p></td>
+ <td><p>The collation is the collation of a database. </p></td>
</tr>
<tr>
- <td>update_time</td>
- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
+ <td>extensions</td>
+ <td><a href="#bytebase.store.ExtensionMetadata">ExtensionMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The extensions is the list of extensions in a database. </p></td>
+ </tr>
+
+ <tr>
+ <td>datashare</td>
+ <td><a href="#bool">bool</a></td>
<td></td>
- <td><p>The timestamp when the procedure is updated in branch. </p></td>
+ <td><p>The database belongs to a datashare. </p></td>
+ </tr>
+
+ <tr>
+ <td>service_name</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The service name of the database. It&#39;s the Oracle specific concept. </p></td>
+ </tr>
+
+ <tr>
+ <td>linked_databases</td>
+ <td><a href="#bytebase.store.LinkedDatabaseMetadata">LinkedDatabaseMetadata</a></td>
+ <td>repeated</td>
+ <td><p> </p></td>
+ </tr>
+
+ <tr>
+ <td>owner</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p> </p></td>
</tr>
</tbody>
@@ -4250,8 +4344,8 @@ Format: projcets/{project}/branches/{branch} </p></td>
- <h3 id="bytebase.store.ProcedureMetadata">ProcedureMetadata</h3>
- <p>ProcedureMetadata is the metadata for procedures.</p>
+ <h3 id="bytebase.store.DependencyColumn">DependencyColumn</h3>
+ <p>DependencyColumn is the metadata for dependency columns.</p>
<table class="field-table">
@@ -4261,53 +4355,55 @@ Format: projcets/{project}/branches/{branch} </p></td>
<tbody>
<tr>
- <td>name</td>
+ <td>schema</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the name of a procedure. </p></td>
+ <td><p>The schema is the schema of a reference column. </p></td>
</tr>
<tr>
- <td>definition</td>
+ <td>table</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The definition is the definition of a procedure. </p></td>
+ <td><p>The table is the table of a reference column. </p></td>
</tr>
<tr>
- <td>signature</td>
+ <td>column</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The signature is the name with the number and type of input arguments the
-function takes. </p></td>
- </tr>
-
- <tr>
- <td>character_set_client</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>MySQL specific metadata. </p></td>
+ <td><p>The column is the name of a reference column. </p></td>
</tr>
- <tr>
- <td>collation_connection</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.store.DependencyTable">DependencyTable</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>database_collation</td>
+ <td>schema</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The schema is the schema of a reference table. </p></td>
</tr>
<tr>
- <td>sql_mode</td>
+ <td>table</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The table is the name of a reference table. </p></td>
</tr>
</tbody>
@@ -4317,7 +4413,7 @@ function takes. </p></td>
- <h3 id="bytebase.store.SchemaCatalog">SchemaCatalog</h3>
+ <h3 id="bytebase.store.EnumTypeMetadata">EnumTypeMetadata</h3>
<p></p>
@@ -4331,35 +4427,20 @@ function takes. </p></td>
<td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the schema name.
-It is an empty string for databases without such concept such as MySQL. </p></td>
- </tr>
-
- <tr>
- <td>tables</td>
- <td><a href="#bytebase.store.TableCatalog">TableCatalog</a></td>
- <td>repeated</td>
- <td><p>The table_configs is the list of configs for tables in a schema. </p></td>
- </tr>
-
- <tr>
- <td>function_configs</td>
- <td><a href="#bytebase.store.FunctionConfig">FunctionConfig</a></td>
- <td>repeated</td>
- <td><p> </p></td>
+ <td><p>The name of a type. </p></td>
</tr>
<tr>
- <td>procedure_configs</td>
- <td><a href="#bytebase.store.ProcedureConfig">ProcedureConfig</a></td>
+ <td>values</td>
+ <td><a href="#string">string</a></td>
<td>repeated</td>
- <td><p> </p></td>
+ <td><p>The enum values of a type. </p></td>
</tr>
<tr>
- <td>view_configs</td>
- <td><a href="#bytebase.store.ViewConfig">ViewConfig</a></td>
- <td>repeated</td>
+ <td>comment</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
<td><p> </p></td>
</tr>
@@ -4370,8 +4451,8 @@ It is an empty string for databases without such concept such as MySQL. </p></td
- <h3 id="bytebase.store.SchemaMetadata">SchemaMetadata</h3>
- <p>SchemaMetadata is the metadata for schemas.</p><p>This is the concept of schema in Postgres, but it's a no-op for MySQL.</p>
+ <h3 id="bytebase.store.EventMetadata">EventMetadata</h3>
+ <p></p>
<table class="field-table">
@@ -4384,100 +4465,41 @@ It is an empty string for databases without such concept such as MySQL. </p></td
<td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the schema name.
-It is an empty string for databases without such concept such as MySQL. </p></td>
- </tr>
-
- <tr>
- <td>tables</td>
- <td><a href="#bytebase.store.TableMetadata">TableMetadata</a></td>
- <td>repeated</td>
- <td><p>The tables is the list of tables in a schema. </p></td>
- </tr>
-
- <tr>
- <td>external_tables</td>
- <td><a href="#bytebase.store.ExternalTableMetadata">ExternalTableMetadata</a></td>
- <td>repeated</td>
- <td><p>The external_tables is the list of external tables in a schema. </p></td>
- </tr>
-
- <tr>
- <td>views</td>
- <td><a href="#bytebase.store.ViewMetadata">ViewMetadata</a></td>
- <td>repeated</td>
- <td><p>The views is the list of views in a schema. </p></td>
- </tr>
-
- <tr>
- <td>functions</td>
- <td><a href="#bytebase.store.FunctionMetadata">FunctionMetadata</a></td>
- <td>repeated</td>
- <td><p>The functions is the list of functions in a schema. </p></td>
- </tr>
-
- <tr>
- <td>procedures</td>
- <td><a href="#bytebase.store.ProcedureMetadata">ProcedureMetadata</a></td>
- <td>repeated</td>
- <td><p>The procedures is the list of procedures in a schema. </p></td>
- </tr>
-
- <tr>
- <td>streams</td>
- <td><a href="#bytebase.store.StreamMetadata">StreamMetadata</a></td>
- <td>repeated</td>
- <td><p>The streams is the list of streams in a schema, currently, only used for
-Snowflake. </p></td>
- </tr>
-
- <tr>
- <td>tasks</td>
- <td><a href="#bytebase.store.TaskMetadata">TaskMetadata</a></td>
- <td>repeated</td>
- <td><p>The routines is the list of routines in a schema, currently, only used for
-Snowflake. </p></td>
- </tr>
-
- <tr>
- <td>materialized_views</td>
- <td><a href="#bytebase.store.MaterializedViewMetadata">MaterializedViewMetadata</a></td>
- <td>repeated</td>
- <td><p>The materialized_views is the list of materialized views in a schema. </p></td>
+ <td><p>The name of the event. </p></td>
</tr>
<tr>
- <td>sequences</td>
- <td><a href="#bytebase.store.SequenceMetadata">SequenceMetadata</a></td>
- <td>repeated</td>
- <td><p>The sequences is the list of sequences in a schema. </p></td>
+ <td>definition</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The schedule of the event. </p></td>
</tr>
<tr>
- <td>packages</td>
- <td><a href="#bytebase.store.PackageMetadata">PackageMetadata</a></td>
- <td>repeated</td>
- <td><p>The packages is the list of packages in a schema. </p></td>
+ <td>time_zone</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The time zone of the event. </p></td>
</tr>
<tr>
- <td>owner</td>
+ <td>sql_mode</td>
<td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>events</td>
- <td><a href="#bytebase.store.EventMetadata">EventMetadata</a></td>
- <td>repeated</td>
+ <td>character_set_client</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>enum_types</td>
- <td><a href="#bytebase.store.EnumTypeMetadata">EnumTypeMetadata</a></td>
- <td>repeated</td>
+ <td>collation_connection</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
<td><p> </p></td>
</tr>
@@ -4488,8 +4510,8 @@ Snowflake. </p></td>
- <h3 id="bytebase.store.SecretItem">SecretItem</h3>
- <p></p>
+ <h3 id="bytebase.store.ExtensionMetadata">ExtensionMetadata</h3>
+ <p>ExtensionMetadata is the metadata for extensions.</p>
<table class="field-table">
@@ -4502,21 +4524,29 @@ Snowflake. </p></td>
<td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the name of the secret. </p></td>
+ <td><p>The name is the name of an extension. </p></td>
</tr>
<tr>
- <td>value</td>
+ <td>schema</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The value is the value of the secret. </p></td>
+ <td><p>The schema is the extension that is installed to. But the extension usage
+is not limited to the schema. </p></td>
+ </tr>
+
+ <tr>
+ <td>version</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The version is the version of an extension. </p></td>
</tr>
<tr>
<td>description</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The description is the description of the secret. </p></td>
+ <td><p>The description is the description of an extension. </p></td>
</tr>
</tbody>
@@ -4526,7 +4556,7 @@ Snowflake. </p></td>
- <h3 id="bytebase.store.Secrets">Secrets</h3>
+ <h3 id="bytebase.store.ExternalTableMetadata">ExternalTableMetadata</h3>
<p></p>
@@ -4537,10 +4567,31 @@ Snowflake. </p></td>
<tbody>
<tr>
- <td>items</td>
- <td><a href="#bytebase.store.SecretItem">SecretItem</a></td>
+ <td>name</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The name is the name of a external table. </p></td>
+ </tr>
+
+ <tr>
+ <td>external_server_name</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The external_server_name is the name of the external server. </p></td>
+ </tr>
+
+ <tr>
+ <td>external_database_name</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The external_database_name is the name of the external database. </p></td>
+ </tr>
+
+ <tr>
+ <td>columns</td>
+ <td><a href="#bytebase.store.ColumnMetadata">ColumnMetadata</a></td>
<td>repeated</td>
- <td><p>The list of secrets. </p></td>
+ <td><p>The columns is the ordered list of columns in a foreign table. </p></td>
</tr>
</tbody>
@@ -4550,8 +4601,8 @@ Snowflake. </p></td>
- <h3 id="bytebase.store.SequenceMetadata">SequenceMetadata</h3>
- <p></p>
+ <h3 id="bytebase.store.ForeignKeyMetadata">ForeignKeyMetadata</h3>
+ <p>ForeignKeyMetadata is the metadata for foreign keys.</p>
<table class="field-table">
@@ -4564,84 +4615,106 @@ Snowflake. </p></td>
<td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name of a sequence. </p></td>
+ <td><p>The name is the name of a foreign key. </p></td>
</tr>
<tr>
- <td>data_type</td>
+ <td>columns</td>
<td><a href="#string">string</a></td>
- <td></td>
- <td><p>The data type of a sequence. </p></td>
+ <td>repeated</td>
+ <td><p>The columns are the ordered referencing columns of a foreign key. </p></td>
</tr>
<tr>
- <td>start</td>
+ <td>referenced_schema</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The start value of a sequence. </p></td>
+ <td><p>The referenced_schema is the referenced schema name of a foreign key.
+It is an empty string for databases without such concept such as MySQL. </p></td>
</tr>
<tr>
- <td>min_value</td>
+ <td>referenced_table</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The minimum value of a sequence. </p></td>
+ <td><p>The referenced_table is the referenced table name of a foreign key. </p></td>
</tr>
<tr>
- <td>max_value</td>
+ <td>referenced_columns</td>
<td><a href="#string">string</a></td>
- <td></td>
- <td><p>The maximum value of a sequence. </p></td>
+ <td>repeated</td>
+ <td><p>The referenced_columns are the ordered referenced columns of a foreign key. </p></td>
</tr>
<tr>
- <td>increment</td>
+ <td>on_delete</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>Increment value of a sequence. </p></td>
+ <td><p>The on_delete is the on delete action of a foreign key. </p></td>
</tr>
<tr>
- <td>cycle</td>
- <td><a href="#bool">bool</a></td>
+ <td>on_update</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p>Cycle is whether the sequence cycles. </p></td>
+ <td><p>The on_update is the on update action of a foreign key. </p></td>
</tr>
<tr>
- <td>cache_size</td>
+ <td>match_type</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>Cache size of a sequence. </p></td>
- </tr>
-
+ <td><p>The match_type is the match type of a foreign key.
+The match_type is the PostgreSQL specific field.
+It&#39;s empty string for other databases. </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.store.FunctionConfig">FunctionConfig</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>last_value</td>
+ <td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>Last value of a sequence. </p></td>
+ <td><p>The name is the name of a function. </p></td>
</tr>
<tr>
- <td>owner_table</td>
+ <td>updater</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The owner table of the sequence. </p></td>
+ <td><p>The last updater of the function in branch.
+Format: users/{userUID}. </p></td>
</tr>
<tr>
- <td>owner_column</td>
+ <td>source_branch</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The owner column of the sequence. </p></td>
+ <td><p>The last change come from branch.
+Format: projcets/{project}/branches/{branch} </p></td>
</tr>
<tr>
- <td>comment</td>
- <td><a href="#string">string</a></td>
+ <td>update_time</td>
+ <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The timestamp when the function is updated in branch. </p></td>
</tr>
</tbody>
@@ -4651,8 +4724,8 @@ Snowflake. </p></td>
- <h3 id="bytebase.store.StreamMetadata">StreamMetadata</h3>
- <p></p>
+ <h3 id="bytebase.store.FunctionMetadata">FunctionMetadata</h3>
+ <p>FunctionMetadata is the metadata for functions.</p>
<table class="field-table">
@@ -4665,56 +4738,65 @@ Snowflake. </p></td>
<td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the name of a stream. </p></td>
+ <td><p>The name is the name of a function. </p></td>
</tr>
<tr>
- <td>table_name</td>
+ <td>definition</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The table_name is the name of the table/view that the stream is created on. </p></td>
+ <td><p>The definition is the definition of a function. </p></td>
</tr>
<tr>
- <td>owner</td>
+ <td>signature</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The owner of the stream. </p></td>
+ <td><p>The signature is the name with the number and type of input arguments the
+function takes. </p></td>
</tr>
<tr>
- <td>comment</td>
+ <td>character_set_client</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The comment of the stream. </p></td>
+ <td><p>MySQL specific metadata. </p></td>
</tr>
<tr>
- <td>type</td>
- <td><a href="#bytebase.store.StreamMetadata.Type">StreamMetadata.Type</a></td>
+ <td>collation_connection</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p>The type of the stream. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>stale</td>
- <td><a href="#bool">bool</a></td>
+ <td>database_collation</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p>Indicates whether the stream was last read before the `stale_after` time. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>mode</td>
- <td><a href="#bytebase.store.StreamMetadata.Mode">StreamMetadata.Mode</a></td>
+ <td>sql_mode</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p>The mode of the stream. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>definition</td>
+ <td>comment</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The definition of the stream. </p></td>
+ <td><p> </p></td>
+ </tr>
+
+ <tr>
+ <td>dependency_tables</td>
+ <td><a href="#bytebase.store.DependencyTable">DependencyTable</a></td>
+ <td>repeated</td>
+ <td><p>The dependency_tables is the list of dependency tables of a function.
+For PostgreSQL, it&#39;s the list of tables that the function depends on the return type definition. </p></td>
</tr>
</tbody>
@@ -4724,7 +4806,7 @@ Snowflake. </p></td>
- <h3 id="bytebase.store.TableCatalog">TableCatalog</h3>
+ <h3 id="bytebase.store.GenerationMetadata">GenerationMetadata</h3>
<p></p>
@@ -4735,56 +4817,19 @@ Snowflake. </p></td>
<tbody>
<tr>
- <td>name</td>
- <td><a href="#string">string</a></td>
+ <td>type</td>
+ <td><a href="#bytebase.store.GenerationMetadata.Type">GenerationMetadata.Type</a></td>
<td></td>
- <td><p>The name is the name of a table. </p></td>
- </tr>
-
- <tr>
- <td>columns</td>
- <td><a href="#bytebase.store.ColumnCatalog">ColumnCatalog</a></td>
- <td>repeated</td>
- <td><p>The column_configs is the ordered list of configs for columns in a table. </p></td>
- </tr>
-
- <tr>
- <td>object_schema</td>
- <td><a href="#bytebase.store.ObjectSchema">ObjectSchema</a></td>
- <td>optional</td>
<td><p> </p></td>
</tr>
<tr>
- <td>classification</td>
+ <td>expression</td>
<td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>
- <tr>
- <td>updater</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The last updater of the table in branch.
-Format: users/{userUID}. </p></td>
- </tr>
-
- <tr>
- <td>source_branch</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The last change come from branch.
-Format: projcets/{project}/branches/{branch} </p></td>
- </tr>
-
- <tr>
- <td>update_time</td>
- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
- <td></td>
- <td><p>The timestamp when the table is updated in branch. </p></td>
- </tr>
-
</tbody>
</table>
@@ -4792,8 +4837,8 @@ Format: projcets/{project}/branches/{branch} </p></td>
- <h3 id="bytebase.store.TableMetadata">TableMetadata</h3>
- <p>TableMetadata is the metadata for tables.</p>
+ <h3 id="bytebase.store.IndexMetadata">IndexMetadata</h3>
+ <p>IndexMetadata is the metadata for indexes.</p>
<table class="field-table">
@@ -4806,135 +4851,101 @@ Format: projcets/{project}/branches/{branch} </p></td>
<td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the name of a table. </p></td>
+ <td><p>The name is the name of an index. </p></td>
</tr>
<tr>
- <td>columns</td>
- <td><a href="#bytebase.store.ColumnMetadata">ColumnMetadata</a></td>
+ <td>expressions</td>
+ <td><a href="#string">string</a></td>
<td>repeated</td>
- <td><p>The columns is the ordered list of columns in a table. </p></td>
+ <td><p>The expressions are the ordered columns or expressions of an index.
+This could refer to a column or an expression. </p></td>
</tr>
<tr>
- <td>indexes</td>
- <td><a href="#bytebase.store.IndexMetadata">IndexMetadata</a></td>
+ <td>key_length</td>
+ <td><a href="#int64">int64</a></td>
<td>repeated</td>
- <td><p>The indexes is the list of indexes in a table. </p></td>
- </tr>
-
- <tr>
- <td>engine</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The engine is the engine of a table. </p></td>
+ <td><p>The key_lengths are the ordered key lengths of an index.
+If the key length is not specified, it&#39;s -1. </p></td>
</tr>
<tr>
- <td>collation</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The collation is the collation of a table. </p></td>
+ <td>descending</td>
+ <td><a href="#bool">bool</a></td>
+ <td>repeated</td>
+ <td><p>The descending is the ordered descending of an index. </p></td>
</tr>
<tr>
- <td>charset</td>
+ <td>type</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The character set of table. </p></td>
- </tr>
-
- <tr>
- <td>row_count</td>
- <td><a href="#int64">int64</a></td>
- <td></td>
- <td><p>The row_count is the estimated number of rows of a table. </p></td>
+ <td><p>The type is the type of an index. </p></td>
</tr>
<tr>
- <td>data_size</td>
- <td><a href="#int64">int64</a></td>
+ <td>unique</td>
+ <td><a href="#bool">bool</a></td>
<td></td>
- <td><p>The data_size is the estimated data size of a table. </p></td>
+ <td><p>The unique is whether the index is unique. </p></td>
</tr>
<tr>
- <td>index_size</td>
- <td><a href="#int64">int64</a></td>
+ <td>primary</td>
+ <td><a href="#bool">bool</a></td>
<td></td>
- <td><p>The index_size is the estimated index size of a table. </p></td>
+ <td><p>The primary is whether the index is a primary key index. </p></td>
</tr>
<tr>
- <td>data_free</td>
- <td><a href="#int64">int64</a></td>
+ <td>visible</td>
+ <td><a href="#bool">bool</a></td>
<td></td>
- <td><p>The data_free is the estimated free data size of a table. </p></td>
+ <td><p>The visible is whether the index is visible. </p></td>
</tr>
<tr>
- <td>create_options</td>
+ <td>comment</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The create_options is the create option of a table. </p></td>
+ <td><p>The comment is the comment of an index. </p></td>
</tr>
<tr>
- <td>comment</td>
+ <td>definition</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The comment is the comment of a table.
-classification and user_comment is parsed from the comment. </p></td>
+ <td><p>The definition of an index. </p></td>
</tr>
<tr>
- <td>user_comment</td>
+ <td>parent_index_schema</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The user_comment is the user comment of a table parsed from the comment. </p></td>
- </tr>
-
- <tr>
- <td>foreign_keys</td>
- <td><a href="#bytebase.store.ForeignKeyMetadata">ForeignKeyMetadata</a></td>
- <td>repeated</td>
- <td><p>The foreign_keys is the list of foreign keys in a table. </p></td>
- </tr>
-
- <tr>
- <td>partitions</td>
- <td><a href="#bytebase.store.TablePartitionMetadata">TablePartitionMetadata</a></td>
- <td>repeated</td>
- <td><p>The partitions is the list of partitions in a table. </p></td>
- </tr>
-
- <tr>
- <td>check_constraints</td>
- <td><a href="#bytebase.store.CheckConstraintMetadata">CheckConstraintMetadata</a></td>
- <td>repeated</td>
- <td><p>The check_constraints is the list of check constraints in a table. </p></td>
+ <td><p>The schema name of the parent index. </p></td>
</tr>
<tr>
- <td>owner</td>
+ <td>parent_index_name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The index name of the parent index. </p></td>
</tr>
<tr>
- <td>sorting_keys</td>
- <td><a href="#string">string</a></td>
- <td>repeated</td>
- <td><p>The sorting_keys is a tuple of column names or arbitrary expressions. ClickHouse specific field.
-Reference: https://clickhouse.com/docs/en/engines/table-engines/mergetree-family/mergetree#order_by </p></td>
+ <td>granularity</td>
+ <td><a href="#int64">int64</a></td>
+ <td></td>
+ <td><p>The number of granules in the block. It&#39;s a ClickHouse specific field. </p></td>
</tr>
<tr>
- <td>triggers</td>
- <td><a href="#bytebase.store.TriggerMetadata">TriggerMetadata</a></td>
- <td>repeated</td>
- <td><p> </p></td>
+ <td>is_constraint</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>It&#39;s a PostgreSQL specific field.
+The unique constraint and unique index are not the same thing in PostgreSQL. </p></td>
</tr>
</tbody>
@@ -4944,8 +4955,8 @@ Reference: https://clickhouse.com/docs/en/engines/table-engines/mergetree-family
- <h3 id="bytebase.store.TablePartitionMetadata">TablePartitionMetadata</h3>
- <p>TablePartitionMetadata is the metadata for table partitions.</p>
+ <h3 id="bytebase.store.InstanceRoleMetadata">InstanceRoleMetadata</h3>
+ <p>InstanceRoleMetadata is the message for instance role.</p>
<table class="field-table">
@@ -4958,67 +4969,52 @@ Reference: https://clickhouse.com/docs/en/engines/table-engines/mergetree-family
<td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the name of a table partition. </p></td>
+ <td><p>The role name. It&#39;s unique within the instance. </p></td>
</tr>
<tr>
- <td>type</td>
- <td><a href="#bytebase.store.TablePartitionMetadata.Type">TablePartitionMetadata.Type</a></td>
+ <td>grant</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p>The type of a table partition. </p></td>
+ <td><p>The grant display string on the instance. It&#39;s generated by database
+engine. </p></td>
</tr>
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.store.LinkedDatabaseMetadata">LinkedDatabaseMetadata</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>expression</td>
+ <td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The expression is the expression of a table partition.
-For PostgreSQL, the expression is the text of {FOR VALUES
-partition_bound_spec}, see
-https://www.postgresql.org/docs/current/sql-createtable.html. For MySQL,
-the expression is the `expr` or `column_list` of the following syntax.
-PARTITION BY
- { [LINEAR] HASH(expr)
- | [LINEAR] KEY [ALGORITHM={1 | 2}] (column_list)
- | RANGE{(expr) | COLUMNS(column_list)}
- | LIST{(expr) | COLUMNS(column_list)} }. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>value</td>
+ <td>username</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The value is the value of a table partition.
-For MySQL, the value is for RANGE and LIST partition types,
-- For a RANGE partition, it contains the value set in the partition&#39;s
-VALUES LESS THAN clause, which can be either an integer or MAXVALUE.
-- For a LIST partition, this column contains the values defined in the
-partition&#39;s VALUES IN clause, which is a list of comma-separated integer
-values.
-- For others, it&#39;s an empty string. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>use_default</td>
+ <td>host</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The use_default is whether the users use the default partition, it stores
-the different value for different database engines. For MySQL, it&#39;s [INT]
-type, 0 means not use default partition, otherwise, it&#39;s equals to number
-in syntax [SUB]PARTITION {number}. </p></td>
- </tr>
-
- <tr>
- <td>subpartitions</td>
- <td><a href="#bytebase.store.TablePartitionMetadata">TablePartitionMetadata</a></td>
- <td>repeated</td>
- <td><p>The subpartitions is the list of subpartitions in a table partition. </p></td>
- </tr>
-
- <tr>
- <td>indexes</td>
- <td><a href="#bytebase.store.IndexMetadata">IndexMetadata</a></td>
- <td>repeated</td>
<td><p> </p></td>
</tr>
@@ -5029,8 +5025,8 @@ in syntax [SUB]PARTITION {number}. </p></td>
- <h3 id="bytebase.store.TaskMetadata">TaskMetadata</h3>
- <p></p>
+ <h3 id="bytebase.store.MaterializedViewMetadata">MaterializedViewMetadata</h3>
+ <p>MaterializedViewMetadata is the metadata for materialized views.</p>
<table class="field-table">
@@ -5043,71 +5039,87 @@ in syntax [SUB]PARTITION {number}. </p></td>
<td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the name of a task. </p></td>
+ <td><p>The name is the name of a view. </p></td>
</tr>
<tr>
- <td>id</td>
+ <td>definition</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The id is the snowflake-generated id of a task.
-Example: 01ad32a0-1bb6-5e93-0000-000000000001 </p></td>
+ <td><p>The definition is the definition of a view. </p></td>
</tr>
<tr>
- <td>owner</td>
+ <td>comment</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The owner of the task. </p></td>
+ <td><p>The comment is the comment of a view. </p></td>
</tr>
<tr>
- <td>comment</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The comment of the task. </p></td>
+ <td>dependency_columns</td>
+ <td><a href="#bytebase.store.DependencyColumn">DependencyColumn</a></td>
+ <td>repeated</td>
+ <td><p>The dependency_columns is the list of dependency columns of a view. </p></td>
</tr>
<tr>
- <td>warehouse</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The warehouse of the task. </p></td>
+ <td>triggers</td>
+ <td><a href="#bytebase.store.TriggerMetadata">TriggerMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The columns is the ordered list of columns in a table. </p></td>
</tr>
<tr>
- <td>schedule</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The schedule interval of the task. </p></td>
+ <td>indexes</td>
+ <td><a href="#bytebase.store.IndexMetadata">IndexMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The indexes is the list of indexes in a table. </p></td>
</tr>
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.store.ObjectSchema">ObjectSchema</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>predecessors</td>
- <td><a href="#string">string</a></td>
- <td>repeated</td>
- <td><p>The predecessor tasks of the task. </p></td>
+ <td>type</td>
+ <td><a href="#bytebase.store.ObjectSchema.Type">ObjectSchema.Type</a></td>
+ <td></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>state</td>
- <td><a href="#bytebase.store.TaskMetadata.State">TaskMetadata.State</a></td>
+ <td>struct_kind</td>
+ <td><a href="#bytebase.store.ObjectSchema.StructKind">ObjectSchema.StructKind</a></td>
<td></td>
- <td><p>The state of the task. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>condition</td>
- <td><a href="#string">string</a></td>
+ <td>array_kind</td>
+ <td><a href="#bytebase.store.ObjectSchema.ArrayKind">ObjectSchema.ArrayKind</a></td>
<td></td>
- <td><p>The condition of the task. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>definition</td>
+ <td>semantic_type</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The definition of the task. </p></td>
+ <td><p> </p></td>
</tr>
</tbody>
@@ -5117,7 +5129,7 @@ Example: 01ad32a0-1bb6-5e93-0000-000000000001 </p></td>
- <h3 id="bytebase.store.TriggerMetadata">TriggerMetadata</h3>
+ <h3 id="bytebase.store.ObjectSchema.ArrayKind">ObjectSchema.ArrayKind</h3>
<p></p>
@@ -5128,60 +5140,96 @@ Example: 01ad32a0-1bb6-5e93-0000-000000000001 </p></td>
<tbody>
<tr>
- <td>name</td>
- <td><a href="#string">string</a></td>
+ <td>kind</td>
+ <td><a href="#bytebase.store.ObjectSchema">ObjectSchema</a></td>
<td></td>
- <td><p>The name is the name of the trigger. </p></td>
+ <td><p> </p></td>
</tr>
- <tr>
- <td>event</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The event is the event of the trigger, such as INSERT, UPDATE, DELETE,
-TRUNCATE. </p></td>
- </tr>
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.store.ObjectSchema.StructKind">ObjectSchema.StructKind</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>timing</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The timing is the timing of the trigger, such as BEFORE, AFTER. </p></td>
+ <td>properties</td>
+ <td><a href="#bytebase.store.ObjectSchema.StructKind.PropertiesEntry">ObjectSchema.StructKind.PropertiesEntry</a></td>
+ <td>repeated</td>
+ <td><p> </p></td>
</tr>
- <tr>
- <td>body</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The body is the body of the trigger. </p></td>
- </tr>
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.store.ObjectSchema.StructKind.PropertiesEntry">ObjectSchema.StructKind.PropertiesEntry</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>sql_mode</td>
+ <td>key</td>
<td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>character_set_client</td>
- <td><a href="#string">string</a></td>
+ <td>value</td>
+ <td><a href="#bytebase.store.ObjectSchema">ObjectSchema</a></td>
<td></td>
<td><p> </p></td>
</tr>
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.store.PackageMetadata">PackageMetadata</h3>
+ <p>PackageMetadata is the metadata for packages.</p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
<tr>
- <td>collation_connection</td>
+ <td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The name is the name of a package. </p></td>
</tr>
<tr>
- <td>comment</td>
+ <td>definition</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The definition is the definition of a package. </p></td>
</tr>
</tbody>
@@ -5191,7 +5239,7 @@ TRUNCATE. </p></td>
- <h3 id="bytebase.store.ViewConfig">ViewConfig</h3>
+ <h3 id="bytebase.store.ProcedureConfig">ProcedureConfig</h3>
<p></p>
@@ -5205,14 +5253,14 @@ TRUNCATE. </p></td>
<td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the name of a view. </p></td>
+ <td><p>The name is the name of a procedure. </p></td>
</tr>
<tr>
<td>updater</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The last updater of the view in branch.
+ <td><p>The last updater of the procedure in branch.
Format: users/{userUID}. </p></td>
</tr>
@@ -5228,7 +5276,7 @@ Format: projcets/{project}/branches/{branch} </p></td>
<td>update_time</td>
<td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
<td></td>
- <td><p>The timestamp when the view is updated in branch. </p></td>
+ <td><p>The timestamp when the procedure is updated in branch. </p></td>
</tr>
</tbody>
@@ -5238,9 +5286,9 @@ Format: projcets/{project}/branches/{branch} </p></td>
- <h3 id="bytebase.store.ViewMetadata">ViewMetadata</h3>
- <p>ViewMetadata is the metadata for views.</p>
-
+ <h3 id="bytebase.store.ProcedureMetadata">ProcedureMetadata</h3>
+ <p>ProcedureMetadata is the metadata for procedures.</p>
+
<table class="field-table">
<thead>
@@ -5252,394 +5300,49 @@ Format: projcets/{project}/branches/{branch} </p></td>
<td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name is the name of a view. </p></td>
+ <td><p>The name is the name of a procedure. </p></td>
</tr>
<tr>
<td>definition</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The definition is the definition of a view. </p></td>
- </tr>
-
- <tr>
- <td>comment</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The comment is the comment of a view. </p></td>
- </tr>
-
- <tr>
- <td>dependency_columns</td>
- <td><a href="#bytebase.store.DependencyColumn">DependencyColumn</a></td>
- <td>repeated</td>
- <td><p>The dependency_columns is the list of dependency columns of a view. </p></td>
- </tr>
-
- <tr>
- <td>columns</td>
- <td><a href="#bytebase.store.ColumnMetadata">ColumnMetadata</a></td>
- <td>repeated</td>
- <td><p>The columns is the ordered list of columns in a table. </p></td>
- </tr>
-
- <tr>
- <td>triggers</td>
- <td><a href="#bytebase.store.TriggerMetadata">TriggerMetadata</a></td>
- <td>repeated</td>
- <td><p>The triggers is the list of triggers in a view. </p></td>
+ <td><p>The definition is the definition of a procedure. </p></td>
</tr>
- </tbody>
- </table>
-
-
-
-
-
-
-
- <h3 id="bytebase.store.GenerationMetadata.Type">GenerationMetadata.Type</h3>
- <p></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>TYPE_VIRTUAL</td>
- <td>1</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>TYPE_STORED</td>
- <td>2</td>
- <td><p></p></td>
- </tr>
-
- </tbody>
- </table>
-
- <h3 id="bytebase.store.ObjectSchema.Type">ObjectSchema.Type</h3>
- <p></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>STRING</td>
- <td>1</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>NUMBER</td>
- <td>2</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>BOOLEAN</td>
- <td>3</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>OBJECT</td>
- <td>4</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>ARRAY</td>
- <td>5</td>
- <td><p></p></td>
- </tr>
-
- </tbody>
- </table>
-
- <h3 id="bytebase.store.StreamMetadata.Mode">StreamMetadata.Mode</h3>
- <p></p>
- <table class="enum-table">
- <thead>
- <tr><td>Name</td><td>Number</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>MODE_UNSPECIFIED</td>
- <td>0</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>MODE_DEFAULT</td>
- <td>1</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>MODE_APPEND_ONLY</td>
- <td>2</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>MODE_INSERT_ONLY</td>
- <td>3</td>
- <td><p></p></td>
- </tr>
-
- </tbody>
- </table>
-
- <h3 id="bytebase.store.StreamMetadata.Type">StreamMetadata.Type</h3>
- <p></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>TYPE_DELTA</td>
- <td>1</td>
- <td><p></p></td>
- </tr>
-
- </tbody>
- </table>
-
- <h3 id="bytebase.store.TablePartitionMetadata.Type">TablePartitionMetadata.Type</h3>
- <p>Type is the type of a table partition, some database engines may not</p><p>support all types. Only avilable for the following database engines now:</p><p>MySQL: RANGE, RANGE COLUMNS, LIST, LIST COLUMNS, HASH, LINEAR HASH, KEY,</p><p>LINEAR_KEY</p><p>(https://dev.mysql.com/doc/refman/8.0/en/partitioning-types.html) TiDB:</p><p>RANGE, RANGE COLUMNS, LIST, LIST COLUMNS, HASH, KEY PostgreSQL: RANGE,</p><p>LIST, HASH (https://www.postgresql.org/docs/current/ddl-partitioning.html)</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>RANGE</td>
- <td>1</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>RANGE_COLUMNS</td>
- <td>2</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>LIST</td>
- <td>3</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>LIST_COLUMNS</td>
- <td>4</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>HASH</td>
- <td>5</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>LINEAR_HASH</td>
- <td>6</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>KEY</td>
- <td>7</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>LINEAR_KEY</td>
- <td>8</td>
- <td><p></p></td>
- </tr>
-
- </tbody>
- </table>
-
- <h3 id="bytebase.store.TaskMetadata.State">TaskMetadata.State</h3>
- <p></p>
- <table class="enum-table">
- <thead>
- <tr><td>Name</td><td>Number</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>STATE_UNSPECIFIED</td>
- <td>0</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>STATE_STARTED</td>
- <td>1</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>STATE_SUSPENDED</td>
- <td>2</td>
- <td><p></p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
-
-
- <div class="file-heading">
- <h2 id="store/branch.proto">store/branch.proto</h2><a href="#title">Top</a>
- </div>
- <p></p>
-
-
- <h3 id="bytebase.store.BranchConfig">BranchConfig</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>source_database</td>
+ <td>signature</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name of source database.
-Optional.
-Example: instances/instance-id/databases/database-name. </p></td>
+ <td><p>The signature is the name with the number and type of input arguments the
+function takes. </p></td>
</tr>
<tr>
- <td>source_branch</td>
+ <td>character_set_client</td>
<td><a href="#string">string</a></td>
- <td></td>
- <td><p>The name of the source branch.
-Optional.
-Example: projects/project-id/branches/branch-id. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.store.BranchSnapshot">BranchSnapshot</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>metadata</td>
- <td><a href="#bytebase.store.DatabaseSchemaMetadata">DatabaseSchemaMetadata</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>database_config</td>
- <td><a href="#bytebase.store.DatabaseConfig">DatabaseConfig</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
-
-
-
-
-
-
-
-
- <div class="file-heading">
- <h2 id="store/changelist.proto">store/changelist.proto</h2><a href="#title">Top</a>
- </div>
- <p></p>
-
-
- <h3 id="bytebase.store.Changelist">Changelist</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
+ <td></td>
+ <td><p>MySQL specific metadata. </p></td>
+ </tr>
<tr>
- <td>description</td>
+ <td>collation_connection</td>
<td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>changes</td>
- <td><a href="#bytebase.store.Changelist.Change">Changelist.Change</a></td>
- <td>repeated</td>
+ <td>database_collation</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
+ <tr>
+ <td>sql_mode</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
<td><p> </p></td>
</tr>
@@ -5650,7 +5353,7 @@ Example: projects/project-id/branches/branch-id. </p></td>
- <h3 id="bytebase.store.Changelist.Change">Changelist.Change</h3>
+ <h3 id="bytebase.store.SchemaCatalog">SchemaCatalog</h3>
<p></p>
@@ -5661,26 +5364,39 @@ Example: projects/project-id/branches/branch-id. </p></td>
<tbody>
<tr>
- <td>sheet</td>
+ <td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name of a sheet. </p></td>
+ <td><p>The name is the schema name.
+It is an empty string for databases without such concept such as MySQL. </p></td>
</tr>
<tr>
- <td>source</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The source of origin.
-1) changes: instances/{instance}/databases/{database}/changelogs/{changelog}.
-2) raw SQL if empty. </p></td>
+ <td>tables</td>
+ <td><a href="#bytebase.store.TableCatalog">TableCatalog</a></td>
+ <td>repeated</td>
+ <td><p>The table_configs is the list of configs for tables in a schema. </p></td>
</tr>
<tr>
- <td>version</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The migration version for a change. </p></td>
+ <td>function_configs</td>
+ <td><a href="#bytebase.store.FunctionConfig">FunctionConfig</a></td>
+ <td>repeated</td>
+ <td><p> </p></td>
+ </tr>
+
+ <tr>
+ <td>procedure_configs</td>
+ <td><a href="#bytebase.store.ProcedureConfig">ProcedureConfig</a></td>
+ <td>repeated</td>
+ <td><p> </p></td>
+ </tr>
+
+ <tr>
+ <td>view_configs</td>
+ <td><a href="#bytebase.store.ViewConfig">ViewConfig</a></td>
+ <td>repeated</td>
+ <td><p> </p></td>
</tr>
</tbody>
@@ -5690,22 +5406,8 @@ Example: projects/project-id/branches/branch-id. </p></td>
-
-
-
-
-
-
-
-
- <div class="file-heading">
- <h2 id="store/changelog.proto">store/changelog.proto</h2><a href="#title">Top</a>
- </div>
- <p></p>
-
-
- <h3 id="bytebase.store.ChangedResourceDatabase">ChangedResourceDatabase</h3>
- <p></p>
+ <h3 id="bytebase.store.SchemaMetadata">SchemaMetadata</h3>
+ <p>SchemaMetadata is the metadata for schemas.</p><p>This is the concept of schema in Postgres, but it's a no-op for MySQL.</p>
<table class="field-table">
@@ -5718,12 +5420,99 @@ Example: projects/project-id/branches/branch-id. </p></td>
<td>name</td>
<td><a href="#string">string</a></td>
<td></td>
+ <td><p>The name is the schema name.
+It is an empty string for databases without such concept such as MySQL. </p></td>
+ </tr>
+
+ <tr>
+ <td>tables</td>
+ <td><a href="#bytebase.store.TableMetadata">TableMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The tables is the list of tables in a schema. </p></td>
+ </tr>
+
+ <tr>
+ <td>external_tables</td>
+ <td><a href="#bytebase.store.ExternalTableMetadata">ExternalTableMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The external_tables is the list of external tables in a schema. </p></td>
+ </tr>
+
+ <tr>
+ <td>views</td>
+ <td><a href="#bytebase.store.ViewMetadata">ViewMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The views is the list of views in a schema. </p></td>
+ </tr>
+
+ <tr>
+ <td>functions</td>
+ <td><a href="#bytebase.store.FunctionMetadata">FunctionMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The functions is the list of functions in a schema. </p></td>
+ </tr>
+
+ <tr>
+ <td>procedures</td>
+ <td><a href="#bytebase.store.ProcedureMetadata">ProcedureMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The procedures is the list of procedures in a schema. </p></td>
+ </tr>
+
+ <tr>
+ <td>streams</td>
+ <td><a href="#bytebase.store.StreamMetadata">StreamMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The streams is the list of streams in a schema, currently, only used for
+Snowflake. </p></td>
+ </tr>
+
+ <tr>
+ <td>tasks</td>
+ <td><a href="#bytebase.store.TaskMetadata">TaskMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The routines is the list of routines in a schema, currently, only used for
+Snowflake. </p></td>
+ </tr>
+
+ <tr>
+ <td>materialized_views</td>
+ <td><a href="#bytebase.store.MaterializedViewMetadata">MaterializedViewMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The materialized_views is the list of materialized views in a schema. </p></td>
+ </tr>
+
+ <tr>
+ <td>sequences</td>
+ <td><a href="#bytebase.store.SequenceMetadata">SequenceMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The sequences is the list of sequences in a schema. </p></td>
+ </tr>
+
+ <tr>
+ <td>packages</td>
+ <td><a href="#bytebase.store.PackageMetadata">PackageMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The packages is the list of packages in a schema. </p></td>
+ </tr>
+
+ <tr>
+ <td>owner</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>schemas</td>
- <td><a href="#bytebase.store.ChangedResourceSchema">ChangedResourceSchema</a></td>
+ <td>events</td>
+ <td><a href="#bytebase.store.EventMetadata">EventMetadata</a></td>
+ <td>repeated</td>
+ <td><p> </p></td>
+ </tr>
+
+ <tr>
+ <td>enum_types</td>
+ <td><a href="#bytebase.store.EnumTypeMetadata">EnumTypeMetadata</a></td>
<td>repeated</td>
<td><p> </p></td>
</tr>
@@ -5735,7 +5524,7 @@ Example: projects/project-id/branches/branch-id. </p></td>
- <h3 id="bytebase.store.ChangedResourceFunction">ChangedResourceFunction</h3>
+ <h3 id="bytebase.store.SecretItem">SecretItem</h3>
<p></p>
@@ -5749,14 +5538,21 @@ Example: projects/project-id/branches/branch-id. </p></td>
<td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The name is the name of the secret. </p></td>
</tr>
<tr>
- <td>ranges</td>
- <td><a href="#bytebase.store.Range">Range</a></td>
- <td>repeated</td>
- <td><p>The ranges of sub-strings correspond to the statements on the sheet. </p></td>
+ <td>value</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The value is the value of the secret. </p></td>
+ </tr>
+
+ <tr>
+ <td>description</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The description is the description of the secret. </p></td>
</tr>
</tbody>
@@ -5766,7 +5562,7 @@ Example: projects/project-id/branches/branch-id. </p></td>
- <h3 id="bytebase.store.ChangedResourceProcedure">ChangedResourceProcedure</h3>
+ <h3 id="bytebase.store.Secrets">Secrets</h3>
<p></p>
@@ -5777,17 +5573,10 @@ Example: projects/project-id/branches/branch-id. </p></td>
<tbody>
<tr>
- <td>name</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>ranges</td>
- <td><a href="#bytebase.store.Range">Range</a></td>
+ <td>items</td>
+ <td><a href="#bytebase.store.SecretItem">SecretItem</a></td>
<td>repeated</td>
- <td><p>The ranges of sub-strings correspond to the statements on the sheet. </p></td>
+ <td><p>The list of secrets. </p></td>
</tr>
</tbody>
@@ -5797,7 +5586,7 @@ Example: projects/project-id/branches/branch-id. </p></td>
- <h3 id="bytebase.store.ChangedResourceSchema">ChangedResourceSchema</h3>
+ <h3 id="bytebase.store.SequenceMetadata">SequenceMetadata</h3>
<p></p>
@@ -5811,34 +5600,83 @@ Example: projects/project-id/branches/branch-id. </p></td>
<td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The name of a sequence. </p></td>
</tr>
<tr>
- <td>tables</td>
- <td><a href="#bytebase.store.ChangedResourceTable">ChangedResourceTable</a></td>
- <td>repeated</td>
- <td><p> </p></td>
+ <td>data_type</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The data type of a sequence. </p></td>
+ </tr>
+
+ <tr>
+ <td>start</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The start value of a sequence. </p></td>
+ </tr>
+
+ <tr>
+ <td>min_value</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The minimum value of a sequence. </p></td>
+ </tr>
+
+ <tr>
+ <td>max_value</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The maximum value of a sequence. </p></td>
+ </tr>
+
+ <tr>
+ <td>increment</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>Increment value of a sequence. </p></td>
+ </tr>
+
+ <tr>
+ <td>cycle</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>Cycle is whether the sequence cycles. </p></td>
+ </tr>
+
+ <tr>
+ <td>cache_size</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>Cache size of a sequence. </p></td>
+ </tr>
+
+ <tr>
+ <td>last_value</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>Last value of a sequence. </p></td>
</tr>
<tr>
- <td>views</td>
- <td><a href="#bytebase.store.ChangedResourceView">ChangedResourceView</a></td>
- <td>repeated</td>
- <td><p> </p></td>
+ <td>owner_table</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The owner table of the sequence. </p></td>
</tr>
<tr>
- <td>functions</td>
- <td><a href="#bytebase.store.ChangedResourceFunction">ChangedResourceFunction</a></td>
- <td>repeated</td>
- <td><p> </p></td>
+ <td>owner_column</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The owner column of the sequence. </p></td>
</tr>
<tr>
- <td>procedures</td>
- <td><a href="#bytebase.store.ChangedResourceProcedure">ChangedResourceProcedure</a></td>
- <td>repeated</td>
+ <td>comment</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
<td><p> </p></td>
</tr>
@@ -5849,7 +5687,7 @@ Example: projects/project-id/branches/branch-id. </p></td>
- <h3 id="bytebase.store.ChangedResourceTable">ChangedResourceTable</h3>
+ <h3 id="bytebase.store.StreamMetadata">StreamMetadata</h3>
<p></p>
@@ -5863,76 +5701,56 @@ Example: projects/project-id/branches/branch-id. </p></td>
<td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The name is the name of a stream. </p></td>
</tr>
<tr>
- <td>table_rows</td>
- <td><a href="#int64">int64</a></td>
+ <td>table_name</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p>estimated row count of the table </p></td>
+ <td><p>The table_name is the name of the table/view that the stream is created on. </p></td>
</tr>
<tr>
- <td>ranges</td>
- <td><a href="#bytebase.store.Range">Range</a></td>
- <td>repeated</td>
- <td><p>The ranges of sub-strings correspond to the statements on the sheet. </p></td>
+ <td>owner</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The owner of the stream. </p></td>
</tr>
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.store.ChangedResourceView">ChangedResourceView</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>name</td>
+ <td>comment</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The comment of the stream. </p></td>
</tr>
<tr>
- <td>ranges</td>
- <td><a href="#bytebase.store.Range">Range</a></td>
- <td>repeated</td>
- <td><p>The ranges of sub-strings correspond to the statements on the sheet. </p></td>
+ <td>type</td>
+ <td><a href="#bytebase.store.StreamMetadata.Type">StreamMetadata.Type</a></td>
+ <td></td>
+ <td><p>The type of the stream. </p></td>
</tr>
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.store.ChangedResources">ChangedResources</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>stale</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>Indicates whether the stream was last read before the `stale_after` time. </p></td>
+ </tr>
<tr>
- <td>databases</td>
- <td><a href="#bytebase.store.ChangedResourceDatabase">ChangedResourceDatabase</a></td>
- <td>repeated</td>
- <td><p> </p></td>
+ <td>mode</td>
+ <td><a href="#bytebase.store.StreamMetadata.Mode">StreamMetadata.Mode</a></td>
+ <td></td>
+ <td><p>The mode of the stream. </p></td>
+ </tr>
+
+ <tr>
+ <td>definition</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The definition of the stream. </p></td>
</tr>
</tbody>
@@ -5942,7 +5760,7 @@ Example: projects/project-id/branches/branch-id. </p></td>
- <h3 id="bytebase.store.ChangelogPayload">ChangelogPayload</h3>
+ <h3 id="bytebase.store.TableCatalog">TableCatalog</h3>
<p></p>
@@ -5953,54 +5771,54 @@ Example: projects/project-id/branches/branch-id. </p></td>
<tbody>
<tr>
- <td>task_run</td>
+ <td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>Format: projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskruns/{taskrun} </p></td>
+ <td><p>The name is the name of a table. </p></td>
</tr>
<tr>
- <td>issue</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>Format: projects/{project}/issues/{issue} </p></td>
+ <td>columns</td>
+ <td><a href="#bytebase.store.ColumnCatalog">ColumnCatalog</a></td>
+ <td>repeated</td>
+ <td><p>The column_configs is the ordered list of configs for columns in a table. </p></td>
</tr>
<tr>
- <td>revision</td>
- <td><a href="#int64">int64</a></td>
- <td></td>
- <td><p>The revision uid.
-optional </p></td>
+ <td>object_schema</td>
+ <td><a href="#bytebase.store.ObjectSchema">ObjectSchema</a></td>
+ <td>optional</td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>changed_resources</td>
- <td><a href="#bytebase.store.ChangedResources">ChangedResources</a></td>
+ <td>classification</td>
+ <td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>sheet</td>
+ <td>updater</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The sheet that holds the content.
-Format: projects/{project}/sheets/{sheet} </p></td>
+ <td><p>The last updater of the table in branch.
+Format: users/{userUID}. </p></td>
</tr>
<tr>
- <td>version</td>
+ <td>source_branch</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The last change come from branch.
+Format: projcets/{project}/branches/{branch} </p></td>
</tr>
<tr>
- <td>type</td>
- <td><a href="#bytebase.store.ChangelogPayload.Type">ChangelogPayload.Type</a></td>
+ <td>update_time</td>
+ <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The timestamp when the table is updated in branch. </p></td>
</tr>
</tbody>
@@ -6010,69 +5828,8 @@ Format: projects/{project}/sheets/{sheet} </p></td>
-
-
- <h3 id="bytebase.store.ChangelogPayload.Type">ChangelogPayload.Type</h3>
- <p></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>BASELINE</td>
- <td>1</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>MIGRATE</td>
- <td>2</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>MIGRATE_SDL</td>
- <td>3</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>MIGRATE_GHOST</td>
- <td>4</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>DATA</td>
- <td>6</td>
- <td><p></p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
-
-
- <div class="file-heading">
- <h2 id="store/data_source.proto">store/data_source.proto</h2><a href="#title">Top</a>
- </div>
- <p></p>
-
-
- <h3 id="bytebase.store.DataSourceExternalSecret">DataSourceExternalSecret</h3>
- <p></p>
+ <h3 id="bytebase.store.TableMetadata">TableMetadata</h3>
+ <p>TableMetadata is the metadata for tables.</p>
<table class="field-table">
@@ -6082,59 +5839,138 @@ Format: projects/{project}/sheets/{sheet} </p></td>
<tbody>
<tr>
- <td>secret_type</td>
- <td><a href="#bytebase.store.DataSourceExternalSecret.SecretType">DataSourceExternalSecret.SecretType</a></td>
+ <td>name</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The name is the name of a table. </p></td>
+ </tr>
+
+ <tr>
+ <td>columns</td>
+ <td><a href="#bytebase.store.ColumnMetadata">ColumnMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The columns is the ordered list of columns in a table. </p></td>
+ </tr>
+
+ <tr>
+ <td>indexes</td>
+ <td><a href="#bytebase.store.IndexMetadata">IndexMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The indexes is the list of indexes in a table. </p></td>
+ </tr>
+
+ <tr>
+ <td>engine</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The engine is the engine of a table. </p></td>
+ </tr>
+
+ <tr>
+ <td>collation</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The collation is the collation of a table. </p></td>
+ </tr>
+
+ <tr>
+ <td>charset</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The character set of table. </p></td>
+ </tr>
+
+ <tr>
+ <td>row_count</td>
+ <td><a href="#int64">int64</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The row_count is the estimated number of rows of a table. </p></td>
</tr>
<tr>
- <td>url</td>
- <td><a href="#string">string</a></td>
+ <td>data_size</td>
+ <td><a href="#int64">int64</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The data_size is the estimated data size of a table. </p></td>
</tr>
<tr>
- <td>auth_type</td>
- <td><a href="#bytebase.store.DataSourceExternalSecret.AuthType">DataSourceExternalSecret.AuthType</a></td>
+ <td>index_size</td>
+ <td><a href="#int64">int64</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The index_size is the estimated index size of a table. </p></td>
</tr>
<tr>
- <td>app_role</td>
- <td><a href="#bytebase.store.DataSourceExternalSecret.AppRoleAuthOption">DataSourceExternalSecret.AppRoleAuthOption</a></td>
+ <td>data_free</td>
+ <td><a href="#int64">int64</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The data_free is the estimated free data size of a table. </p></td>
</tr>
<tr>
- <td>token</td>
+ <td>create_options</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The create_options is the create option of a table. </p></td>
</tr>
<tr>
- <td>engine_name</td>
+ <td>comment</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>engine name is the name for secret engine. </p></td>
+ <td><p>The comment is the comment of a table.
+classification and user_comment is parsed from the comment. </p></td>
</tr>
<tr>
- <td>secret_name</td>
+ <td>user_comment</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>the secret name in the engine to store the password. </p></td>
+ <td><p>The user_comment is the user comment of a table parsed from the comment. </p></td>
</tr>
<tr>
- <td>password_key_name</td>
+ <td>foreign_keys</td>
+ <td><a href="#bytebase.store.ForeignKeyMetadata">ForeignKeyMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The foreign_keys is the list of foreign keys in a table. </p></td>
+ </tr>
+
+ <tr>
+ <td>partitions</td>
+ <td><a href="#bytebase.store.TablePartitionMetadata">TablePartitionMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The partitions is the list of partitions in a table. </p></td>
+ </tr>
+
+ <tr>
+ <td>check_constraints</td>
+ <td><a href="#bytebase.store.CheckConstraintMetadata">CheckConstraintMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The check_constraints is the list of check constraints in a table. </p></td>
+ </tr>
+
+ <tr>
+ <td>owner</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>the key name for the password. </p></td>
+ <td><p> </p></td>
+ </tr>
+
+ <tr>
+ <td>sorting_keys</td>
+ <td><a href="#string">string</a></td>
+ <td>repeated</td>
+ <td><p>The sorting_keys is a tuple of column names or arbitrary expressions. ClickHouse specific field.
+Reference: https://clickhouse.com/docs/en/engines/table-engines/mergetree-family/mergetree#order_by </p></td>
+ </tr>
+
+ <tr>
+ <td>triggers</td>
+ <td><a href="#bytebase.store.TriggerMetadata">TriggerMetadata</a></td>
+ <td>repeated</td>
+ <td><p> </p></td>
</tr>
</tbody>
@@ -6144,8 +5980,8 @@ Format: projects/{project}/sheets/{sheet} </p></td>
- <h3 id="bytebase.store.DataSourceExternalSecret.AppRoleAuthOption">DataSourceExternalSecret.AppRoleAuthOption</h3>
- <p></p>
+ <h3 id="bytebase.store.TablePartitionMetadata">TablePartitionMetadata</h3>
+ <p>TablePartitionMetadata is the metadata for table partitions.</p>
<table class="field-table">
@@ -6155,31 +5991,71 @@ Format: projects/{project}/sheets/{sheet} </p></td>
<tbody>
<tr>
- <td>role_id</td>
+ <td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The name is the name of a table partition. </p></td>
</tr>
<tr>
- <td>secret_id</td>
+ <td>type</td>
+ <td><a href="#bytebase.store.TablePartitionMetadata.Type">TablePartitionMetadata.Type</a></td>
+ <td></td>
+ <td><p>The type of a table partition. </p></td>
+ </tr>
+
+ <tr>
+ <td>expression</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>the secret id for the role without ttl. </p></td>
+ <td><p>The expression is the expression of a table partition.
+For PostgreSQL, the expression is the text of {FOR VALUES
+partition_bound_spec}, see
+https://www.postgresql.org/docs/current/sql-createtable.html. For MySQL,
+the expression is the `expr` or `column_list` of the following syntax.
+PARTITION BY
+ { [LINEAR] HASH(expr)
+ | [LINEAR] KEY [ALGORITHM={1 | 2}] (column_list)
+ | RANGE{(expr) | COLUMNS(column_list)}
+ | LIST{(expr) | COLUMNS(column_list)} }. </p></td>
</tr>
<tr>
- <td>type</td>
- <td><a href="#bytebase.store.DataSourceExternalSecret.AppRoleAuthOption.SecretType">DataSourceExternalSecret.AppRoleAuthOption.SecretType</a></td>
+ <td>value</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The value is the value of a table partition.
+For MySQL, the value is for RANGE and LIST partition types,
+- For a RANGE partition, it contains the value set in the partition&#39;s
+VALUES LESS THAN clause, which can be either an integer or MAXVALUE.
+- For a LIST partition, this column contains the values defined in the
+partition&#39;s VALUES IN clause, which is a list of comma-separated integer
+values.
+- For others, it&#39;s an empty string. </p></td>
</tr>
<tr>
- <td>mount_path</td>
+ <td>use_default</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The path where the approle auth method is mounted. </p></td>
+ <td><p>The use_default is whether the users use the default partition, it stores
+the different value for different database engines. For MySQL, it&#39;s [INT]
+type, 0 means not use default partition, otherwise, it&#39;s equals to number
+in syntax [SUB]PARTITION {number}. </p></td>
+ </tr>
+
+ <tr>
+ <td>subpartitions</td>
+ <td><a href="#bytebase.store.TablePartitionMetadata">TablePartitionMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The subpartitions is the list of subpartitions in a table partition. </p></td>
+ </tr>
+
+ <tr>
+ <td>indexes</td>
+ <td><a href="#bytebase.store.IndexMetadata">IndexMetadata</a></td>
+ <td>repeated</td>
+ <td><p> </p></td>
</tr>
</tbody>
@@ -6189,7 +6065,7 @@ Format: projects/{project}/sheets/{sheet} </p></td>
- <h3 id="bytebase.store.DataSourceOptions">DataSourceOptions</h3>
+ <h3 id="bytebase.store.TaskMetadata">TaskMetadata</h3>
<p></p>
@@ -6200,173 +6076,148 @@ Format: projects/{project}/sheets/{sheet} </p></td>
<tbody>
<tr>
- <td>srv</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>srv is a boolean flag that indicates whether the host is a DNS SRV record. </p></td>
- </tr>
-
- <tr>
- <td>authentication_database</td>
+ <td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>authentication_database is the database name to authenticate against, which stores the user credentials. </p></td>
+ <td><p>The name is the name of a task. </p></td>
</tr>
<tr>
- <td>sid</td>
+ <td>id</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>sid and service_name are used for Oracle. </p></td>
+ <td><p>The id is the snowflake-generated id of a task.
+Example: 01ad32a0-1bb6-5e93-0000-000000000001 </p></td>
</tr>
<tr>
- <td>service_name</td>
+ <td>owner</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The owner of the task. </p></td>
</tr>
<tr>
- <td>ssh_host</td>
+ <td>comment</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>SSH related
-The hostname of the SSH server agent. </p></td>
+ <td><p>The comment of the task. </p></td>
</tr>
<tr>
- <td>ssh_port</td>
+ <td>warehouse</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The port of the SSH server agent. It&#39;s 22 typically. </p></td>
+ <td><p>The warehouse of the task. </p></td>
</tr>
<tr>
- <td>ssh_user</td>
+ <td>schedule</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The user to login the server. </p></td>
+ <td><p>The schedule interval of the task. </p></td>
</tr>
<tr>
- <td>ssh_obfuscated_password</td>
+ <td>predecessors</td>
<td><a href="#string">string</a></td>
- <td></td>
- <td><p>The password to login the server. If it&#39;s empty string, no password is required. </p></td>
+ <td>repeated</td>
+ <td><p>The predecessor tasks of the task. </p></td>
</tr>
<tr>
- <td>ssh_obfuscated_private_key</td>
- <td><a href="#string">string</a></td>
+ <td>state</td>
+ <td><a href="#bytebase.store.TaskMetadata.State">TaskMetadata.State</a></td>
<td></td>
- <td><p>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;). </p></td>
+ <td><p>The state of the task. </p></td>
</tr>
<tr>
- <td>authentication_private_key_obfuscated</td>
+ <td>condition</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>PKCS#8 private key in PEM format. If it&#39;s empty string, no private key is required.
-Used for authentication when connecting to the data source. </p></td>
- </tr>
-
- <tr>
- <td>external_secret</td>
- <td><a href="#bytebase.store.DataSourceExternalSecret">DataSourceExternalSecret</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>authentication_type</td>
- <td><a href="#bytebase.store.DataSourceOptions.AuthenticationType">DataSourceOptions.AuthenticationType</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>sasl_config</td>
- <td><a href="#bytebase.store.SASLConfig">SASLConfig</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>additional_addresses</td>
- <td><a href="#bytebase.store.DataSourceOptions.Address">DataSourceOptions.Address</a></td>
- <td>repeated</td>
- <td><p>additional_addresses is used for MongoDB replica set. </p></td>
+ <td><p>The condition of the task. </p></td>
</tr>
<tr>
- <td>replica_set</td>
+ <td>definition</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>replica_set is used for MongoDB replica set. </p></td>
+ <td><p>The definition of the task. </p></td>
</tr>
- <tr>
- <td>direct_connection</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>direct_connection is used for MongoDB to dispatch all the operations to the node specified in the connection string. </p></td>
- </tr>
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.store.TriggerMetadata">TriggerMetadata</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>region</td>
+ <td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>region is the location of where the DB is, works for AWS RDS. For example, us-east-1. </p></td>
+ <td><p>The name is the name of the trigger. </p></td>
</tr>
<tr>
- <td>warehouse_id</td>
+ <td>event</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>warehouse_id is used by Databricks. </p></td>
+ <td><p>The event is the event of the trigger, such as INSERT, UPDATE, DELETE,
+TRUNCATE. </p></td>
</tr>
<tr>
- <td>master_name</td>
+ <td>timing</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>master_name is the master name used by connecting redis-master via redis sentinel. </p></td>
+ <td><p>The timing is the timing of the trigger, such as BEFORE, AFTER. </p></td>
</tr>
<tr>
- <td>master_username</td>
+ <td>body</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>master_username and master_obfuscated_password are master credentials used by redis sentinel mode. </p></td>
+ <td><p>The body is the body of the trigger. </p></td>
</tr>
<tr>
- <td>master_obfuscated_password</td>
+ <td>sql_mode</td>
<td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>redis_type</td>
- <td><a href="#bytebase.store.DataSourceOptions.RedisType">DataSourceOptions.RedisType</a></td>
+ <td>character_set_client</td>
+ <td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>use_ssl</td>
- <td><a href="#bool">bool</a></td>
+ <td>collation_connection</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p>Use SSL to connect to the data source. By default, we use system default SSL configuration. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>cluster</td>
+ <td>comment</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>Cluster is the cluster name for the data source. Used by CockroachDB. </p></td>
+ <td><p> </p></td>
</tr>
</tbody>
@@ -6376,7 +6227,7 @@ Used for authentication when connecting to the data source. </p></td>
- <h3 id="bytebase.store.DataSourceOptions.Address">DataSourceOptions.Address</h3>
+ <h3 id="bytebase.store.ViewConfig">ViewConfig</h3>
<p></p>
@@ -6387,17 +6238,33 @@ Used for authentication when connecting to the data source. </p></td>
<tbody>
<tr>
- <td>host</td>
+ <td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The name is the name of a view. </p></td>
</tr>
<tr>
- <td>port</td>
+ <td>updater</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The last updater of the view in branch.
+Format: users/{userUID}. </p></td>
+ </tr>
+
+ <tr>
+ <td>source_branch</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The last change come from branch.
+Format: projcets/{project}/branches/{branch} </p></td>
+ </tr>
+
+ <tr>
+ <td>update_time</td>
+ <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
+ <td></td>
+ <td><p>The timestamp when the view is updated in branch. </p></td>
</tr>
</tbody>
@@ -6407,8 +6274,8 @@ Used for authentication when connecting to the data source. </p></td>
- <h3 id="bytebase.store.KerberosConfig">KerberosConfig</h3>
- <p></p>
+ <h3 id="bytebase.store.ViewMetadata">ViewMetadata</h3>
+ <p>ViewMetadata is the metadata for views.</p>
<table class="field-table">
@@ -6418,76 +6285,45 @@ Used for authentication when connecting to the data source. </p></td>
<tbody>
<tr>
- <td>primary</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>instance</td>
+ <td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The name is the name of a view. </p></td>
</tr>
<tr>
- <td>realm</td>
+ <td>definition</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>keytab</td>
- <td><a href="#bytes">bytes</a></td>
- <td></td>
- <td><p> </p></td>
+ <td><p>The definition is the definition of a view. </p></td>
</tr>
<tr>
- <td>kdc_host</td>
+ <td>comment</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The comment is the comment of a view. </p></td>
</tr>
<tr>
- <td>kdc_port</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p> </p></td>
+ <td>dependency_columns</td>
+ <td><a href="#bytebase.store.DependencyColumn">DependencyColumn</a></td>
+ <td>repeated</td>
+ <td><p>The dependency_columns is the list of dependency columns of a view. </p></td>
</tr>
<tr>
- <td>kdc_transport_protocol</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p> </p></td>
+ <td>columns</td>
+ <td><a href="#bytebase.store.ColumnMetadata">ColumnMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The columns is the ordered list of columns in a table. </p></td>
</tr>
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.store.SASLConfig">SASLConfig</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>krb_config</td>
- <td><a href="#bytebase.store.KerberosConfig">KerberosConfig</a></td>
- <td></td>
- <td><p> </p></td>
+ <td>triggers</td>
+ <td><a href="#bytebase.store.TriggerMetadata">TriggerMetadata</a></td>
+ <td>repeated</td>
+ <td><p>The triggers is the list of triggers in a view. </p></td>
</tr>
</tbody>
@@ -6499,7 +6335,7 @@ Used for authentication when connecting to the data source. </p></td>
- <h3 id="bytebase.store.DataSourceExternalSecret.AppRoleAuthOption.SecretType">DataSourceExternalSecret.AppRoleAuthOption.SecretType</h3>
+ <h3 id="bytebase.store.GenerationMetadata.Type">GenerationMetadata.Type</h3>
<p></p>
<table class="enum-table">
<thead>
@@ -6508,19 +6344,19 @@ Used for authentication when connecting to the data source. </p></td>
<tbody>
<tr>
- <td>SECRET_TYPE_UNSPECIFIED</td>
+ <td>TYPE_UNSPECIFIED</td>
<td>0</td>
<td><p></p></td>
</tr>
<tr>
- <td>PLAIN</td>
+ <td>TYPE_VIRTUAL</td>
<td>1</td>
<td><p></p></td>
</tr>
<tr>
- <td>ENVIRONMENT</td>
+ <td>TYPE_STORED</td>
<td>2</td>
<td><p></p></td>
</tr>
@@ -6528,7 +6364,7 @@ Used for authentication when connecting to the data source. </p></td>
</tbody>
</table>
- <h3 id="bytebase.store.DataSourceExternalSecret.AuthType">DataSourceExternalSecret.AuthType</h3>
+ <h3 id="bytebase.store.ObjectSchema.Type">ObjectSchema.Type</h3>
<p></p>
<table class="enum-table">
<thead>
@@ -6537,27 +6373,45 @@ Used for authentication when connecting to the data source. </p></td>
<tbody>
<tr>
- <td>AUTH_TYPE_UNSPECIFIED</td>
+ <td>TYPE_UNSPECIFIED</td>
<td>0</td>
<td><p></p></td>
</tr>
<tr>
- <td>TOKEN</td>
+ <td>STRING</td>
<td>1</td>
- <td><p>ref: https://developer.hashicorp.com/vault/docs/auth/token</p></td>
+ <td><p></p></td>
</tr>
<tr>
- <td>VAULT_APP_ROLE</td>
+ <td>NUMBER</td>
<td>2</td>
- <td><p>ref: https://developer.hashicorp.com/vault/docs/auth/approle</p></td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>BOOLEAN</td>
+ <td>3</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>OBJECT</td>
+ <td>4</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>ARRAY</td>
+ <td>5</td>
+ <td><p></p></td>
</tr>
</tbody>
</table>
- <h3 id="bytebase.store.DataSourceExternalSecret.SecretType">DataSourceExternalSecret.SecretType</h3>
+ <h3 id="bytebase.store.StreamMetadata.Mode">StreamMetadata.Mode</h3>
<p></p>
<table class="enum-table">
<thead>
@@ -6566,33 +6420,33 @@ Used for authentication when connecting to the data source. </p></td>
<tbody>
<tr>
- <td>SAECRET_TYPE_UNSPECIFIED</td>
+ <td>MODE_UNSPECIFIED</td>
<td>0</td>
<td><p></p></td>
</tr>
<tr>
- <td>VAULT_KV_V2</td>
+ <td>MODE_DEFAULT</td>
<td>1</td>
- <td><p>ref: https://developer.hashicorp.com/vault/api-docs/secret/kv/kv-v2</p></td>
+ <td><p></p></td>
</tr>
<tr>
- <td>AWS_SECRETS_MANAGER</td>
+ <td>MODE_APPEND_ONLY</td>
<td>2</td>
- <td><p>ref: https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html</p></td>
+ <td><p></p></td>
</tr>
<tr>
- <td>GCP_SECRET_MANAGER</td>
+ <td>MODE_INSERT_ONLY</td>
<td>3</td>
- <td><p>ref: https://cloud.google.com/secret-manager/docs</p></td>
+ <td><p></p></td>
</tr>
</tbody>
</table>
- <h3 id="bytebase.store.DataSourceOptions.AuthenticationType">DataSourceOptions.AuthenticationType</h3>
+ <h3 id="bytebase.store.StreamMetadata.Type">StreamMetadata.Type</h3>
<p></p>
<table class="enum-table">
<thead>
@@ -6601,33 +6455,86 @@ Used for authentication when connecting to the data source. </p></td>
<tbody>
<tr>
- <td>AUTHENTICATION_UNSPECIFIED</td>
+ <td>TYPE_UNSPECIFIED</td>
<td>0</td>
<td><p></p></td>
</tr>
<tr>
- <td>PASSWORD</td>
+ <td>TYPE_DELTA</td>
+ <td>1</td>
+ <td><p></p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+ <h3 id="bytebase.store.TablePartitionMetadata.Type">TablePartitionMetadata.Type</h3>
+ <p>Type is the type of a table partition, some database engines may not</p><p>support all types. Only avilable for the following database engines now:</p><p>MySQL: RANGE, RANGE COLUMNS, LIST, LIST COLUMNS, HASH, LINEAR HASH, KEY,</p><p>LINEAR_KEY</p><p>(https://dev.mysql.com/doc/refman/8.0/en/partitioning-types.html) TiDB:</p><p>RANGE, RANGE COLUMNS, LIST, LIST COLUMNS, HASH, KEY PostgreSQL: RANGE,</p><p>LIST, HASH (https://www.postgresql.org/docs/current/ddl-partitioning.html)</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>RANGE</td>
<td>1</td>
<td><p></p></td>
</tr>
<tr>
- <td>GOOGLE_CLOUD_SQL_IAM</td>
+ <td>RANGE_COLUMNS</td>
<td>2</td>
<td><p></p></td>
</tr>
<tr>
- <td>AWS_RDS_IAM</td>
+ <td>LIST</td>
<td>3</td>
<td><p></p></td>
</tr>
+ <tr>
+ <td>LIST_COLUMNS</td>
+ <td>4</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>HASH</td>
+ <td>5</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>LINEAR_HASH</td>
+ <td>6</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>KEY</td>
+ <td>7</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>LINEAR_KEY</td>
+ <td>8</td>
+ <td><p></p></td>
+ </tr>
+
</tbody>
</table>
- <h3 id="bytebase.store.DataSourceOptions.RedisType">DataSourceOptions.RedisType</h3>
+ <h3 id="bytebase.store.TaskMetadata.State">TaskMetadata.State</h3>
<p></p>
<table class="enum-table">
<thead>
@@ -6636,29 +6543,23 @@ Used for authentication when connecting to the data source. </p></td>
<tbody>
<tr>
- <td>REDIS_TYPE_UNSPECIFIED</td>
+ <td>STATE_UNSPECIFIED</td>
<td>0</td>
<td><p></p></td>
</tr>
<tr>
- <td>STANDALONE</td>
+ <td>STATE_STARTED</td>
<td>1</td>
<td><p></p></td>
</tr>
<tr>
- <td>SENTINEL</td>
+ <td>STATE_SUSPENDED</td>
<td>2</td>
<td><p></p></td>
</tr>
- <tr>
- <td>CLUSTER</td>
- <td>3</td>
- <td><p></p></td>
- </tr>
-
</tbody>
</table>
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 117f2d4816..22738fe28a 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -350,22 +350,8 @@
- [AuthService](#bytebase-v1-AuthService)
- [v1/branch_service.proto](#v1_branch_service-proto)
- - [Branch](#bytebase-v1-Branch)
- - [CreateBranchRequest](#bytebase-v1-CreateBranchRequest)
- - [DeleteBranchRequest](#bytebase-v1-DeleteBranchRequest)
- - [DiffDatabaseRequest](#bytebase-v1-DiffDatabaseRequest)
- - [DiffDatabaseResponse](#bytebase-v1-DiffDatabaseResponse)
- [DiffMetadataRequest](#bytebase-v1-DiffMetadataRequest)
- [DiffMetadataResponse](#bytebase-v1-DiffMetadataResponse)
- - [GetBranchRequest](#bytebase-v1-GetBranchRequest)
- - [ListBranchesRequest](#bytebase-v1-ListBranchesRequest)
- - [ListBranchesResponse](#bytebase-v1-ListBranchesResponse)
- - [MergeBranchRequest](#bytebase-v1-MergeBranchRequest)
- - [RebaseBranchRequest](#bytebase-v1-RebaseBranchRequest)
- - [RebaseBranchResponse](#bytebase-v1-RebaseBranchResponse)
- - [UpdateBranchRequest](#bytebase-v1-UpdateBranchRequest)
-
- - [BranchView](#bytebase-v1-BranchView)
- [BranchService](#bytebase-v1-BranchService)
@@ -6069,100 +6055,6 @@ The user&#39;s `name` field is used to identify the user to update. Format: user
-<a name="bytebase-v1-Branch"></a>
-
-### Branch
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name of the branch. Format: projects/{project}/branches/{branch} {branch} should be the id of a sheet. |
-| branch_id | [string](#string) | | The branch ID. |
-| schema | [string](#string) | | The schema of branch. AKA sheet&#39;s statement. |
-| schema_metadata | [DatabaseMetadata](#bytebase-v1-DatabaseMetadata) | | The metadata of the current editing schema. |
-| baseline_schema | [string](#string) | | The baseline schema. |
-| baseline_schema_metadata | [DatabaseMetadata](#bytebase-v1-DatabaseMetadata) | | The metadata of the baseline schema. |
-| engine | [Engine](#bytebase-v1-Engine) | | The database engine of the branch. |
-| baseline_database | [string](#string) | | The name of the baseline database. Format: instances/{instance}/databases/{database} |
-| parent_branch | [string](#string) | | The name of the parent branch. For main branch, it&#39;s empty. For child branch, its format will be: projects/{project}/branches/{branch} |
-| etag | [string](#string) | | The etag of the branch. |
-| creator | [string](#string) | | The creator of the branch. Format: users/{email} |
-| updater | [string](#string) | | The updater of the branch. Format: users/{email} |
-| create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The timestamp when the branch was created. |
-| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The timestamp when the branch was last updated. |
-
-
-
-
-
-
-<a name="bytebase-v1-CreateBranchRequest"></a>
-
-### CreateBranchRequest
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| parent | [string](#string) | | The parent, which owns this collection of branches. Format: project/{project} |
-| branch | [Branch](#bytebase-v1-Branch) | | |
-| branch_id | [string](#string) | | The ID to use for the branch, which will become the final component of the branch&#39;s resource name. Format: [a-zA-Z][a-zA-Z0-9-_/]&#43;. |
-
-
-
-
-
-
-<a name="bytebase-v1-DeleteBranchRequest"></a>
-
-### DeleteBranchRequest
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name of the branch to delete. Format: projects/{project}/branches/{branch} |
-| force | [bool](#bool) | | By default, server will return `FAILED_PRECONDITION` error if delete the branch that is parent of other branches. If true, server will delete the branch forcely but will not delete its children branches. |
-
-
-
-
-
-
-<a name="bytebase-v1-DiffDatabaseRequest"></a>
-
-### DiffDatabaseRequest
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name of branch. |
-| database | [string](#string) | | The name of the databsae to merge the branch to. |
-
-
-
-
-
-
-<a name="bytebase-v1-DiffDatabaseResponse"></a>
-
-### DiffDatabaseResponse
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| diff | [string](#string) | | The schema diff when merge occurs seamlessly. |
-| schema | [string](#string) | | The merged schema if there is no conflict. |
-| conflict_schema | [string](#string) | | The conflict schema when rebase has conflicts. The conflict section is enclosed by the following. &lt;&lt;&lt;&lt;&lt; HEAD ==== &gt;&gt;&gt;&gt;&gt; main |
-
-
-
-
-
-
<a name="bytebase-v1-DiffMetadataRequest"></a>
### DiffMetadataRequest
@@ -6195,146 +6087,8 @@ The user&#39;s `name` field is used to identify the user to update. Format: user
-
-<a name="bytebase-v1-GetBranchRequest"></a>
-
-### GetBranchRequest
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name of the branch to retrieve. Format: projects/{project}/branches/{branch} |
-
-
-
-
-
-
-<a name="bytebase-v1-ListBranchesRequest"></a>
-
-### ListBranchesRequest
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| parent | [string](#string) | | The parent resource of the branch. Format: projects/{project} |
-| filter | [string](#string) | | To filter the search result. |
-| page_size | [int32](#int32) | | Not used. The maximum number of branches to return. The service may return fewer than this value. If unspecified, at most 50 branches will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |
-| page_token | [string](#string) | | Not used. A page token, received from a previous `ListBranches` call. Provide this to retrieve the subsequent page.
-
-When paginating, all other parameters provided to `ListBranches` must match the call that provided the page token. |
-| view | [BranchView](#bytebase-v1-BranchView) | | |
-
-
-
-
-
-
-<a name="bytebase-v1-ListBranchesResponse"></a>
-
-### ListBranchesResponse
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| branches | [Branch](#bytebase-v1-Branch) | repeated | The branches from the specified request. |
-| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |
-
-
-
-
-
-
-<a name="bytebase-v1-MergeBranchRequest"></a>
-
-### MergeBranchRequest
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name of the base branch to merge to. Format: projects/{project}/branches/{branch} |
-| head_branch | [string](#string) | | The head branch to merge from. Format: projects/{project}/branches/{branch} |
-| etag | [string](#string) | | The current etag of the branch. If an etag is provided and does not match the current etag of the branch, the call will be blocked and an ABORTED error will be returned. The etag should be the etag from named branch. |
-| validate_only | [bool](#bool) | | validate_only determines if the merge can occur seamlessly without any conflicts. |
-
-
-
-
-
-
-<a name="bytebase-v1-RebaseBranchRequest"></a>
-
-### RebaseBranchRequest
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name of the base branch to merge to. Format: projects/{project}/branches/{branch} |
-| source_database | [string](#string) | | The database (remote upstream) used to rebase. We use its schema as baseline and reapply the difference between base and head of the named branch. Format: instances/{instance}/databases/{database} |
-| source_branch | [string](#string) | | The branch (remote upstream) used to rebase. We use its head as baseline. We use its head schema as baseline and reapply the difference between base and head of the named branch. Format: projects/{project}/branches/{branch} |
-| merged_schema | [string](#string) | | For failed merge, we will pass in this addition merged schema and use it for head. This has to be set together with source_database or source_branch. |
-| etag | [string](#string) | | The current etag of the branch. If an etag is provided and does not match the current etag of the branch, the call will be blocked and an ABORTED error will be returned. The etag should be specified for using merged_schema. The etag should be the etag from named branch. |
-| validate_only | [bool](#bool) | | validate_only determines if the rebase can occur seamlessly without any conflicts. |
-
-
-
-
-
-
-<a name="bytebase-v1-RebaseBranchResponse"></a>
-
-### RebaseBranchResponse
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| branch | [Branch](#bytebase-v1-Branch) | | The rebased branch when rebase occurs seamlessly. |
-| conflict_schema | [string](#string) | | The conflict schema when rebase has conflicts. The conflict section is enclosed by the following. &lt;&lt;&lt;&lt;&lt; HEAD ==== &gt;&gt;&gt;&gt;&gt; main |
-
-
-
-
-
-
-<a name="bytebase-v1-UpdateBranchRequest"></a>
-
-### UpdateBranchRequest
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| branch | [Branch](#bytebase-v1-Branch) | | The branch to update.
-
-The branch&#39;s `name` field is used to identify the branch to update. Format: projects/{project}/branches/{branch} |
-| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |
-| etag | [string](#string) | | The current etag of the branch. If an etag is provided and does not match the current etag of the branch, the call will be blocked and an ABORTED error will be returned. The etag should be specified for using merged_schema. The etag should be the etag from named branch. |
-
-
-
-
-
-
-<a name="bytebase-v1-BranchView"></a>
-
-### BranchView
-
-
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| BRANCH_VIEW_UNSPECIFIED | 0 | The default / unset value. The API will default to the BASIC view. |
-| BRANCH_VIEW_BASIC | 1 | Exclude schema, baseline_schema. |
-| BRANCH_VIEW_FULL | 2 | Include everything. |
-
-
@@ -6347,13 +6101,6 @@ The branch&#39;s `name` field is used to identify the branch to update. Format:
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
-| GetBranch | [GetBranchRequest](#bytebase-v1-GetBranchRequest) | [Branch](#bytebase-v1-Branch) | |
-| ListBranches | [ListBranchesRequest](#bytebase-v1-ListBranchesRequest) | [ListBranchesResponse](#bytebase-v1-ListBranchesResponse) | |
-| CreateBranch | [CreateBranchRequest](#bytebase-v1-CreateBranchRequest) | [Branch](#bytebase-v1-Branch) | |
-| UpdateBranch | [UpdateBranchRequest](#bytebase-v1-UpdateBranchRequest) | [Branch](#bytebase-v1-Branch) | |
-| MergeBranch | [MergeBranchRequest](#bytebase-v1-MergeBranchRequest) | [Branch](#bytebase-v1-Branch) | |
-| RebaseBranch | [RebaseBranchRequest](#bytebase-v1-RebaseBranchRequest) | [RebaseBranchResponse](#bytebase-v1-RebaseBranchResponse) | |
-| DeleteBranch | [DeleteBranchRequest](#bytebase-v1-DeleteBranchRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |
| DiffMetadata | [DiffMetadataRequest](#bytebase-v1-DiffMetadataRequest) | [DiffMetadataResponse](#bytebase-v1-DiffMetadataResponse) | |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 7589a781c7..9ea02bd190 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -1512,26 +1512,6 @@
<a href="#v1%2fbranch_service.proto">v1/branch_service.proto</a>
<ul>
- <li>
- <a href="#bytebase.v1.Branch"><span class="badge">M</span>Branch</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.CreateBranchRequest"><span class="badge">M</span>CreateBranchRequest</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.DeleteBranchRequest"><span class="badge">M</span>DeleteBranchRequest</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.DiffDatabaseRequest"><span class="badge">M</span>DiffDatabaseRequest</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.DiffDatabaseResponse"><span class="badge">M</span>DiffDatabaseResponse</a>
- </li>
-
<li>
<a href="#bytebase.v1.DiffMetadataRequest"><span class="badge">M</span>DiffMetadataRequest</a>
</li>
@@ -1540,38 +1520,6 @@
<a href="#bytebase.v1.DiffMetadataResponse"><span class="badge">M</span>DiffMetadataResponse</a>
</li>
- <li>
- <a href="#bytebase.v1.GetBranchRequest"><span class="badge">M</span>GetBranchRequest</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.ListBranchesRequest"><span class="badge">M</span>ListBranchesRequest</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.ListBranchesResponse"><span class="badge">M</span>ListBranchesResponse</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.MergeBranchRequest"><span class="badge">M</span>MergeBranchRequest</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.RebaseBranchRequest"><span class="badge">M</span>RebaseBranchRequest</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.RebaseBranchResponse"><span class="badge">M</span>RebaseBranchResponse</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.UpdateBranchRequest"><span class="badge">M</span>UpdateBranchRequest</a>
- </li>
-
-
- <li>
- <a href="#bytebase.v1.BranchView"><span class="badge">E</span>BranchView</a>
- </li>
@@ -17280,7 +17228,7 @@ The last remaining workspace admin cannot be deleted.</p></td>
<p></p>
- <h3 id="bytebase.v1.Branch">Branch</h3>
+ <h3 id="bytebase.v1.DiffMetadataRequest">DiffMetadataRequest</h3>
<p></p>
@@ -17291,108 +17239,31 @@ The last remaining workspace admin cannot be deleted.</p></td>
<tbody>
<tr>
- <td>name</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The name of the branch.
-Format: projects/{project}/branches/{branch}
-{branch} should be the id of a sheet. </p></td>
- </tr>
-
- <tr>
- <td>branch_id</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The branch ID. </p></td>
- </tr>
-
- <tr>
- <td>schema</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The schema of branch. AKA sheet&#39;s statement. </p></td>
- </tr>
-
- <tr>
- <td>schema_metadata</td>
+ <td>source_metadata</td>
<td><a href="#bytebase.v1.DatabaseMetadata">DatabaseMetadata</a></td>
<td></td>
- <td><p>The metadata of the current editing schema. </p></td>
- </tr>
-
- <tr>
- <td>baseline_schema</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The baseline schema. </p></td>
+ <td><p>The metadata of the source schema. </p></td>
</tr>
<tr>
- <td>baseline_schema_metadata</td>
+ <td>target_metadata</td>
<td><a href="#bytebase.v1.DatabaseMetadata">DatabaseMetadata</a></td>
<td></td>
- <td><p>The metadata of the baseline schema. </p></td>
+ <td><p>The metadata of the target schema. </p></td>
</tr>
<tr>
<td>engine</td>
<td><a href="#bytebase.v1.Engine">Engine</a></td>
<td></td>
- <td><p>The database engine of the branch. </p></td>
- </tr>
-
- <tr>
- <td>baseline_database</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The name of the baseline database.
-Format: instances/{instance}/databases/{database} </p></td>
- </tr>
-
- <tr>
- <td>parent_branch</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The name of the parent branch.
-For main branch, it&#39;s empty.
-For child branch, its format will be: projects/{project}/branches/{branch} </p></td>
- </tr>
-
- <tr>
- <td>etag</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The etag of the branch. </p></td>
- </tr>
-
- <tr>
- <td>creator</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The creator of the branch.
-Format: users/{email} </p></td>
- </tr>
-
- <tr>
- <td>updater</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The updater of the branch.
-Format: users/{email} </p></td>
- </tr>
-
- <tr>
- <td>create_time</td>
- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
- <td></td>
- <td><p>The timestamp when the branch was created. </p></td>
+ <td><p>The database engine of the schema. </p></td>
</tr>
<tr>
- <td>update_time</td>
- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
+ <td>classification_from_config</td>
+ <td><a href="#bool">bool</a></td>
<td></td>
- <td><p>The timestamp when the branch was last updated. </p></td>
+ <td><p>If false, we will build the raw common by classification in database config. </p></td>
</tr>
</tbody>
@@ -17402,7 +17273,7 @@ Format: users/{email} </p></td>
- <h3 id="bytebase.v1.CreateBranchRequest">CreateBranchRequest</h3>
+ <h3 id="bytebase.v1.DiffMetadataResponse">DiffMetadataResponse</h3>
<p></p>
@@ -17413,27 +17284,10 @@ Format: users/{email} </p></td>
<tbody>
<tr>
- <td>parent</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The parent, which owns this collection of branches.
-Format: project/{project} </p></td>
- </tr>
-
- <tr>
- <td>branch</td>
- <td><a href="#bytebase.v1.Branch">Branch</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>branch_id</td>
+ <td>diff</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The ID to use for the branch, which will become the final component of
-the branch&#39;s resource name.
-Format: [a-zA-Z][a-zA-Z0-9-_/]&#43;. </p></td>
+ <td><p>The diff of the metadata. </p></td>
</tr>
</tbody>
@@ -17443,685 +17297,44 @@ Format: [a-zA-Z][a-zA-Z0-9-_/]&#43;. </p></td>
- <h3 id="bytebase.v1.DeleteBranchRequest">DeleteBranchRequest</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>name</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The name of the branch to delete.
-Format: projects/{project}/branches/{branch} </p></td>
- </tr>
-
- <tr>
- <td>force</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>By default, server will return `FAILED_PRECONDITION` error
-if delete the branch that is parent of other branches.
-If true, server will delete the branch forcely but will not delete its children branches. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
- <h3 id="bytebase.v1.DiffDatabaseRequest">DiffDatabaseRequest</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>name</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The name of branch. </p></td>
- </tr>
-
- <tr>
- <td>database</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The name of the databsae to merge the branch to. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
- <h3 id="bytebase.v1.DiffDatabaseResponse">DiffDatabaseResponse</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>diff</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The schema diff when merge occurs seamlessly. </p></td>
- </tr>
-
- <tr>
- <td>schema</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The merged schema if there is no conflict. </p></td>
- </tr>
-
- <tr>
- <td>conflict_schema</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The conflict schema when rebase has conflicts.
-The conflict section is enclosed by the following.
-&lt;&lt;&lt;&lt;&lt; HEAD
-====
-&gt;&gt;&gt;&gt;&gt; main </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
- <h3 id="bytebase.v1.DiffMetadataRequest">DiffMetadataRequest</h3>
+ <h3 id="bytebase.v1.BranchService">BranchService</h3>
<p></p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Method Name</td><td>Request Type</td><td>Response Type</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>DiffMetadata</td>
+ <td><a href="#bytebase.v1.DiffMetadataRequest">DiffMetadataRequest</a></td>
+ <td><a href="#bytebase.v1.DiffMetadataResponse">DiffMetadataResponse</a></td>
+ <td><p></p></td>
+ </tr>
+
+ </tbody>
+ </table>
- <table class="field-table">
+
+
+ <h4>Methods with HTTP bindings</h4>
+ <table>
<thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ <tr>
+ <td>Method Name</td>
+ <td>Method</td>
+ <td>Pattern</td>
+ <td>Body</td>
+ </tr>
</thead>
<tbody>
-
- <tr>
- <td>source_metadata</td>
- <td><a href="#bytebase.v1.DatabaseMetadata">DatabaseMetadata</a></td>
- <td></td>
- <td><p>The metadata of the source schema. </p></td>
- </tr>
-
- <tr>
- <td>target_metadata</td>
- <td><a href="#bytebase.v1.DatabaseMetadata">DatabaseMetadata</a></td>
- <td></td>
- <td><p>The metadata of the target schema. </p></td>
- </tr>
-
- <tr>
- <td>engine</td>
- <td><a href="#bytebase.v1.Engine">Engine</a></td>
- <td></td>
- <td><p>The database engine of the schema. </p></td>
- </tr>
-
- <tr>
- <td>classification_from_config</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>If false, we will build the raw common by classification in database config. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.DiffMetadataResponse">DiffMetadataResponse</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>diff</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The diff of the metadata. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.GetBranchRequest">GetBranchRequest</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>name</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The name of the branch to retrieve.
-Format: projects/{project}/branches/{branch} </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.ListBranchesRequest">ListBranchesRequest</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>parent</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The parent resource of the branch.
-Format: projects/{project} </p></td>
- </tr>
-
- <tr>
- <td>filter</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>To filter the search result. </p></td>
- </tr>
-
- <tr>
- <td>page_size</td>
- <td><a href="#int32">int32</a></td>
- <td></td>
- <td><p>Not used.
-The maximum number of branches to return. The service may return fewer than
-this value.
-If unspecified, at most 50 branches will be returned.
-The maximum value is 1000; values above 1000 will be coerced to 1000. </p></td>
- </tr>
-
- <tr>
- <td>page_token</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>Not used.
-A page token, received from a previous `ListBranches` call.
-Provide this to retrieve the subsequent page.
-
-When paginating, all other parameters provided to `ListBranches` must match
-the call that provided the page token. </p></td>
- </tr>
-
- <tr>
- <td>view</td>
- <td><a href="#bytebase.v1.BranchView">BranchView</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.ListBranchesResponse">ListBranchesResponse</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>branches</td>
- <td><a href="#bytebase.v1.Branch">Branch</a></td>
- <td>repeated</td>
- <td><p>The branches from the specified request. </p></td>
- </tr>
-
- <tr>
- <td>next_page_token</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>A token, which can be sent as `page_token` to retrieve the next page.
-If this field is omitted, there are no subsequent pages. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.MergeBranchRequest">MergeBranchRequest</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>name</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The name of the base branch to merge to.
-Format: projects/{project}/branches/{branch} </p></td>
- </tr>
-
- <tr>
- <td>head_branch</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The head branch to merge from.
-Format: projects/{project}/branches/{branch} </p></td>
- </tr>
-
- <tr>
- <td>etag</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The current etag of the branch.
-If an etag is provided and does not match the current etag of the branch,
-the call will be blocked and an ABORTED error will be returned.
-The etag should be the etag from named branch. </p></td>
- </tr>
-
- <tr>
- <td>validate_only</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>validate_only determines if the merge can occur seamlessly without any conflicts. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.RebaseBranchRequest">RebaseBranchRequest</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>name</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The name of the base branch to merge to.
-Format: projects/{project}/branches/{branch} </p></td>
- </tr>
-
- <tr>
- <td>source_database</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The database (remote upstream) used to rebase.
-We use its schema as baseline and reapply the difference between base and head of the named branch.
-Format: instances/{instance}/databases/{database} </p></td>
- </tr>
-
- <tr>
- <td>source_branch</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The branch (remote upstream) used to rebase. We use its head as baseline.
-We use its head schema as baseline and reapply the difference between base and head of the named branch.
-Format: projects/{project}/branches/{branch} </p></td>
- </tr>
-
- <tr>
- <td>merged_schema</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>For failed merge, we will pass in this addition merged schema and use it for head.
-This has to be set together with source_database or source_branch. </p></td>
- </tr>
-
- <tr>
- <td>etag</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The current etag of the branch.
-If an etag is provided and does not match the current etag of the branch,
-the call will be blocked and an ABORTED error will be returned.
-The etag should be specified for using merged_schema. The etag should be the etag from named branch. </p></td>
- </tr>
-
- <tr>
- <td>validate_only</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>validate_only determines if the rebase can occur seamlessly without any conflicts. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.RebaseBranchResponse">RebaseBranchResponse</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>branch</td>
- <td><a href="#bytebase.v1.Branch">Branch</a></td>
- <td></td>
- <td><p>The rebased branch when rebase occurs seamlessly. </p></td>
- </tr>
-
- <tr>
- <td>conflict_schema</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The conflict schema when rebase has conflicts.
-The conflict section is enclosed by the following.
-&lt;&lt;&lt;&lt;&lt; HEAD
-====
-&gt;&gt;&gt;&gt;&gt; main </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.UpdateBranchRequest">UpdateBranchRequest</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>branch</td>
- <td><a href="#bytebase.v1.Branch">Branch</a></td>
- <td></td>
- <td><p>The branch to update.
-
-The branch&#39;s `name` field is used to identify the branch to update.
-Format: projects/{project}/branches/{branch} </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 update. </p></td>
- </tr>
-
- <tr>
- <td>etag</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The current etag of the branch.
-If an etag is provided and does not match the current etag of the branch,
-the call will be blocked and an ABORTED error will be returned.
-The etag should be specified for using merged_schema. The etag should be the etag from named branch. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
-
-
- <h3 id="bytebase.v1.BranchView">BranchView</h3>
- <p></p>
- <table class="enum-table">
- <thead>
- <tr><td>Name</td><td>Number</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>BRANCH_VIEW_UNSPECIFIED</td>
- <td>0</td>
- <td><p>The default / unset value.
-The API will default to the BASIC view.</p></td>
- </tr>
-
- <tr>
- <td>BRANCH_VIEW_BASIC</td>
- <td>1</td>
- <td><p>Exclude schema, baseline_schema.</p></td>
- </tr>
-
- <tr>
- <td>BRANCH_VIEW_FULL</td>
- <td>2</td>
- <td><p>Include everything.</p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.BranchService">BranchService</h3>
- <p></p>
- <table class="enum-table">
- <thead>
- <tr><td>Method Name</td><td>Request Type</td><td>Response Type</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>GetBranch</td>
- <td><a href="#bytebase.v1.GetBranchRequest">GetBranchRequest</a></td>
- <td><a href="#bytebase.v1.Branch">Branch</a></td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>ListBranches</td>
- <td><a href="#bytebase.v1.ListBranchesRequest">ListBranchesRequest</a></td>
- <td><a href="#bytebase.v1.ListBranchesResponse">ListBranchesResponse</a></td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>CreateBranch</td>
- <td><a href="#bytebase.v1.CreateBranchRequest">CreateBranchRequest</a></td>
- <td><a href="#bytebase.v1.Branch">Branch</a></td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>UpdateBranch</td>
- <td><a href="#bytebase.v1.UpdateBranchRequest">UpdateBranchRequest</a></td>
- <td><a href="#bytebase.v1.Branch">Branch</a></td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>MergeBranch</td>
- <td><a href="#bytebase.v1.MergeBranchRequest">MergeBranchRequest</a></td>
- <td><a href="#bytebase.v1.Branch">Branch</a></td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>RebaseBranch</td>
- <td><a href="#bytebase.v1.RebaseBranchRequest">RebaseBranchRequest</a></td>
- <td><a href="#bytebase.v1.RebaseBranchResponse">RebaseBranchResponse</a></td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>DeleteBranch</td>
- <td><a href="#bytebase.v1.DeleteBranchRequest">DeleteBranchRequest</a></td>
- <td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>DiffMetadata</td>
- <td><a href="#bytebase.v1.DiffMetadataRequest">DiffMetadataRequest</a></td>
- <td><a href="#bytebase.v1.DiffMetadataResponse">DiffMetadataResponse</a></td>
- <td><p></p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
- <h4>Methods with HTTP bindings</h4>
- <table>
- <thead>
- <tr>
- <td>Method Name</td>
- <td>Method</td>
- <td>Pattern</td>
- <td>Body</td>
- </tr>
- </thead>
- <tbody>
-
-
-
- <tr>
- <td>GetBranch</td>
- <td>GET</td>
- <td>/v1/{name=projects/*/branches/*}</td>
- <td></td>
- </tr>
-
-
-
-
- <tr>
- <td>ListBranches</td>
- <td>GET</td>
- <td>/v1/{parent=projects/*}/branches</td>
- <td></td>
- </tr>
-
-
-
-
- <tr>
- <td>CreateBranch</td>
- <td>POST</td>
- <td>/v1/{parent=projects/*}/branch</td>
- <td>branch</td>
- </tr>
-
-
-
-
- <tr>
- <td>UpdateBranch</td>
- <td>PATCH</td>
- <td>/v1/{branch.name=projects/*/branches/*}</td>
- <td>branch</td>
- </tr>
-
-
-
-
- <tr>
- <td>MergeBranch</td>
- <td>POST</td>
- <td>/v1/{name=projects/*/branches/*}:merge</td>
- <td></td>
- </tr>
-
-
-
-
- <tr>
- <td>RebaseBranch</td>
- <td>POST</td>
- <td>/v1/{name=projects/*/branches/*}:rebase</td>
- <td></td>
- </tr>
-
-
-
-
- <tr>
- <td>DeleteBranch</td>
- <td>DELETE</td>
- <td>/v1/{name=projects/*/branches/*}</td>
- <td></td>
- </tr>
-
diff --git a/proto/generated-go/v1/branch_service.pb.go b/proto/generated-go/v1/branch_service.pb.go
index 26029e5a74..ffead629db 100644
--- a/proto/generated-go/v1/branch_service.pb.go
+++ b/proto/generated-go/v1/branch_service.pb.go
@@ -10,9 +10,6 @@ import (
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- emptypb "google.golang.org/protobuf/types/known/emptypb"
- fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
- timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
)
@@ -24,1025 +21,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
-type BranchView int32
-
-const (
- // The default / unset value.
- // The API will default to the BASIC view.
- BranchView_BRANCH_VIEW_UNSPECIFIED BranchView = 0
- // Exclude schema, baseline_schema.
- BranchView_BRANCH_VIEW_BASIC BranchView = 1
- // Include everything.
- BranchView_BRANCH_VIEW_FULL BranchView = 2
-)
-
-// Enum value maps for BranchView.
-var (
- BranchView_name = map[int32]string{
- 0: "BRANCH_VIEW_UNSPECIFIED",
- 1: "BRANCH_VIEW_BASIC",
- 2: "BRANCH_VIEW_FULL",
- }
- BranchView_value = map[string]int32{
- "BRANCH_VIEW_UNSPECIFIED": 0,
- "BRANCH_VIEW_BASIC": 1,
- "BRANCH_VIEW_FULL": 2,
- }
-)
-
-func (x BranchView) Enum() *BranchView {
- p := new(BranchView)
- *p = x
- return p
-}
-
-func (x BranchView) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (BranchView) Descriptor() protoreflect.EnumDescriptor {
- return file_v1_branch_service_proto_enumTypes[0].Descriptor()
-}
-
-func (BranchView) Type() protoreflect.EnumType {
- return &file_v1_branch_service_proto_enumTypes[0]
-}
-
-func (x BranchView) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Use BranchView.Descriptor instead.
-func (BranchView) EnumDescriptor() ([]byte, []int) {
- return file_v1_branch_service_proto_rawDescGZIP(), []int{0}
-}
-
-type Branch struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The name of the branch.
- // Format: projects/{project}/branches/{branch}
- // {branch} should be the id of a sheet.
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- // The branch ID.
- BranchId string `protobuf:"bytes,2,opt,name=branch_id,json=branchId,proto3" json:"branch_id,omitempty"`
- // The schema of branch. AKA sheet's statement.
- Schema string `protobuf:"bytes,3,opt,name=schema,proto3" json:"schema,omitempty"`
- // The metadata of the current editing schema.
- SchemaMetadata *DatabaseMetadata `protobuf:"bytes,4,opt,name=schema_metadata,json=schemaMetadata,proto3" json:"schema_metadata,omitempty"`
- // The baseline schema.
- BaselineSchema string `protobuf:"bytes,5,opt,name=baseline_schema,json=baselineSchema,proto3" json:"baseline_schema,omitempty"`
- // The metadata of the baseline schema.
- BaselineSchemaMetadata *DatabaseMetadata `protobuf:"bytes,6,opt,name=baseline_schema_metadata,json=baselineSchemaMetadata,proto3" json:"baseline_schema_metadata,omitempty"`
- // The database engine of the branch.
- Engine Engine `protobuf:"varint,7,opt,name=engine,proto3,enum=bytebase.v1.Engine" json:"engine,omitempty"`
- // The name of the baseline database.
- // Format: instances/{instance}/databases/{database}
- BaselineDatabase string `protobuf:"bytes,8,opt,name=baseline_database,json=baselineDatabase,proto3" json:"baseline_database,omitempty"`
- // The name of the parent branch.
- // For main branch, it's empty.
- // For child branch, its format will be: projects/{project}/branches/{branch}
- ParentBranch string `protobuf:"bytes,9,opt,name=parent_branch,json=parentBranch,proto3" json:"parent_branch,omitempty"`
- // The etag of the branch.
- Etag string `protobuf:"bytes,10,opt,name=etag,proto3" json:"etag,omitempty"`
- // The creator of the branch.
- // Format: users/{email}
- Creator string `protobuf:"bytes,11,opt,name=creator,proto3" json:"creator,omitempty"`
- // The updater of the branch.
- // Format: users/{email}
- Updater string `protobuf:"bytes,12,opt,name=updater,proto3" json:"updater,omitempty"`
- // The timestamp when the branch was created.
- CreateTime *timestamppb.Timestamp `protobuf:"bytes,13,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
- // The timestamp when the branch was last updated.
- UpdateTime *timestamppb.Timestamp `protobuf:"bytes,14,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *Branch) Reset() {
- *x = Branch{}
- mi := &file_v1_branch_service_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *Branch) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Branch) ProtoMessage() {}
-
-func (x *Branch) ProtoReflect() protoreflect.Message {
- mi := &file_v1_branch_service_proto_msgTypes[0]
- 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 Branch.ProtoReflect.Descriptor instead.
-func (*Branch) Descriptor() ([]byte, []int) {
- return file_v1_branch_service_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *Branch) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-func (x *Branch) GetBranchId() string {
- if x != nil {
- return x.BranchId
- }
- return ""
-}
-
-func (x *Branch) GetSchema() string {
- if x != nil {
- return x.Schema
- }
- return ""
-}
-
-func (x *Branch) GetSchemaMetadata() *DatabaseMetadata {
- if x != nil {
- return x.SchemaMetadata
- }
- return nil
-}
-
-func (x *Branch) GetBaselineSchema() string {
- if x != nil {
- return x.BaselineSchema
- }
- return ""
-}
-
-func (x *Branch) GetBaselineSchemaMetadata() *DatabaseMetadata {
- if x != nil {
- return x.BaselineSchemaMetadata
- }
- return nil
-}
-
-func (x *Branch) GetEngine() Engine {
- if x != nil {
- return x.Engine
- }
- return Engine_ENGINE_UNSPECIFIED
-}
-
-func (x *Branch) GetBaselineDatabase() string {
- if x != nil {
- return x.BaselineDatabase
- }
- return ""
-}
-
-func (x *Branch) GetParentBranch() string {
- if x != nil {
- return x.ParentBranch
- }
- return ""
-}
-
-func (x *Branch) GetEtag() string {
- if x != nil {
- return x.Etag
- }
- return ""
-}
-
-func (x *Branch) GetCreator() string {
- if x != nil {
- return x.Creator
- }
- return ""
-}
-
-func (x *Branch) GetUpdater() string {
- if x != nil {
- return x.Updater
- }
- return ""
-}
-
-func (x *Branch) GetCreateTime() *timestamppb.Timestamp {
- if x != nil {
- return x.CreateTime
- }
- return nil
-}
-
-func (x *Branch) GetUpdateTime() *timestamppb.Timestamp {
- if x != nil {
- return x.UpdateTime
- }
- return nil
-}
-
-type GetBranchRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The name of the branch to retrieve.
- // Format: projects/{project}/branches/{branch}
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *GetBranchRequest) Reset() {
- *x = GetBranchRequest{}
- mi := &file_v1_branch_service_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *GetBranchRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*GetBranchRequest) ProtoMessage() {}
-
-func (x *GetBranchRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_branch_service_proto_msgTypes[1]
- 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 GetBranchRequest.ProtoReflect.Descriptor instead.
-func (*GetBranchRequest) Descriptor() ([]byte, []int) {
- return file_v1_branch_service_proto_rawDescGZIP(), []int{1}
-}
-
-func (x *GetBranchRequest) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-type ListBranchesRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The parent resource of the branch.
- // Format: projects/{project}
- Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
- // To filter the search result.
- Filter string `protobuf:"bytes,2,opt,name=filter,proto3" json:"filter,omitempty"`
- // Not used.
- // The maximum number of branches to return. The service may return fewer than
- // this value.
- // If unspecified, at most 50 branches will be returned.
- // The maximum value is 1000; values above 1000 will be coerced to 1000.
- PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
- // Not used.
- // A page token, received from a previous `ListBranches` call.
- // Provide this to retrieve the subsequent page.
- //
- // When paginating, all other parameters provided to `ListBranches` must match
- // the call that provided the page token.
- PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
- View BranchView `protobuf:"varint,5,opt,name=view,proto3,enum=bytebase.v1.BranchView" json:"view,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *ListBranchesRequest) Reset() {
- *x = ListBranchesRequest{}
- mi := &file_v1_branch_service_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *ListBranchesRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ListBranchesRequest) ProtoMessage() {}
-
-func (x *ListBranchesRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_branch_service_proto_msgTypes[2]
- 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 ListBranchesRequest.ProtoReflect.Descriptor instead.
-func (*ListBranchesRequest) Descriptor() ([]byte, []int) {
- return file_v1_branch_service_proto_rawDescGZIP(), []int{2}
-}
-
-func (x *ListBranchesRequest) GetParent() string {
- if x != nil {
- return x.Parent
- }
- return ""
-}
-
-func (x *ListBranchesRequest) GetFilter() string {
- if x != nil {
- return x.Filter
- }
- return ""
-}
-
-func (x *ListBranchesRequest) GetPageSize() int32 {
- if x != nil {
- return x.PageSize
- }
- return 0
-}
-
-func (x *ListBranchesRequest) GetPageToken() string {
- if x != nil {
- return x.PageToken
- }
- return ""
-}
-
-func (x *ListBranchesRequest) GetView() BranchView {
- if x != nil {
- return x.View
- }
- return BranchView_BRANCH_VIEW_UNSPECIFIED
-}
-
-type ListBranchesResponse struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The branches from the specified request.
- Branches []*Branch `protobuf:"bytes,1,rep,name=branches,proto3" json:"branches,omitempty"`
- // A token, which can be sent as `page_token` to retrieve the next page.
- // If this field is omitted, there are no subsequent pages.
- NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *ListBranchesResponse) Reset() {
- *x = ListBranchesResponse{}
- mi := &file_v1_branch_service_proto_msgTypes[3]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *ListBranchesResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ListBranchesResponse) ProtoMessage() {}
-
-func (x *ListBranchesResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_branch_service_proto_msgTypes[3]
- 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 ListBranchesResponse.ProtoReflect.Descriptor instead.
-func (*ListBranchesResponse) Descriptor() ([]byte, []int) {
- return file_v1_branch_service_proto_rawDescGZIP(), []int{3}
-}
-
-func (x *ListBranchesResponse) GetBranches() []*Branch {
- if x != nil {
- return x.Branches
- }
- return nil
-}
-
-func (x *ListBranchesResponse) GetNextPageToken() string {
- if x != nil {
- return x.NextPageToken
- }
- return ""
-}
-
-type CreateBranchRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The parent, which owns this collection of branches.
- // Format: project/{project}
- Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
- Branch *Branch `protobuf:"bytes,2,opt,name=branch,proto3" json:"branch,omitempty"`
- // The ID to use for the branch, which will become the final component of
- // the branch's resource name.
- // Format: [a-zA-Z][a-zA-Z0-9-_/]+.
- BranchId string `protobuf:"bytes,3,opt,name=branch_id,json=branchId,proto3" json:"branch_id,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *CreateBranchRequest) Reset() {
- *x = CreateBranchRequest{}
- mi := &file_v1_branch_service_proto_msgTypes[4]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *CreateBranchRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*CreateBranchRequest) ProtoMessage() {}
-
-func (x *CreateBranchRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_branch_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 CreateBranchRequest.ProtoReflect.Descriptor instead.
-func (*CreateBranchRequest) Descriptor() ([]byte, []int) {
- return file_v1_branch_service_proto_rawDescGZIP(), []int{4}
-}
-
-func (x *CreateBranchRequest) GetParent() string {
- if x != nil {
- return x.Parent
- }
- return ""
-}
-
-func (x *CreateBranchRequest) GetBranch() *Branch {
- if x != nil {
- return x.Branch
- }
- return nil
-}
-
-func (x *CreateBranchRequest) GetBranchId() string {
- if x != nil {
- return x.BranchId
- }
- return ""
-}
-
-type UpdateBranchRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The branch to update.
- //
- // The branch's `name` field is used to identify the branch to update.
- // Format: projects/{project}/branches/{branch}
- Branch *Branch `protobuf:"bytes,1,opt,name=branch,proto3" json:"branch,omitempty"`
- // The list of fields to update.
- UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
- // The current etag of the branch.
- // If an etag is provided and does not match the current etag of the branch,
- // the call will be blocked and an ABORTED error will be returned.
- // The etag should be specified for using merged_schema. The etag should be the etag from named branch.
- Etag string `protobuf:"bytes,3,opt,name=etag,proto3" json:"etag,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *UpdateBranchRequest) Reset() {
- *x = UpdateBranchRequest{}
- mi := &file_v1_branch_service_proto_msgTypes[5]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *UpdateBranchRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*UpdateBranchRequest) ProtoMessage() {}
-
-func (x *UpdateBranchRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_branch_service_proto_msgTypes[5]
- 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 UpdateBranchRequest.ProtoReflect.Descriptor instead.
-func (*UpdateBranchRequest) Descriptor() ([]byte, []int) {
- return file_v1_branch_service_proto_rawDescGZIP(), []int{5}
-}
-
-func (x *UpdateBranchRequest) GetBranch() *Branch {
- if x != nil {
- return x.Branch
- }
- return nil
-}
-
-func (x *UpdateBranchRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
- if x != nil {
- return x.UpdateMask
- }
- return nil
-}
-
-func (x *UpdateBranchRequest) GetEtag() string {
- if x != nil {
- return x.Etag
- }
- return ""
-}
-
-type MergeBranchRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The name of the base branch to merge to.
- // Format: projects/{project}/branches/{branch}
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- // The head branch to merge from.
- // Format: projects/{project}/branches/{branch}
- HeadBranch string `protobuf:"bytes,2,opt,name=head_branch,json=headBranch,proto3" json:"head_branch,omitempty"`
- // The current etag of the branch.
- // If an etag is provided and does not match the current etag of the branch,
- // the call will be blocked and an ABORTED error will be returned.
- // The etag should be the etag from named branch.
- Etag string `protobuf:"bytes,3,opt,name=etag,proto3" json:"etag,omitempty"`
- // validate_only determines if the merge can occur seamlessly without any conflicts.
- ValidateOnly bool `protobuf:"varint,4,opt,name=validate_only,json=validateOnly,proto3" json:"validate_only,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *MergeBranchRequest) Reset() {
- *x = MergeBranchRequest{}
- mi := &file_v1_branch_service_proto_msgTypes[6]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *MergeBranchRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*MergeBranchRequest) ProtoMessage() {}
-
-func (x *MergeBranchRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_branch_service_proto_msgTypes[6]
- 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 MergeBranchRequest.ProtoReflect.Descriptor instead.
-func (*MergeBranchRequest) Descriptor() ([]byte, []int) {
- return file_v1_branch_service_proto_rawDescGZIP(), []int{6}
-}
-
-func (x *MergeBranchRequest) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-func (x *MergeBranchRequest) GetHeadBranch() string {
- if x != nil {
- return x.HeadBranch
- }
- return ""
-}
-
-func (x *MergeBranchRequest) GetEtag() string {
- if x != nil {
- return x.Etag
- }
- return ""
-}
-
-func (x *MergeBranchRequest) GetValidateOnly() bool {
- if x != nil {
- return x.ValidateOnly
- }
- return false
-}
-
-type RebaseBranchRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The name of the base branch to merge to.
- // Format: projects/{project}/branches/{branch}
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- // The database (remote upstream) used to rebase.
- // We use its schema as baseline and reapply the difference between base and head of the named branch.
- // Format: instances/{instance}/databases/{database}
- SourceDatabase string `protobuf:"bytes,2,opt,name=source_database,json=sourceDatabase,proto3" json:"source_database,omitempty"`
- // The branch (remote upstream) used to rebase. We use its head as baseline.
- // We use its head schema as baseline and reapply the difference between base and head of the named branch.
- // Format: projects/{project}/branches/{branch}
- SourceBranch string `protobuf:"bytes,3,opt,name=source_branch,json=sourceBranch,proto3" json:"source_branch,omitempty"`
- // For failed merge, we will pass in this addition merged schema and use it for head.
- // This has to be set together with source_database or source_branch.
- MergedSchema string `protobuf:"bytes,4,opt,name=merged_schema,json=mergedSchema,proto3" json:"merged_schema,omitempty"`
- // The current etag of the branch.
- // If an etag is provided and does not match the current etag of the branch,
- // the call will be blocked and an ABORTED error will be returned.
- // The etag should be specified for using merged_schema. The etag should be the etag from named branch.
- Etag string `protobuf:"bytes,5,opt,name=etag,proto3" json:"etag,omitempty"`
- // validate_only determines if the rebase can occur seamlessly without any conflicts.
- ValidateOnly bool `protobuf:"varint,6,opt,name=validate_only,json=validateOnly,proto3" json:"validate_only,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *RebaseBranchRequest) Reset() {
- *x = RebaseBranchRequest{}
- mi := &file_v1_branch_service_proto_msgTypes[7]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *RebaseBranchRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*RebaseBranchRequest) ProtoMessage() {}
-
-func (x *RebaseBranchRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_branch_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 RebaseBranchRequest.ProtoReflect.Descriptor instead.
-func (*RebaseBranchRequest) Descriptor() ([]byte, []int) {
- return file_v1_branch_service_proto_rawDescGZIP(), []int{7}
-}
-
-func (x *RebaseBranchRequest) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-func (x *RebaseBranchRequest) GetSourceDatabase() string {
- if x != nil {
- return x.SourceDatabase
- }
- return ""
-}
-
-func (x *RebaseBranchRequest) GetSourceBranch() string {
- if x != nil {
- return x.SourceBranch
- }
- return ""
-}
-
-func (x *RebaseBranchRequest) GetMergedSchema() string {
- if x != nil {
- return x.MergedSchema
- }
- return ""
-}
-
-func (x *RebaseBranchRequest) GetEtag() string {
- if x != nil {
- return x.Etag
- }
- return ""
-}
-
-func (x *RebaseBranchRequest) GetValidateOnly() bool {
- if x != nil {
- return x.ValidateOnly
- }
- return false
-}
-
-type RebaseBranchResponse struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // Types that are valid to be assigned to Result:
- //
- // *RebaseBranchResponse_Branch
- // *RebaseBranchResponse_ConflictSchema
- Result isRebaseBranchResponse_Result `protobuf_oneof:"result"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *RebaseBranchResponse) Reset() {
- *x = RebaseBranchResponse{}
- mi := &file_v1_branch_service_proto_msgTypes[8]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *RebaseBranchResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*RebaseBranchResponse) ProtoMessage() {}
-
-func (x *RebaseBranchResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_branch_service_proto_msgTypes[8]
- 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 RebaseBranchResponse.ProtoReflect.Descriptor instead.
-func (*RebaseBranchResponse) Descriptor() ([]byte, []int) {
- return file_v1_branch_service_proto_rawDescGZIP(), []int{8}
-}
-
-func (x *RebaseBranchResponse) GetResult() isRebaseBranchResponse_Result {
- if x != nil {
- return x.Result
- }
- return nil
-}
-
-func (x *RebaseBranchResponse) GetBranch() *Branch {
- if x != nil {
- if x, ok := x.Result.(*RebaseBranchResponse_Branch); ok {
- return x.Branch
- }
- }
- return nil
-}
-
-func (x *RebaseBranchResponse) GetConflictSchema() string {
- if x != nil {
- if x, ok := x.Result.(*RebaseBranchResponse_ConflictSchema); ok {
- return x.ConflictSchema
- }
- }
- return ""
-}
-
-type isRebaseBranchResponse_Result interface {
- isRebaseBranchResponse_Result()
-}
-
-type RebaseBranchResponse_Branch struct {
- // The rebased branch when rebase occurs seamlessly.
- Branch *Branch `protobuf:"bytes,1,opt,name=branch,proto3,oneof"`
-}
-
-type RebaseBranchResponse_ConflictSchema struct {
- // The conflict schema when rebase has conflicts.
- // The conflict section is enclosed by the following.
- // <<<<< HEAD
- // ====
- // >>>>> main
- ConflictSchema string `protobuf:"bytes,2,opt,name=conflict_schema,json=conflictSchema,proto3,oneof"`
-}
-
-func (*RebaseBranchResponse_Branch) isRebaseBranchResponse_Result() {}
-
-func (*RebaseBranchResponse_ConflictSchema) isRebaseBranchResponse_Result() {}
-
-type DeleteBranchRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The name of the branch to delete.
- // Format: projects/{project}/branches/{branch}
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- // By default, server will return `FAILED_PRECONDITION` error
- // if delete the branch that is parent of other branches.
- // If true, server will delete the branch forcely but will not delete its children branches.
- Force bool `protobuf:"varint,2,opt,name=force,proto3" json:"force,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *DeleteBranchRequest) Reset() {
- *x = DeleteBranchRequest{}
- mi := &file_v1_branch_service_proto_msgTypes[9]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *DeleteBranchRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*DeleteBranchRequest) ProtoMessage() {}
-
-func (x *DeleteBranchRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_branch_service_proto_msgTypes[9]
- 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 DeleteBranchRequest.ProtoReflect.Descriptor instead.
-func (*DeleteBranchRequest) Descriptor() ([]byte, []int) {
- return file_v1_branch_service_proto_rawDescGZIP(), []int{9}
-}
-
-func (x *DeleteBranchRequest) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-func (x *DeleteBranchRequest) GetForce() bool {
- if x != nil {
- return x.Force
- }
- return false
-}
-
-type DiffDatabaseRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The name of branch.
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- // The name of the databsae to merge the branch to.
- Database string `protobuf:"bytes,2,opt,name=database,proto3" json:"database,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *DiffDatabaseRequest) Reset() {
- *x = DiffDatabaseRequest{}
- mi := &file_v1_branch_service_proto_msgTypes[10]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *DiffDatabaseRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*DiffDatabaseRequest) ProtoMessage() {}
-
-func (x *DiffDatabaseRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_branch_service_proto_msgTypes[10]
- 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 DiffDatabaseRequest.ProtoReflect.Descriptor instead.
-func (*DiffDatabaseRequest) Descriptor() ([]byte, []int) {
- return file_v1_branch_service_proto_rawDescGZIP(), []int{10}
-}
-
-func (x *DiffDatabaseRequest) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-func (x *DiffDatabaseRequest) GetDatabase() string {
- if x != nil {
- return x.Database
- }
- return ""
-}
-
-type DiffDatabaseResponse struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The schema diff when merge occurs seamlessly.
- Diff string `protobuf:"bytes,1,opt,name=diff,proto3" json:"diff,omitempty"`
- // Types that are valid to be assigned to Result:
- //
- // *DiffDatabaseResponse_Schema
- // *DiffDatabaseResponse_ConflictSchema
- Result isDiffDatabaseResponse_Result `protobuf_oneof:"result"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *DiffDatabaseResponse) Reset() {
- *x = DiffDatabaseResponse{}
- mi := &file_v1_branch_service_proto_msgTypes[11]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *DiffDatabaseResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*DiffDatabaseResponse) ProtoMessage() {}
-
-func (x *DiffDatabaseResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_branch_service_proto_msgTypes[11]
- 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 DiffDatabaseResponse.ProtoReflect.Descriptor instead.
-func (*DiffDatabaseResponse) Descriptor() ([]byte, []int) {
- return file_v1_branch_service_proto_rawDescGZIP(), []int{11}
-}
-
-func (x *DiffDatabaseResponse) GetDiff() string {
- if x != nil {
- return x.Diff
- }
- return ""
-}
-
-func (x *DiffDatabaseResponse) GetResult() isDiffDatabaseResponse_Result {
- if x != nil {
- return x.Result
- }
- return nil
-}
-
-func (x *DiffDatabaseResponse) GetSchema() string {
- if x != nil {
- if x, ok := x.Result.(*DiffDatabaseResponse_Schema); ok {
- return x.Schema
- }
- }
- return ""
-}
-
-func (x *DiffDatabaseResponse) GetConflictSchema() string {
- if x != nil {
- if x, ok := x.Result.(*DiffDatabaseResponse_ConflictSchema); ok {
- return x.ConflictSchema
- }
- }
- return ""
-}
-
-type isDiffDatabaseResponse_Result interface {
- isDiffDatabaseResponse_Result()
-}
-
-type DiffDatabaseResponse_Schema struct {
- // The merged schema if there is no conflict.
- Schema string `protobuf:"bytes,2,opt,name=schema,proto3,oneof"`
-}
-
-type DiffDatabaseResponse_ConflictSchema struct {
- // The conflict schema when rebase has conflicts.
- // The conflict section is enclosed by the following.
- // <<<<< HEAD
- // ====
- // >>>>> main
- ConflictSchema string `protobuf:"bytes,3,opt,name=conflict_schema,json=conflictSchema,proto3,oneof"`
-}
-
-func (*DiffDatabaseResponse_Schema) isDiffDatabaseResponse_Result() {}
-
-func (*DiffDatabaseResponse_ConflictSchema) isDiffDatabaseResponse_Result() {}
-
type DiffMetadataRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The metadata of the source schema.
@@ -1059,7 +37,7 @@ type DiffMetadataRequest struct {
func (x *DiffMetadataRequest) Reset() {
*x = DiffMetadataRequest{}
- mi := &file_v1_branch_service_proto_msgTypes[12]
+ mi := &file_v1_branch_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1071,7 +49,7 @@ func (x *DiffMetadataRequest) String() string {
func (*DiffMetadataRequest) ProtoMessage() {}
func (x *DiffMetadataRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_branch_service_proto_msgTypes[12]
+ mi := &file_v1_branch_service_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1084,7 +62,7 @@ func (x *DiffMetadataRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DiffMetadataRequest.ProtoReflect.Descriptor instead.
func (*DiffMetadataRequest) Descriptor() ([]byte, []int) {
- return file_v1_branch_service_proto_rawDescGZIP(), []int{12}
+ return file_v1_branch_service_proto_rawDescGZIP(), []int{0}
}
func (x *DiffMetadataRequest) GetSourceMetadata() *DatabaseMetadata {
@@ -1125,7 +103,7 @@ type DiffMetadataResponse struct {
func (x *DiffMetadataResponse) Reset() {
*x = DiffMetadataResponse{}
- mi := &file_v1_branch_service_proto_msgTypes[13]
+ mi := &file_v1_branch_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1137,7 +115,7 @@ func (x *DiffMetadataResponse) String() string {
func (*DiffMetadataResponse) ProtoMessage() {}
func (x *DiffMetadataResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_branch_service_proto_msgTypes[13]
+ mi := &file_v1_branch_service_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1150,7 +128,7 @@ func (x *DiffMetadataResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use DiffMetadataResponse.ProtoReflect.Descriptor instead.
func (*DiffMetadataResponse) Descriptor() ([]byte, []int) {
- return file_v1_branch_service_proto_rawDescGZIP(), []int{13}
+ return file_v1_branch_service_proto_rawDescGZIP(), []int{1}
}
func (x *DiffMetadataResponse) GetDiff() string {
@@ -1167,271 +145,45 @@ var file_v1_branch_service_proto_rawDesc = []byte{
0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x62,
0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61,
0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70,
- 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69,
- 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67,
- 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f,
- 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19,
- 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75,
- 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
- 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79,
- 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70,
- 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61,
- 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
- 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74,
- 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x76, 0x31, 0x2f, 0x61, 0x6e,
- 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f,
- 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
- 0x19, 0x76, 0x31, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x73, 0x65, 0x72,
- 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd2, 0x05, 0x0a, 0x06, 0x42,
- 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x72, 0x61,
- 0x6e, 0x63, 0x68, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x72,
- 0x61, 0x6e, 0x63, 0x68, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61,
- 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x06, 0x73, 0x63,
- 0x68, 0x65, 0x6d, 0x61, 0x12, 0x46, 0x0a, 0x0f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x6d,
- 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e,
- 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x61, 0x74, 0x61,
- 0x62, 0x61, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x0e, 0x73, 0x63,
- 0x68, 0x65, 0x6d, 0x61, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2d, 0x0a, 0x0f,
- 0x62, 0x61, 0x73, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18,
- 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x0e, 0x62, 0x61, 0x73,
- 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x5d, 0x0a, 0x18, 0x62,
- 0x61, 0x73, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x6d,
- 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e,
- 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x61, 0x74, 0x61,
- 0x62, 0x61, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x04, 0xe2, 0x41,
- 0x01, 0x03, 0x52, 0x16, 0x62, 0x61, 0x73, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x63, 0x68, 0x65,
- 0x6d, 0x61, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2b, 0x0a, 0x06, 0x65, 0x6e,
- 0x67, 0x69, 0x6e, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x62, 0x79, 0x74,
+ 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69,
+ 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x76, 0x31, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x76, 0x31, 0x2f, 0x63,
+ 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x76, 0x31, 0x2f,
+ 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9c, 0x02, 0x0a, 0x13, 0x44, 0x69, 0x66, 0x66, 0x4d,
+ 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4c,
+ 0x0a, 0x0f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
+ 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
+ 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x4d, 0x65,
+ 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x0e, 0x73, 0x6f,
+ 0x75, 0x72, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x4c, 0x0a, 0x0f,
+ 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,
+ 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61,
+ 0x64, 0x61, 0x74, 0x61, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x0e, 0x74, 0x61, 0x72, 0x67,
+ 0x65, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2b, 0x0a, 0x06, 0x65, 0x6e,
+ 0x67, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x62, 0x79, 0x74,
0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x52,
- 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, 0x31, 0x0a, 0x11, 0x62, 0x61, 0x73, 0x65, 0x6c,
- 0x69, 0x6e, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x08, 0x20, 0x01,
- 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x05, 0x52, 0x10, 0x62, 0x61, 0x73, 0x65, 0x6c, 0x69,
- 0x6e, 0x65, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x0d, 0x70, 0x61,
- 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x09, 0x20, 0x01, 0x28,
- 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x05, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x42,
- 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x65, 0x74, 0x61, 0x67, 0x18, 0x0a, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x04, 0x65, 0x74, 0x61, 0x67, 0x12, 0x1e, 0x0a, 0x07, 0x63, 0x72, 0x65,
- 0x61, 0x74, 0x6f, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03,
- 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x1e, 0x0a, 0x07, 0x75, 0x70, 0x64,
- 0x61, 0x74, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03,
- 0x52, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x72, 0x12, 0x41, 0x0a, 0x0b, 0x63, 0x72, 0x65,
- 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a,
- 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
- 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03,
- 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x41, 0x0a, 0x0b,
- 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28,
- 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
- 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x04, 0xe2,
- 0x41, 0x01, 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x3a,
- 0x3e, 0xea, 0x41, 0x3b, 0x0a, 0x13, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x63,
- 0x6f, 0x6d, 0x2f, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x24, 0x70, 0x72, 0x6f, 0x6a, 0x65,
- 0x63, 0x74, 0x73, 0x2f, 0x7b, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x7d, 0x2f, 0x62, 0x72,
- 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x2f, 0x7b, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x7d, 0x22,
- 0x44, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75,
- 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
- 0x09, 0x42, 0x1c, 0xe2, 0x41, 0x01, 0x02, 0xfa, 0x41, 0x15, 0x0a, 0x13, 0x62, 0x79, 0x74, 0x65,
- 0x62, 0x61, 0x73, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52,
- 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xcd, 0x01, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x72,
- 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a,
- 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1d, 0xe2,
- 0x41, 0x01, 0x02, 0xfa, 0x41, 0x16, 0x0a, 0x14, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,
- 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x06, 0x70, 0x61,
- 0x72, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x02,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09,
- 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
- 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67,
- 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70,
- 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2b, 0x0a, 0x04, 0x76, 0x69, 0x65, 0x77,
- 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x56, 0x69, 0x65, 0x77, 0x52,
- 0x04, 0x76, 0x69, 0x65, 0x77, 0x22, 0x6f, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x72, 0x61,
- 0x6e, 0x63, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a,
- 0x08, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
- 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x72,
- 0x61, 0x6e, 0x63, 0x68, 0x52, 0x08, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x12, 0x26,
- 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65,
- 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67,
- 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x95, 0x01, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74,
- 0x65, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34,
- 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1c,
- 0xe2, 0x41, 0x01, 0x02, 0xfa, 0x41, 0x15, 0x0a, 0x13, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
- 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x06, 0x70, 0x61,
- 0x72, 0x65, 0x6e, 0x74, 0x12, 0x2b, 0x0a, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x02,
- 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,
- 0x76, 0x31, 0x2e, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63,
- 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x5f, 0x69, 0x64, 0x18, 0x03,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x49, 0x64, 0x22, 0x99,
- 0x01, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52,
- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x31, 0x0a, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68,
- 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x42, 0x04, 0xe2, 0x41, 0x01,
- 0x02, 0x52, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64,
- 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a,
- 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
- 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61,
- 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x65, 0x74, 0x61, 0x67, 0x18, 0x03,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x65, 0x74, 0x61, 0x67, 0x22, 0xa6, 0x01, 0x0a, 0x12, 0x4d,
- 0x65, 0x72, 0x67, 0x65, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
- 0x74, 0x12, 0x30, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42,
- 0x1c, 0xe2, 0x41, 0x01, 0x02, 0xfa, 0x41, 0x15, 0x0a, 0x13, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
- 0x73, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x04, 0x6e,
- 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x5f, 0x62, 0x72, 0x61, 0x6e,
- 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x42, 0x72,
- 0x61, 0x6e, 0x63, 0x68, 0x12, 0x18, 0x0a, 0x04, 0x65, 0x74, 0x61, 0x67, 0x18, 0x03, 0x20, 0x01,
- 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x01, 0x52, 0x04, 0x65, 0x74, 0x61, 0x67, 0x12, 0x23,
- 0x0a, 0x0d, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18,
- 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x4f,
- 0x6e, 0x6c, 0x79, 0x22, 0xf3, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x62, 0x61, 0x73, 0x65, 0x42, 0x72,
- 0x61, 0x6e, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x6e,
- 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1c, 0xe2, 0x41, 0x01, 0x02, 0xfa,
- 0x41, 0x15, 0x0a, 0x13, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x63, 0x6f, 0x6d,
- 0x2f, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a,
- 0x0f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65,
- 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 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, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73,
- 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x6d,
- 0x65, 0x72, 0x67, 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x04, 0x20, 0x01,
- 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61,
- 0x12, 0x12, 0x0a, 0x04, 0x65, 0x74, 0x61, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
- 0x65, 0x74, 0x61, 0x67, 0x12, 0x23, 0x0a, 0x0d, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65,
- 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x76, 0x61, 0x6c,
- 0x69, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x6e, 0x6c, 0x79, 0x22, 0x7a, 0x0a, 0x14, 0x52, 0x65, 0x62,
- 0x61, 0x73, 0x65, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
- 0x65, 0x12, 0x2d, 0x0a, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28,
- 0x0b, 0x32, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
- 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x48, 0x00, 0x52, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68,
- 0x12, 0x29, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x5f, 0x73, 0x63, 0x68,
- 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0e, 0x63, 0x6f, 0x6e,
- 0x66, 0x6c, 0x69, 0x63, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x42, 0x08, 0x0a, 0x06, 0x72,
- 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x5d, 0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42,
- 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x04,
- 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1c, 0xe2, 0x41, 0x01, 0x02,
- 0xfa, 0x41, 0x15, 0x0a, 0x13, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x63, 0x6f,
- 0x6d, 0x2f, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14,
- 0x0a, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x66,
- 0x6f, 0x72, 0x63, 0x65, 0x22, 0x69, 0x0a, 0x13, 0x44, 0x69, 0x66, 0x66, 0x44, 0x61, 0x74, 0x61,
- 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x6e,
- 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1c, 0xe2, 0x41, 0x01, 0x02, 0xfa,
- 0x41, 0x15, 0x0a, 0x13, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x63, 0x6f, 0x6d,
- 0x2f, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a,
- 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42,
- 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x22,
- 0x79, 0x0a, 0x14, 0x44, 0x69, 0x66, 0x66, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52,
- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x69, 0x66, 0x66, 0x18,
- 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x69, 0x66, 0x66, 0x12, 0x18, 0x0a, 0x06, 0x73,
- 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x73,
- 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x29, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63,
- 0x74, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00,
- 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61,
- 0x42, 0x08, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x9c, 0x02, 0x0a, 0x13, 0x44,
- 0x69, 0x66, 0x66, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65,
- 0x73, 0x74, 0x12, 0x4c, 0x0a, 0x0f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74,
- 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x79,
- 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61,
- 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02,
- 0x52, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
- 0x12, 0x4c, 0x0a, 0x0f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64,
- 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65,
- 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65,
- 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x0e,
- 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2b,
- 0x0a, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13,
- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x67,
- 0x69, 0x6e, 0x65, 0x52, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, 0x3c, 0x0a, 0x1a, 0x63,
- 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x72,
- 0x6f, 0x6d, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52,
- 0x18, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46,
- 0x72, 0x6f, 0x6d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x2a, 0x0a, 0x14, 0x44, 0x69, 0x66,
- 0x66, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
- 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x69, 0x66, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
- 0x04, 0x64, 0x69, 0x66, 0x66, 0x2a, 0x56, 0x0a, 0x0a, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x56,
- 0x69, 0x65, 0x77, 0x12, 0x1b, 0x0a, 0x17, 0x42, 0x52, 0x41, 0x4e, 0x43, 0x48, 0x5f, 0x56, 0x49,
- 0x45, 0x57, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00,
- 0x12, 0x15, 0x0a, 0x11, 0x42, 0x52, 0x41, 0x4e, 0x43, 0x48, 0x5f, 0x56, 0x49, 0x45, 0x57, 0x5f,
- 0x42, 0x41, 0x53, 0x49, 0x43, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x42, 0x52, 0x41, 0x4e, 0x43,
- 0x48, 0x5f, 0x56, 0x49, 0x45, 0x57, 0x5f, 0x46, 0x55, 0x4c, 0x4c, 0x10, 0x02, 0x32, 0xdf, 0x09,
- 0x0a, 0x0d, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
- 0x87, 0x01, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x1d, 0x2e,
- 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x42,
- 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x62,
- 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x72, 0x61, 0x6e, 0x63,
- 0x68, 0x22, 0x46, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x8a, 0xea, 0x30, 0x0f, 0x62, 0x62,
- 0x2e, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x2e, 0x67, 0x65, 0x74, 0x90, 0xea, 0x30,
- 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61,
- 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x62, 0x72,
- 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x98, 0x01, 0x0a, 0x0c, 0x4c, 0x69,
- 0x73, 0x74, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74,
- 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x72, 0x61,
- 0x6e, 0x63, 0x68, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62,
- 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42,
- 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
- 0x43, 0xda, 0x41, 0x00, 0x8a, 0xea, 0x30, 0x10, 0x62, 0x62, 0x2e, 0x62, 0x72, 0x61, 0x6e, 0x63,
- 0x68, 0x65, 0x73, 0x2e, 0x6c, 0x69, 0x73, 0x74, 0x90, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93,
- 0x02, 0x22, 0x12, 0x20, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d,
- 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x62, 0x72, 0x61, 0x6e,
- 0x63, 0x68, 0x65, 0x73, 0x12, 0x9f, 0x01, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42,
- 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,
- 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68,
- 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
- 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x22, 0x58, 0xda, 0x41,
- 0x0d, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x2c, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x8a, 0xea,
- 0x30, 0x12, 0x62, 0x62, 0x2e, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x2e, 0x63, 0x72,
- 0x65, 0x61, 0x74, 0x65, 0x90, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x3a, 0x06,
- 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x22, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72,
- 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f,
- 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0xad, 0x01, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74,
- 0x65, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
- 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x72, 0x61, 0x6e,
- 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65,
- 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x22, 0x66,
- 0xda, 0x41, 0x12, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
- 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x8a, 0xea, 0x30, 0x12, 0x62, 0x62, 0x2e, 0x62, 0x72, 0x61, 0x6e,
- 0x63, 0x68, 0x65, 0x73, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x90, 0xea, 0x30, 0x01, 0x82,
- 0xd3, 0xe4, 0x93, 0x02, 0x31, 0x3a, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x32, 0x27, 0x2f,
- 0x76, 0x31, 0x2f, 0x7b, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d,
- 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x62, 0x72, 0x61, 0x6e, 0x63,
- 0x68, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x94, 0x01, 0x0a, 0x0b, 0x4d, 0x65, 0x72, 0x67, 0x65,
- 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x72, 0x67, 0x65, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68,
- 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
- 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x22, 0x4f, 0xda, 0x41,
- 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x8a, 0xea, 0x30, 0x12, 0x62, 0x62, 0x2e, 0x62, 0x72, 0x61, 0x6e,
- 0x63, 0x68, 0x65, 0x73, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x90, 0xea, 0x30, 0x01, 0x82,
- 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x22, 0x26, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65,
- 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x62, 0x72, 0x61, 0x6e,
- 0x63, 0x68, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x12, 0xa5, 0x01,
- 0x0a, 0x0c, 0x52, 0x65, 0x62, 0x61, 0x73, 0x65, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x20,
- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x62,
- 0x61, 0x73, 0x65, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
- 0x1a, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52,
- 0x65, 0x62, 0x61, 0x73, 0x65, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f,
- 0x6e, 0x73, 0x65, 0x22, 0x50, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x8a, 0xea, 0x30, 0x12,
- 0x62, 0x62, 0x2e, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x2e, 0x75, 0x70, 0x64, 0x61,
- 0x74, 0x65, 0x90, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x22, 0x27, 0x2f, 0x76,
- 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73,
- 0x2f, 0x2a, 0x2f, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x72,
- 0x65, 0x62, 0x61, 0x73, 0x65, 0x12, 0x93, 0x01, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
- 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x72, 0x61, 0x6e, 0x63,
- 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
- 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79,
- 0x22, 0x49, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x8a, 0xea, 0x30, 0x12, 0x62, 0x62, 0x2e,
- 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x90,
- 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x2a, 0x20, 0x2f, 0x76, 0x31, 0x2f, 0x7b,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f,
- 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x81, 0x01, 0x0a, 0x0c,
- 0x44, 0x69, 0x66, 0x66, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x20, 0x2e, 0x62,
- 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x4d,
- 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21,
- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x66,
- 0x66, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
- 0x65, 0x22, 0x2c, 0x80, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x3a, 0x01, 0x2a,
- 0x22, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x65, 0x73, 0x69,
- 0x67, 0x6e, 0x3a, 0x64, 0x69, 0x66, 0x66, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42,
- 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f,
- 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, 0x3c, 0x0a, 0x1a, 0x63, 0x6c, 0x61, 0x73, 0x73,
+ 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x63,
+ 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, 0x63, 0x6c, 0x61,
+ 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x72, 0x6f, 0x6d, 0x43,
+ 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x2a, 0x0a, 0x14, 0x44, 0x69, 0x66, 0x66, 0x4d, 0x65, 0x74,
+ 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a,
+ 0x04, 0x64, 0x69, 0x66, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x69, 0x66,
+ 0x66, 0x32, 0x93, 0x01, 0x0a, 0x0d, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x53, 0x65, 0x72, 0x76,
+ 0x69, 0x63, 0x65, 0x12, 0x81, 0x01, 0x0a, 0x0c, 0x44, 0x69, 0x66, 0x66, 0x4d, 0x65, 0x74, 0x61,
+ 0x64, 0x61, 0x74, 0x61, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,
+ 0x76, 0x31, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52,
+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
+ 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0x80, 0xea, 0x30, 0x01, 0x82,
+ 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x3a, 0x01, 0x2a, 0x22, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x63,
+ 0x68, 0x65, 0x6d, 0x61, 0x44, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x3a, 0x64, 0x69, 0x66, 0x66, 0x4d,
+ 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72,
+ 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x33,
}
var (
@@ -1446,66 +198,24 @@ func file_v1_branch_service_proto_rawDescGZIP() []byte {
return file_v1_branch_service_proto_rawDescData
}
-var file_v1_branch_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_v1_branch_service_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
+var file_v1_branch_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_v1_branch_service_proto_goTypes = []any{
- (BranchView)(0), // 0: bytebase.v1.BranchView
- (*Branch)(nil), // 1: bytebase.v1.Branch
- (*GetBranchRequest)(nil), // 2: bytebase.v1.GetBranchRequest
- (*ListBranchesRequest)(nil), // 3: bytebase.v1.ListBranchesRequest
- (*ListBranchesResponse)(nil), // 4: bytebase.v1.ListBranchesResponse
- (*CreateBranchRequest)(nil), // 5: bytebase.v1.CreateBranchRequest
- (*UpdateBranchRequest)(nil), // 6: bytebase.v1.UpdateBranchRequest
- (*MergeBranchRequest)(nil), // 7: bytebase.v1.MergeBranchRequest
- (*RebaseBranchRequest)(nil), // 8: bytebase.v1.RebaseBranchRequest
- (*RebaseBranchResponse)(nil), // 9: bytebase.v1.RebaseBranchResponse
- (*DeleteBranchRequest)(nil), // 10: bytebase.v1.DeleteBranchRequest
- (*DiffDatabaseRequest)(nil), // 11: bytebase.v1.DiffDatabaseRequest
- (*DiffDatabaseResponse)(nil), // 12: bytebase.v1.DiffDatabaseResponse
- (*DiffMetadataRequest)(nil), // 13: bytebase.v1.DiffMetadataRequest
- (*DiffMetadataResponse)(nil), // 14: bytebase.v1.DiffMetadataResponse
- (*DatabaseMetadata)(nil), // 15: bytebase.v1.DatabaseMetadata
- (Engine)(0), // 16: bytebase.v1.Engine
- (*timestamppb.Timestamp)(nil), // 17: google.protobuf.Timestamp
- (*fieldmaskpb.FieldMask)(nil), // 18: google.protobuf.FieldMask
- (*emptypb.Empty)(nil), // 19: google.protobuf.Empty
+ (*DiffMetadataRequest)(nil), // 0: bytebase.v1.DiffMetadataRequest
+ (*DiffMetadataResponse)(nil), // 1: bytebase.v1.DiffMetadataResponse
+ (*DatabaseMetadata)(nil), // 2: bytebase.v1.DatabaseMetadata
+ (Engine)(0), // 3: bytebase.v1.Engine
}
var file_v1_branch_service_proto_depIdxs = []int32{
- 15, // 0: bytebase.v1.Branch.schema_metadata:type_name -> bytebase.v1.DatabaseMetadata
- 15, // 1: bytebase.v1.Branch.baseline_schema_metadata:type_name -> bytebase.v1.DatabaseMetadata
- 16, // 2: bytebase.v1.Branch.engine:type_name -> bytebase.v1.Engine
- 17, // 3: bytebase.v1.Branch.create_time:type_name -> google.protobuf.Timestamp
- 17, // 4: bytebase.v1.Branch.update_time:type_name -> google.protobuf.Timestamp
- 0, // 5: bytebase.v1.ListBranchesRequest.view:type_name -> bytebase.v1.BranchView
- 1, // 6: bytebase.v1.ListBranchesResponse.branches:type_name -> bytebase.v1.Branch
- 1, // 7: bytebase.v1.CreateBranchRequest.branch:type_name -> bytebase.v1.Branch
- 1, // 8: bytebase.v1.UpdateBranchRequest.branch:type_name -> bytebase.v1.Branch
- 18, // 9: bytebase.v1.UpdateBranchRequest.update_mask:type_name -> google.protobuf.FieldMask
- 1, // 10: bytebase.v1.RebaseBranchResponse.branch:type_name -> bytebase.v1.Branch
- 15, // 11: bytebase.v1.DiffMetadataRequest.source_metadata:type_name -> bytebase.v1.DatabaseMetadata
- 15, // 12: bytebase.v1.DiffMetadataRequest.target_metadata:type_name -> bytebase.v1.DatabaseMetadata
- 16, // 13: bytebase.v1.DiffMetadataRequest.engine:type_name -> bytebase.v1.Engine
- 2, // 14: bytebase.v1.BranchService.GetBranch:input_type -> bytebase.v1.GetBranchRequest
- 3, // 15: bytebase.v1.BranchService.ListBranches:input_type -> bytebase.v1.ListBranchesRequest
- 5, // 16: bytebase.v1.BranchService.CreateBranch:input_type -> bytebase.v1.CreateBranchRequest
- 6, // 17: bytebase.v1.BranchService.UpdateBranch:input_type -> bytebase.v1.UpdateBranchRequest
- 7, // 18: bytebase.v1.BranchService.MergeBranch:input_type -> bytebase.v1.MergeBranchRequest
- 8, // 19: bytebase.v1.BranchService.RebaseBranch:input_type -> bytebase.v1.RebaseBranchRequest
- 10, // 20: bytebase.v1.BranchService.DeleteBranch:input_type -> bytebase.v1.DeleteBranchRequest
- 13, // 21: bytebase.v1.BranchService.DiffMetadata:input_type -> bytebase.v1.DiffMetadataRequest
- 1, // 22: bytebase.v1.BranchService.GetBranch:output_type -> bytebase.v1.Branch
- 4, // 23: bytebase.v1.BranchService.ListBranches:output_type -> bytebase.v1.ListBranchesResponse
- 1, // 24: bytebase.v1.BranchService.CreateBranch:output_type -> bytebase.v1.Branch
- 1, // 25: bytebase.v1.BranchService.UpdateBranch:output_type -> bytebase.v1.Branch
- 1, // 26: bytebase.v1.BranchService.MergeBranch:output_type -> bytebase.v1.Branch
- 9, // 27: bytebase.v1.BranchService.RebaseBranch:output_type -> bytebase.v1.RebaseBranchResponse
- 19, // 28: bytebase.v1.BranchService.DeleteBranch:output_type -> google.protobuf.Empty
- 14, // 29: bytebase.v1.BranchService.DiffMetadata:output_type -> bytebase.v1.DiffMetadataResponse
- 22, // [22:30] is the sub-list for method output_type
- 14, // [14:22] is the sub-list for method input_type
- 14, // [14:14] is the sub-list for extension type_name
- 14, // [14:14] is the sub-list for extension extendee
- 0, // [0:14] is the sub-list for field type_name
+ 2, // 0: bytebase.v1.DiffMetadataRequest.source_metadata:type_name -> bytebase.v1.DatabaseMetadata
+ 2, // 1: bytebase.v1.DiffMetadataRequest.target_metadata:type_name -> bytebase.v1.DatabaseMetadata
+ 3, // 2: bytebase.v1.DiffMetadataRequest.engine:type_name -> bytebase.v1.Engine
+ 0, // 3: bytebase.v1.BranchService.DiffMetadata:input_type -> bytebase.v1.DiffMetadataRequest
+ 1, // 4: bytebase.v1.BranchService.DiffMetadata:output_type -> bytebase.v1.DiffMetadataResponse
+ 4, // [4:5] is the sub-list for method output_type
+ 3, // [3:4] is the sub-list for method input_type
+ 3, // [3:3] is the sub-list for extension type_name
+ 3, // [3:3] is the sub-list for extension extendee
+ 0, // [0:3] is the sub-list for field type_name
}
func init() { file_v1_branch_service_proto_init() }
@@ -1516,27 +226,18 @@ func file_v1_branch_service_proto_init() {
file_v1_annotation_proto_init()
file_v1_common_proto_init()
file_v1_database_service_proto_init()
- file_v1_branch_service_proto_msgTypes[8].OneofWrappers = []any{
- (*RebaseBranchResponse_Branch)(nil),
- (*RebaseBranchResponse_ConflictSchema)(nil),
- }
- file_v1_branch_service_proto_msgTypes[11].OneofWrappers = []any{
- (*DiffDatabaseResponse_Schema)(nil),
- (*DiffDatabaseResponse_ConflictSchema)(nil),
- }
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_v1_branch_service_proto_rawDesc,
- NumEnums: 1,
- NumMessages: 14,
+ NumEnums: 0,
+ NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_v1_branch_service_proto_goTypes,
DependencyIndexes: file_v1_branch_service_proto_depIdxs,
- EnumInfos: file_v1_branch_service_proto_enumTypes,
MessageInfos: file_v1_branch_service_proto_msgTypes,
}.Build()
File_v1_branch_service_proto = out.File
diff --git a/proto/generated-go/v1/branch_service.pb.gw.go b/proto/generated-go/v1/branch_service.pb.gw.go
index 4fbb3d9582..70646d9647 100644
--- a/proto/generated-go/v1/branch_service.pb.gw.go
+++ b/proto/generated-go/v1/branch_service.pb.gw.go
@@ -35,376 +35,6 @@ var (
_ = metadata.Join
)
-func request_BranchService_GetBranch_0(ctx context.Context, marshaler runtime.Marshaler, client BranchServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq GetBranchRequest
- metadata runtime.ServerMetadata
- err error
- )
- val, ok := pathParams["name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
- }
- protoReq.Name, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
- }
- msg, err := client.GetBranch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_BranchService_GetBranch_0(ctx context.Context, marshaler runtime.Marshaler, server BranchServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq GetBranchRequest
- metadata runtime.ServerMetadata
- err error
- )
- val, ok := pathParams["name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
- }
- protoReq.Name, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
- }
- msg, err := server.GetBranch(ctx, &protoReq)
- return msg, metadata, err
-}
-
-var filter_BranchService_ListBranches_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
-
-func request_BranchService_ListBranches_0(ctx context.Context, marshaler runtime.Marshaler, client BranchServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq ListBranchesRequest
- metadata runtime.ServerMetadata
- err error
- )
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BranchService_ListBranches_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := client.ListBranches(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_BranchService_ListBranches_0(ctx context.Context, marshaler runtime.Marshaler, server BranchServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq ListBranchesRequest
- metadata runtime.ServerMetadata
- err error
- )
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BranchService_ListBranches_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := server.ListBranches(ctx, &protoReq)
- return msg, metadata, err
-}
-
-var filter_BranchService_CreateBranch_0 = &utilities.DoubleArray{Encoding: map[string]int{"branch": 0, "parent": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}}
-
-func request_BranchService_CreateBranch_0(ctx context.Context, marshaler runtime.Marshaler, client BranchServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq CreateBranchRequest
- metadata runtime.ServerMetadata
- err error
- )
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Branch); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BranchService_CreateBranch_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := client.CreateBranch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_BranchService_CreateBranch_0(ctx context.Context, marshaler runtime.Marshaler, server BranchServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq CreateBranchRequest
- metadata runtime.ServerMetadata
- err error
- )
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Branch); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BranchService_CreateBranch_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := server.CreateBranch(ctx, &protoReq)
- return msg, metadata, err
-}
-
-var filter_BranchService_UpdateBranch_0 = &utilities.DoubleArray{Encoding: map[string]int{"branch": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}}
-
-func request_BranchService_UpdateBranch_0(ctx context.Context, marshaler runtime.Marshaler, client BranchServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq UpdateBranchRequest
- 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.Branch); 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.Branch); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- } else {
- protoReq.UpdateMask = fieldMask
- }
- }
- val, ok := pathParams["branch.name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "branch.name")
- }
- err = runtime.PopulateFieldFromPath(&protoReq, "branch.name", val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "branch.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_BranchService_UpdateBranch_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := client.UpdateBranch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_BranchService_UpdateBranch_0(ctx context.Context, marshaler runtime.Marshaler, server BranchServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq UpdateBranchRequest
- 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.Branch); 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.Branch); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- } else {
- protoReq.UpdateMask = fieldMask
- }
- }
- val, ok := pathParams["branch.name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "branch.name")
- }
- err = runtime.PopulateFieldFromPath(&protoReq, "branch.name", val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "branch.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_BranchService_UpdateBranch_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := server.UpdateBranch(ctx, &protoReq)
- return msg, metadata, err
-}
-
-var filter_BranchService_MergeBranch_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
-
-func request_BranchService_MergeBranch_0(ctx context.Context, marshaler runtime.Marshaler, client BranchServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq MergeBranchRequest
- metadata runtime.ServerMetadata
- err error
- )
- val, ok := pathParams["name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
- }
- protoReq.Name, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "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_BranchService_MergeBranch_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := client.MergeBranch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_BranchService_MergeBranch_0(ctx context.Context, marshaler runtime.Marshaler, server BranchServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq MergeBranchRequest
- metadata runtime.ServerMetadata
- err error
- )
- val, ok := pathParams["name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
- }
- protoReq.Name, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "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_BranchService_MergeBranch_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := server.MergeBranch(ctx, &protoReq)
- return msg, metadata, err
-}
-
-var filter_BranchService_RebaseBranch_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
-
-func request_BranchService_RebaseBranch_0(ctx context.Context, marshaler runtime.Marshaler, client BranchServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq RebaseBranchRequest
- metadata runtime.ServerMetadata
- err error
- )
- val, ok := pathParams["name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
- }
- protoReq.Name, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "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_BranchService_RebaseBranch_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := client.RebaseBranch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_BranchService_RebaseBranch_0(ctx context.Context, marshaler runtime.Marshaler, server BranchServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq RebaseBranchRequest
- metadata runtime.ServerMetadata
- err error
- )
- val, ok := pathParams["name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
- }
- protoReq.Name, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "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_BranchService_RebaseBranch_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := server.RebaseBranch(ctx, &protoReq)
- return msg, metadata, err
-}
-
-var filter_BranchService_DeleteBranch_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
-
-func request_BranchService_DeleteBranch_0(ctx context.Context, marshaler runtime.Marshaler, client BranchServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq DeleteBranchRequest
- metadata runtime.ServerMetadata
- err error
- )
- val, ok := pathParams["name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
- }
- protoReq.Name, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "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_BranchService_DeleteBranch_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := client.DeleteBranch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_BranchService_DeleteBranch_0(ctx context.Context, marshaler runtime.Marshaler, server BranchServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq DeleteBranchRequest
- metadata runtime.ServerMetadata
- err error
- )
- val, ok := pathParams["name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
- }
- protoReq.Name, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "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_BranchService_DeleteBranch_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := server.DeleteBranch(ctx, &protoReq)
- return msg, metadata, err
-}
-
func request_BranchService_DiffMetadata_0(ctx context.Context, marshaler runtime.Marshaler, client BranchServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq DiffMetadataRequest
@@ -435,146 +65,6 @@ func local_request_BranchService_DiffMetadata_0(ctx context.Context, marshaler r
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterBranchServiceHandlerFromEndpoint instead.
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterBranchServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BranchServiceServer) error {
- mux.Handle(http.MethodGet, pattern_BranchService_GetBranch_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.BranchService/GetBranch", runtime.WithHTTPPathPattern("/v1/{name=projects/*/branches/*}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_BranchService_GetBranch_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_BranchService_GetBranch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodGet, pattern_BranchService_ListBranches_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.BranchService/ListBranches", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/branches"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_BranchService_ListBranches_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_BranchService_ListBranches_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodPost, pattern_BranchService_CreateBranch_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.BranchService/CreateBranch", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/branch"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_BranchService_CreateBranch_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_BranchService_CreateBranch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodPatch, pattern_BranchService_UpdateBranch_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.BranchService/UpdateBranch", runtime.WithHTTPPathPattern("/v1/{branch.name=projects/*/branches/*}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_BranchService_UpdateBranch_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_BranchService_UpdateBranch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodPost, pattern_BranchService_MergeBranch_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.BranchService/MergeBranch", runtime.WithHTTPPathPattern("/v1/{name=projects/*/branches/*}:merge"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_BranchService_MergeBranch_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_BranchService_MergeBranch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodPost, pattern_BranchService_RebaseBranch_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.BranchService/RebaseBranch", runtime.WithHTTPPathPattern("/v1/{name=projects/*/branches/*}:rebase"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_BranchService_RebaseBranch_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_BranchService_RebaseBranch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodDelete, pattern_BranchService_DeleteBranch_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.BranchService/DeleteBranch", runtime.WithHTTPPathPattern("/v1/{name=projects/*/branches/*}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_BranchService_DeleteBranch_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_BranchService_DeleteBranch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
mux.Handle(http.MethodPost, pattern_BranchService_DiffMetadata_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -635,125 +125,6 @@ func RegisterBranchServiceHandler(ctx context.Context, mux *runtime.ServeMux, co
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "BranchServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterBranchServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BranchServiceClient) error {
- mux.Handle(http.MethodGet, pattern_BranchService_GetBranch_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.BranchService/GetBranch", runtime.WithHTTPPathPattern("/v1/{name=projects/*/branches/*}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_BranchService_GetBranch_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_BranchService_GetBranch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodGet, pattern_BranchService_ListBranches_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.BranchService/ListBranches", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/branches"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_BranchService_ListBranches_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_BranchService_ListBranches_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodPost, pattern_BranchService_CreateBranch_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.BranchService/CreateBranch", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/branch"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_BranchService_CreateBranch_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_BranchService_CreateBranch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodPatch, pattern_BranchService_UpdateBranch_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.BranchService/UpdateBranch", runtime.WithHTTPPathPattern("/v1/{branch.name=projects/*/branches/*}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_BranchService_UpdateBranch_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_BranchService_UpdateBranch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodPost, pattern_BranchService_MergeBranch_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.BranchService/MergeBranch", runtime.WithHTTPPathPattern("/v1/{name=projects/*/branches/*}:merge"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_BranchService_MergeBranch_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_BranchService_MergeBranch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodPost, pattern_BranchService_RebaseBranch_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.BranchService/RebaseBranch", runtime.WithHTTPPathPattern("/v1/{name=projects/*/branches/*}:rebase"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_BranchService_RebaseBranch_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_BranchService_RebaseBranch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodDelete, pattern_BranchService_DeleteBranch_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.BranchService/DeleteBranch", runtime.WithHTTPPathPattern("/v1/{name=projects/*/branches/*}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_BranchService_DeleteBranch_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_BranchService_DeleteBranch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
mux.Handle(http.MethodPost, pattern_BranchService_DiffMetadata_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -775,23 +146,9 @@ func RegisterBranchServiceHandlerClient(ctx context.Context, mux *runtime.ServeM
}
var (
- pattern_BranchService_GetBranch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "branches", "name"}, ""))
- pattern_BranchService_ListBranches_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "branches"}, ""))
- pattern_BranchService_CreateBranch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "branch"}, ""))
- pattern_BranchService_UpdateBranch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "branches", "branch.name"}, ""))
- pattern_BranchService_MergeBranch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "branches", "name"}, "merge"))
- pattern_BranchService_RebaseBranch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "branches", "name"}, "rebase"))
- pattern_BranchService_DeleteBranch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "branches", "name"}, ""))
pattern_BranchService_DiffMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "schemaDesign"}, "diffMetadata"))
)
var (
- forward_BranchService_GetBranch_0 = runtime.ForwardResponseMessage
- forward_BranchService_ListBranches_0 = runtime.ForwardResponseMessage
- forward_BranchService_CreateBranch_0 = runtime.ForwardResponseMessage
- forward_BranchService_UpdateBranch_0 = runtime.ForwardResponseMessage
- forward_BranchService_MergeBranch_0 = runtime.ForwardResponseMessage
- forward_BranchService_RebaseBranch_0 = runtime.ForwardResponseMessage
- forward_BranchService_DeleteBranch_0 = runtime.ForwardResponseMessage
forward_BranchService_DiffMetadata_0 = runtime.ForwardResponseMessage
)
diff --git a/proto/generated-go/v1/branch_service_grpc.pb.go b/proto/generated-go/v1/branch_service_grpc.pb.go
index e5c4cee320..d36c1fcbed 100644
--- a/proto/generated-go/v1/branch_service_grpc.pb.go
+++ b/proto/generated-go/v1/branch_service_grpc.pb.go
@@ -11,7 +11,6 @@ import (
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
- emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
@@ -20,13 +19,6 @@ import (
const _ = grpc.SupportPackageIsVersion9
const (
- BranchService_GetBranch_FullMethodName = "/bytebase.v1.BranchService/GetBranch"
- BranchService_ListBranches_FullMethodName = "/bytebase.v1.BranchService/ListBranches"
- BranchService_CreateBranch_FullMethodName = "/bytebase.v1.BranchService/CreateBranch"
- BranchService_UpdateBranch_FullMethodName = "/bytebase.v1.BranchService/UpdateBranch"
- BranchService_MergeBranch_FullMethodName = "/bytebase.v1.BranchService/MergeBranch"
- BranchService_RebaseBranch_FullMethodName = "/bytebase.v1.BranchService/RebaseBranch"
- BranchService_DeleteBranch_FullMethodName = "/bytebase.v1.BranchService/DeleteBranch"
BranchService_DiffMetadata_FullMethodName = "/bytebase.v1.BranchService/DiffMetadata"
)
@@ -34,13 +26,6 @@ const (
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type BranchServiceClient interface {
- GetBranch(ctx context.Context, in *GetBranchRequest, opts ...grpc.CallOption) (*Branch, error)
- ListBranches(ctx context.Context, in *ListBranchesRequest, opts ...grpc.CallOption) (*ListBranchesResponse, error)
- CreateBranch(ctx context.Context, in *CreateBranchRequest, opts ...grpc.CallOption) (*Branch, error)
- UpdateBranch(ctx context.Context, in *UpdateBranchRequest, opts ...grpc.CallOption) (*Branch, error)
- MergeBranch(ctx context.Context, in *MergeBranchRequest, opts ...grpc.CallOption) (*Branch, error)
- RebaseBranch(ctx context.Context, in *RebaseBranchRequest, opts ...grpc.CallOption) (*RebaseBranchResponse, error)
- DeleteBranch(ctx context.Context, in *DeleteBranchRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
DiffMetadata(ctx context.Context, in *DiffMetadataRequest, opts ...grpc.CallOption) (*DiffMetadataResponse, error)
}
@@ -52,76 +37,6 @@ func NewBranchServiceClient(cc grpc.ClientConnInterface) BranchServiceClient {
return &branchServiceClient{cc}
}
-func (c *branchServiceClient) GetBranch(ctx context.Context, in *GetBranchRequest, opts ...grpc.CallOption) (*Branch, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(Branch)
- err := c.cc.Invoke(ctx, BranchService_GetBranch_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *branchServiceClient) ListBranches(ctx context.Context, in *ListBranchesRequest, opts ...grpc.CallOption) (*ListBranchesResponse, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(ListBranchesResponse)
- err := c.cc.Invoke(ctx, BranchService_ListBranches_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *branchServiceClient) CreateBranch(ctx context.Context, in *CreateBranchRequest, opts ...grpc.CallOption) (*Branch, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(Branch)
- err := c.cc.Invoke(ctx, BranchService_CreateBranch_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *branchServiceClient) UpdateBranch(ctx context.Context, in *UpdateBranchRequest, opts ...grpc.CallOption) (*Branch, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(Branch)
- err := c.cc.Invoke(ctx, BranchService_UpdateBranch_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *branchServiceClient) MergeBranch(ctx context.Context, in *MergeBranchRequest, opts ...grpc.CallOption) (*Branch, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(Branch)
- err := c.cc.Invoke(ctx, BranchService_MergeBranch_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *branchServiceClient) RebaseBranch(ctx context.Context, in *RebaseBranchRequest, opts ...grpc.CallOption) (*RebaseBranchResponse, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(RebaseBranchResponse)
- err := c.cc.Invoke(ctx, BranchService_RebaseBranch_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *branchServiceClient) DeleteBranch(ctx context.Context, in *DeleteBranchRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(emptypb.Empty)
- err := c.cc.Invoke(ctx, BranchService_DeleteBranch_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
func (c *branchServiceClient) DiffMetadata(ctx context.Context, in *DiffMetadataRequest, opts ...grpc.CallOption) (*DiffMetadataResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DiffMetadataResponse)
@@ -136,13 +51,6 @@ func (c *branchServiceClient) DiffMetadata(ctx context.Context, in *DiffMetadata
// All implementations must embed UnimplementedBranchServiceServer
// for forward compatibility.
type BranchServiceServer interface {
- GetBranch(context.Context, *GetBranchRequest) (*Branch, error)
- ListBranches(context.Context, *ListBranchesRequest) (*ListBranchesResponse, error)
- CreateBranch(context.Context, *CreateBranchRequest) (*Branch, error)
- UpdateBranch(context.Context, *UpdateBranchRequest) (*Branch, error)
- MergeBranch(context.Context, *MergeBranchRequest) (*Branch, error)
- RebaseBranch(context.Context, *RebaseBranchRequest) (*RebaseBranchResponse, error)
- DeleteBranch(context.Context, *DeleteBranchRequest) (*emptypb.Empty, error)
DiffMetadata(context.Context, *DiffMetadataRequest) (*DiffMetadataResponse, error)
mustEmbedUnimplementedBranchServiceServer()
}
@@ -154,27 +62,6 @@ type BranchServiceServer interface {
// pointer dereference when methods are called.
type UnimplementedBranchServiceServer struct{}
-func (UnimplementedBranchServiceServer) GetBranch(context.Context, *GetBranchRequest) (*Branch, error) {
- return nil, status.Errorf(codes.Unimplemented, "method GetBranch not implemented")
-}
-func (UnimplementedBranchServiceServer) ListBranches(context.Context, *ListBranchesRequest) (*ListBranchesResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method ListBranches not implemented")
-}
-func (UnimplementedBranchServiceServer) CreateBranch(context.Context, *CreateBranchRequest) (*Branch, error) {
- return nil, status.Errorf(codes.Unimplemented, "method CreateBranch not implemented")
-}
-func (UnimplementedBranchServiceServer) UpdateBranch(context.Context, *UpdateBranchRequest) (*Branch, error) {
- return nil, status.Errorf(codes.Unimplemented, "method UpdateBranch not implemented")
-}
-func (UnimplementedBranchServiceServer) MergeBranch(context.Context, *MergeBranchRequest) (*Branch, error) {
- return nil, status.Errorf(codes.Unimplemented, "method MergeBranch not implemented")
-}
-func (UnimplementedBranchServiceServer) RebaseBranch(context.Context, *RebaseBranchRequest) (*RebaseBranchResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method RebaseBranch not implemented")
-}
-func (UnimplementedBranchServiceServer) DeleteBranch(context.Context, *DeleteBranchRequest) (*emptypb.Empty, error) {
- return nil, status.Errorf(codes.Unimplemented, "method DeleteBranch not implemented")
-}
func (UnimplementedBranchServiceServer) DiffMetadata(context.Context, *DiffMetadataRequest) (*DiffMetadataResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DiffMetadata not implemented")
}
@@ -199,132 +86,6 @@ func RegisterBranchServiceServer(s grpc.ServiceRegistrar, srv BranchServiceServe
s.RegisterService(&BranchService_ServiceDesc, srv)
}
-func _BranchService_GetBranch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(GetBranchRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(BranchServiceServer).GetBranch(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: BranchService_GetBranch_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(BranchServiceServer).GetBranch(ctx, req.(*GetBranchRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _BranchService_ListBranches_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(ListBranchesRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(BranchServiceServer).ListBranches(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: BranchService_ListBranches_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(BranchServiceServer).ListBranches(ctx, req.(*ListBranchesRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _BranchService_CreateBranch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(CreateBranchRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(BranchServiceServer).CreateBranch(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: BranchService_CreateBranch_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(BranchServiceServer).CreateBranch(ctx, req.(*CreateBranchRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _BranchService_UpdateBranch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(UpdateBranchRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(BranchServiceServer).UpdateBranch(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: BranchService_UpdateBranch_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(BranchServiceServer).UpdateBranch(ctx, req.(*UpdateBranchRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _BranchService_MergeBranch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(MergeBranchRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(BranchServiceServer).MergeBranch(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: BranchService_MergeBranch_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(BranchServiceServer).MergeBranch(ctx, req.(*MergeBranchRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _BranchService_RebaseBranch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(RebaseBranchRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(BranchServiceServer).RebaseBranch(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: BranchService_RebaseBranch_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(BranchServiceServer).RebaseBranch(ctx, req.(*RebaseBranchRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _BranchService_DeleteBranch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(DeleteBranchRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(BranchServiceServer).DeleteBranch(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: BranchService_DeleteBranch_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(BranchServiceServer).DeleteBranch(ctx, req.(*DeleteBranchRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
func _BranchService_DiffMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DiffMetadataRequest)
if err := dec(in); err != nil {
@@ -350,34 +111,6 @@ var BranchService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "bytebase.v1.BranchService",
HandlerType: (*BranchServiceServer)(nil),
Methods: []grpc.MethodDesc{
- {
- MethodName: "GetBranch",
- Handler: _BranchService_GetBranch_Handler,
- },
- {
- MethodName: "ListBranches",
- Handler: _BranchService_ListBranches_Handler,
- },
- {
- MethodName: "CreateBranch",
- Handler: _BranchService_CreateBranch_Handler,
- },
- {
- MethodName: "UpdateBranch",
- Handler: _BranchService_UpdateBranch_Handler,
- },
- {
- MethodName: "MergeBranch",
- Handler: _BranchService_MergeBranch_Handler,
- },
- {
- MethodName: "RebaseBranch",
- Handler: _BranchService_RebaseBranch_Handler,
- },
- {
- MethodName: "DeleteBranch",
- Handler: _BranchService_DeleteBranch_Handler,
- },
{
MethodName: "DiffMetadata",
Handler: _BranchService_DiffMetadata_Handler,
diff --git a/proto/store/branch.proto b/proto/store/branch.proto
deleted file mode 100644
index b56b3f3906..0000000000
--- a/proto/store/branch.proto
+++ /dev/null
@@ -1,23 +0,0 @@
-syntax = "proto3";
-
-package bytebase.store;
-
-import "store/database.proto";
-
-option go_package = "generated-go/store";
-
-message BranchSnapshot {
- DatabaseSchemaMetadata metadata = 1;
- DatabaseConfig database_config = 2;
-}
-
-message BranchConfig {
- // The name of source database.
- // Optional.
- // Example: instances/instance-id/databases/database-name.
- string source_database = 1;
- // The name of the source branch.
- // Optional.
- // Example: projects/project-id/branches/branch-id.
- string source_branch = 2;
-}
diff --git a/proto/v1/branch_service.proto b/proto/v1/branch_service.proto
index 5861065399..e5c7a50936 100644
--- a/proto/v1/branch_service.proto
+++ b/proto/v1/branch_service.proto
@@ -3,12 +3,7 @@ syntax = "proto3";
package bytebase.v1;
import "google/api/annotations.proto";
-import "google/api/client.proto";
import "google/api/field_behavior.proto";
-import "google/api/resource.proto";
-import "google/protobuf/empty.proto";
-import "google/protobuf/field_mask.proto";
-import "google/protobuf/timestamp.proto";
import "v1/annotation.proto";
import "v1/common.proto";
import "v1/database_service.proto";
@@ -16,61 +11,6 @@ import "v1/database_service.proto";
option go_package = "generated-go/v1";
service BranchService {
- rpc GetBranch(GetBranchRequest) returns (Branch) {
- option (google.api.http) = {get: "/v1/{name=projects/*/branches/*}"};
- option (google.api.method_signature) = "name";
- option (bytebase.v1.permission) = "bb.branches.get";
- option (bytebase.v1.auth_method) = IAM;
- }
-
- rpc ListBranches(ListBranchesRequest) returns (ListBranchesResponse) {
- option (google.api.http) = {get: "/v1/{parent=projects/*}/branches"};
- option (google.api.method_signature) = "";
- option (bytebase.v1.permission) = "bb.branches.list";
- option (bytebase.v1.auth_method) = IAM;
- }
-
- rpc CreateBranch(CreateBranchRequest) returns (Branch) {
- option (google.api.http) = {
- post: "/v1/{parent=projects/*}/branch"
- body: "branch"
- };
- option (google.api.method_signature) = "parent,branch";
- option (bytebase.v1.permission) = "bb.branches.create";
- option (bytebase.v1.auth_method) = IAM;
- }
-
- rpc UpdateBranch(UpdateBranchRequest) returns (Branch) {
- option (google.api.http) = {
- patch: "/v1/{branch.name=projects/*/branches/*}"
- body: "branch"
- };
- option (google.api.method_signature) = "branch,update_mask";
- option (bytebase.v1.permission) = "bb.branches.update";
- option (bytebase.v1.auth_method) = IAM;
- }
-
- rpc MergeBranch(MergeBranchRequest) returns (Branch) {
- option (google.api.http) = {post: "/v1/{name=projects/*/branches/*}:merge"};
- option (google.api.method_signature) = "name";
- option (bytebase.v1.permission) = "bb.branches.update";
- option (bytebase.v1.auth_method) = IAM;
- }
-
- rpc RebaseBranch(RebaseBranchRequest) returns (RebaseBranchResponse) {
- option (google.api.http) = {post: "/v1/{name=projects/*/branches/*}:rebase"};
- option (google.api.method_signature) = "name";
- option (bytebase.v1.permission) = "bb.branches.update";
- option (bytebase.v1.auth_method) = IAM;
- }
-
- rpc DeleteBranch(DeleteBranchRequest) returns (google.protobuf.Empty) {
- option (google.api.http) = {delete: "/v1/{name=projects/*/branches/*}"};
- option (google.api.method_signature) = "name";
- option (bytebase.v1.permission) = "bb.branches.delete";
- option (bytebase.v1.auth_method) = IAM;
- }
-
rpc DiffMetadata(DiffMetadataRequest) returns (DiffMetadataResponse) {
option (google.api.http) = {
post: "/v1/schemaDesign:diffMetadata"
@@ -81,262 +21,6 @@ service BranchService {
}
}
-enum BranchView {
- // The default / unset value.
- // The API will default to the BASIC view.
- BRANCH_VIEW_UNSPECIFIED = 0;
-
- // Exclude schema, baseline_schema.
- BRANCH_VIEW_BASIC = 1;
- // Include everything.
- BRANCH_VIEW_FULL = 2;
-}
-
-message Branch {
- option (google.api.resource) = {
- type: "bytebase.com/Branch"
- pattern: "projects/{project}/branches/{branch}"
- };
-
- // The name of the branch.
- // Format: projects/{project}/branches/{branch}
- // {branch} should be the id of a sheet.
- string name = 1;
-
- // The branch ID.
- string branch_id = 2;
-
- // The schema of branch. AKA sheet's statement.
- string schema = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // The metadata of the current editing schema.
- DatabaseMetadata schema_metadata = 4;
-
- // The baseline schema.
- string baseline_schema = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // The metadata of the baseline schema.
- DatabaseMetadata baseline_schema_metadata = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // The database engine of the branch.
- Engine engine = 7;
-
- // The name of the baseline database.
- // Format: instances/{instance}/databases/{database}
- string baseline_database = 8 [(google.api.field_behavior) = IMMUTABLE];
-
- // The name of the parent branch.
- // For main branch, it's empty.
- // For child branch, its format will be: projects/{project}/branches/{branch}
- string parent_branch = 9 [(google.api.field_behavior) = IMMUTABLE];
-
- // The etag of the branch.
- string etag = 10;
-
- // The creator of the branch.
- // Format: users/{email}
- string creator = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // The updater of the branch.
- // Format: users/{email}
- string updater = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // The timestamp when the branch was created.
- google.protobuf.Timestamp create_time = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // The timestamp when the branch was last updated.
- google.protobuf.Timestamp update_time = 14 [(google.api.field_behavior) = OUTPUT_ONLY];
-}
-
-message GetBranchRequest {
- // The name of the branch to retrieve.
- // Format: projects/{project}/branches/{branch}
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {type: "bytebase.com/Branch"}
- ];
-}
-
-message ListBranchesRequest {
- // The parent resource of the branch.
- // Format: projects/{project}
- string parent = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {type: "bytebase.com/Project"}
- ];
-
- // To filter the search result.
- string filter = 2;
-
- // Not used.
- // The maximum number of branches to return. The service may return fewer than
- // this value.
- // If unspecified, at most 50 branches will be returned.
- // The maximum value is 1000; values above 1000 will be coerced to 1000.
- int32 page_size = 3;
-
- // Not used.
- // A page token, received from a previous `ListBranches` call.
- // Provide this to retrieve the subsequent page.
- //
- // When paginating, all other parameters provided to `ListBranches` must match
- // the call that provided the page token.
- string page_token = 4;
-
- BranchView view = 5;
-}
-
-message ListBranchesResponse {
- // The branches from the specified request.
- repeated Branch branches = 1;
-
- // A token, which can be sent as `page_token` to retrieve the next page.
- // If this field is omitted, there are no subsequent pages.
- string next_page_token = 2;
-}
-
-message CreateBranchRequest {
- // The parent, which owns this collection of branches.
- // Format: project/{project}
- string parent = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {type: "bytebase.com/Branch"}
- ];
-
- Branch branch = 2;
-
- // The ID to use for the branch, which will become the final component of
- // the branch's resource name.
- // Format: [a-zA-Z][a-zA-Z0-9-_/]+.
- string branch_id = 3;
-}
-
-message UpdateBranchRequest {
- // The branch to update.
- //
- // The branch's `name` field is used to identify the branch to update.
- // Format: projects/{project}/branches/{branch}
- Branch branch = 1 [(google.api.field_behavior) = REQUIRED];
-
- // The list of fields to update.
- google.protobuf.FieldMask update_mask = 2;
-
- // The current etag of the branch.
- // If an etag is provided and does not match the current etag of the branch,
- // the call will be blocked and an ABORTED error will be returned.
- // The etag should be specified for using merged_schema. The etag should be the etag from named branch.
- string etag = 3;
-}
-
-message MergeBranchRequest {
- // The name of the base branch to merge to.
- // Format: projects/{project}/branches/{branch}
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {type: "bytebase.com/Branch"}
- ];
-
- // The head branch to merge from.
- // Format: projects/{project}/branches/{branch}
- string head_branch = 2;
-
- // The current etag of the branch.
- // If an etag is provided and does not match the current etag of the branch,
- // the call will be blocked and an ABORTED error will be returned.
- // The etag should be the etag from named branch.
- string etag = 3 [(google.api.field_behavior) = OPTIONAL];
-
- // validate_only determines if the merge can occur seamlessly without any conflicts.
- bool validate_only = 4;
-}
-
-message RebaseBranchRequest {
- // The name of the base branch to merge to.
- // Format: projects/{project}/branches/{branch}
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {type: "bytebase.com/Branch"}
- ];
-
- // The database (remote upstream) used to rebase.
- // We use its schema as baseline and reapply the difference between base and head of the named branch.
- // Format: instances/{instance}/databases/{database}
- string source_database = 2;
-
- // The branch (remote upstream) used to rebase. We use its head as baseline.
- // We use its head schema as baseline and reapply the difference between base and head of the named branch.
- // Format: projects/{project}/branches/{branch}
- string source_branch = 3;
-
- // For failed merge, we will pass in this addition merged schema and use it for head.
- // This has to be set together with source_database or source_branch.
- string merged_schema = 4;
-
- // The current etag of the branch.
- // If an etag is provided and does not match the current etag of the branch,
- // the call will be blocked and an ABORTED error will be returned.
- // The etag should be specified for using merged_schema. The etag should be the etag from named branch.
- string etag = 5;
-
- // validate_only determines if the rebase can occur seamlessly without any conflicts.
- bool validate_only = 6;
-}
-
-message RebaseBranchResponse {
- oneof result {
- // The rebased branch when rebase occurs seamlessly.
- Branch branch = 1;
- // The conflict schema when rebase has conflicts.
- // The conflict section is enclosed by the following.
- // <<<<< HEAD
- // ====
- // >>>>> main
- string conflict_schema = 2;
- }
-}
-
-message DeleteBranchRequest {
- // The name of the branch to delete.
- // Format: projects/{project}/branches/{branch}
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {type: "bytebase.com/Branch"}
- ];
-
- // By default, server will return `FAILED_PRECONDITION` error
- // if delete the branch that is parent of other branches.
- // If true, server will delete the branch forcely but will not delete its children branches.
- bool force = 2;
-}
-
-message DiffDatabaseRequest {
- // The name of branch.
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {type: "bytebase.com/Branch"}
- ];
-
- // The name of the databsae to merge the branch to.
- string database = 2 [(google.api.field_behavior) = REQUIRED];
-}
-
-message DiffDatabaseResponse {
- // The schema diff when merge occurs seamlessly.
- string diff = 1;
-
- oneof result {
- // The merged schema if there is no conflict.
- string schema = 2;
-
- // The conflict schema when rebase has conflicts.
- // The conflict section is enclosed by the following.
- // <<<<< HEAD
- // ====
- // >>>>> main
- string conflict_schema = 3;
- }
-}
-
message DiffMetadataRequest {
// The metadata of the source schema.
DatabaseMetadata source_metadata = 1 [(google.api.field_behavior) = REQUIRED];