Skip to content

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

feat: init saas trial (#21387)

ecmadaob15f42d3e51a
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index f9f01d99e6..172e2ec108 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -7025,6 +7025,42 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/bytebase.v1.ListPurchasePlansResponse'
+ /bytebase.v1.SubscriptionService/StartTrial:
+ post:
+ tags:
+ - bytebase.v1.SubscriptionService
+ summary: StartTrial
+ description: StartTrial starts a free trial for an eligible SaaS workspace.
+ operationId: bytebase.v1.SubscriptionService.StartTrial
+ parameters:
+ - name: Connect-Protocol-Version
+ in: header
+ required: true
+ schema:
+ $ref: '#/components/schemas/connect-protocol-version'
+ - name: Connect-Timeout-Ms
+ in: header
+ schema:
+ $ref: '#/components/schemas/connect-timeout-header'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.StartTrialRequest'
+ required: true
+ responses:
+ default:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/connect.error'
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.Subscription'
/bytebase.v1.SubscriptionService/UpdatePurchase:
post:
tags:
@@ -8568,8 +8604,14 @@ components:
title: ttl
required:
- ttl
+ - not:
+ anyOf:
+ - required:
+ - expireTime
+ - required:
+ - ttl
+ unevaluatedProperties: false
title: AccessGrant
- additionalProperties: false
bytebase.v1.AccessGrant.Status:
type: string
title: Status
@@ -8861,8 +8903,18 @@ components:
title: range_mask
required:
- rangeMask
+ - not:
+ anyOf:
+ - required:
+ - fullMask
+ - required:
+ - innerOuterMask
+ - required:
+ - md5Mask
+ - required:
+ - rangeMask
+ unevaluatedProperties: false
title: Algorithm
- additionalProperties: false
bytebase.v1.Algorithm.FullMask:
type: object
properties:
@@ -9067,8 +9119,22 @@ components:
title: wecom
required:
- wecom
+ - not:
+ anyOf:
+ - required:
+ - dingtalk
+ - required:
+ - feishu
+ - required:
+ - lark
+ - required:
+ - slack
+ - required:
+ - teams
+ - required:
+ - wecom
+ unevaluatedProperties: false
title: IMSetting
- additionalProperties: false
bytebase.v1.AppIMSetting.Lark:
type: object
properties:
@@ -10800,8 +10866,18 @@ components:
title: recovery_code
required:
- recoveryCode
+ - not:
+ anyOf:
+ - required:
+ - currentPassword
+ - required:
+ - emailCode
+ - required:
+ - otpCode
+ - required:
+ - recoveryCode
+ unevaluatedProperties: false
title: CredentialProof
- additionalProperties: false
description: |-
One proof that the caller currently controls a credential on the account.
Exactly one field must be set; enforced in the handler.
@@ -11129,8 +11205,16 @@ components:
title: gcp_credential
required:
- gcpCredential
+ - not:
+ anyOf:
+ - required:
+ - awsCredential
+ - required:
+ - azureCredential
+ - required:
+ - gcpCredential
+ unevaluatedProperties: false
title: DataSource
- additionalProperties: false
bytebase.v1.DataSource.AWSCredential:
type: object
properties:
@@ -11302,8 +11386,14 @@ components:
title: token
required:
- token
+ - not:
+ anyOf:
+ - required:
+ - appRole
+ - required:
+ - token
+ unevaluatedProperties: false
title: DataSourceExternalSecret
- additionalProperties: false
bytebase.v1.DataSourceExternalSecret.AppRoleAuthOption:
type: object
properties:
@@ -11892,8 +11982,14 @@ components:
title: schema
required:
- schema
+ - not:
+ anyOf:
+ - required:
+ - changelog
+ - required:
+ - schema
+ unevaluatedProperties: false
title: DiffSchemaRequest
- additionalProperties: false
bytebase.v1.DiffSchemaResponse:
type: object
properties:
@@ -11993,8 +12089,12 @@ components:
title: smtp
required:
- smtp
+ - not:
+ anyOf:
+ - required:
+ - smtp
+ unevaluatedProperties: false
title: EmailSetting
- additionalProperties: false
bytebase.v1.EmailSetting.SMTPConfig:
type: object
properties:
@@ -13244,8 +13344,16 @@ components:
title: oidc_config
required:
- oidcConfig
+ - not:
+ anyOf:
+ - required:
+ - ldapConfig
+ - required:
+ - oauth2Config
+ - required:
+ - oidcConfig
+ unevaluatedProperties: false
title: IdentityProviderConfig
- additionalProperties: false
bytebase.v1.IdentityProviderContext:
type: object
oneOf:
@@ -13267,8 +13375,14 @@ components:
title: oidc_context
required:
- oidcContext
+ - not:
+ anyOf:
+ - required:
+ - oauth2Context
+ - required:
+ - oidcContext
+ unevaluatedProperties: false
title: IdentityProviderContext
- additionalProperties: false
description: Context for identity provider authentication.
bytebase.v1.IdentityProviderType:
type: string
@@ -13757,8 +13871,18 @@ components:
title: review_submission
required:
- reviewSubmission
+ - not:
+ anyOf:
+ - required:
+ - approval
+ - required:
+ - issueUpdate
+ - required:
+ - planUpdate
+ - required:
+ - reviewSubmission
+ unevaluatedProperties: false
title: IssueComment
- additionalProperties: false
description: A comment on an issue.
bytebase.v1.IssueComment.Approval:
type: object
@@ -16121,8 +16245,14 @@ components:
title: struct_kind
required:
- structKind
+ - not:
+ anyOf:
+ - required:
+ - arrayKind
+ - required:
+ - structKind
+ unevaluatedProperties: false
title: ObjectSchema
- additionalProperties: false
description: Schema definition for object-type columns.
bytebase.v1.ObjectSchema.ArrayKind:
type: object
@@ -16460,8 +16590,14 @@ components:
title: create_database_config
required:
- createDatabaseConfig
+ - not:
+ anyOf:
+ - required:
+ - changeDatabaseConfig
+ - required:
+ - createDatabaseConfig
+ unevaluatedProperties: false
title: Spec
- additionalProperties: false
bytebase.v1.Plan.TaskStatusCount:
type: object
properties:
@@ -16543,8 +16679,14 @@ components:
title: sql_summary_report
required:
- sqlSummaryReport
+ - not:
+ anyOf:
+ - required:
+ - sqlReviewReport
+ - required:
+ - sqlSummaryReport
+ unevaluatedProperties: false
title: Result
- additionalProperties: false
bytebase.v1.PlanCheckRun.Result.SqlReviewReport:
type: object
properties:
@@ -16783,8 +16925,20 @@ components:
title: tag_policy
required:
- tagPolicy
+ - not:
+ anyOf:
+ - required:
+ - maskingExemptionPolicy
+ - required:
+ - maskingRulePolicy
+ - required:
+ - queryDataPolicy
+ - required:
+ - rolloutPolicy
+ - required:
+ - tagPolicy
+ unevaluatedProperties: false
title: Policy
- additionalProperties: false
bytebase.v1.PolicyDelta:
type: object
properties:
@@ -17408,8 +17562,18 @@ components:
title: syntax_error
required:
- syntaxError
+ - not:
+ anyOf:
+ - required:
+ - commandError
+ - required:
+ - permissionDenied
+ - required:
+ - postgresError
+ - required:
+ - syntaxError
+ unevaluatedProperties: false
title: QueryResult
- additionalProperties: false
bytebase.v1.QueryResult.CommandError:
type: object
properties:
@@ -18282,8 +18446,36 @@ components:
title: value_value
required:
- valueValue
+ - not:
+ anyOf:
+ - required:
+ - boolValue
+ - required:
+ - bytesValue
+ - required:
+ - doubleValue
+ - required:
+ - floatValue
+ - required:
+ - int32Value
+ - required:
+ - int64Value
+ - required:
+ - nullValue
+ - required:
+ - stringValue
+ - required:
+ - timestampTzValue
+ - required:
+ - timestampValue
+ - required:
+ - uint32Value
+ - required:
+ - uint64Value
+ - required:
+ - valueValue
+ unevaluatedProperties: false
title: RowValue
- additionalProperties: false
bytebase.v1.RowValue.Timestamp:
type: object
properties:
@@ -18369,8 +18561,12 @@ components:
title: krb_config
required:
- krbConfig
+ - not:
+ anyOf:
+ - required:
+ - krbConfig
+ unevaluatedProperties: false
title: SASLConfig
- additionalProperties: false
bytebase.v1.SQLEditorThemeSetting:
type: object
properties:
@@ -18468,8 +18664,22 @@ components:
title: string_payload
required:
- stringPayload
+ - not:
+ anyOf:
+ - required:
+ - commentConventionPayload
+ - required:
+ - namingCasePayload
+ - required:
+ - namingPayload
+ - required:
+ - numberPayload
+ - required:
+ - stringArrayPayload
+ - required:
+ - stringPayload
+ unevaluatedProperties: false
title: SQLReviewRule
- additionalProperties: false
description: SQL review rule configuration. Check the SQL_REVIEW_RULES_DOCUMENTATION.md for details.
bytebase.v1.SQLReviewRule.CommentConventionRulePayload:
type: object
@@ -19656,8 +19866,28 @@ components:
title: workspace_profile
required:
- workspaceProfile
+ - not:
+ anyOf:
+ - required:
+ - ai
+ - required:
+ - appIm
+ - required:
+ - dataClassification
+ - required:
+ - email
+ - required:
+ - environment
+ - required:
+ - mcp
+ - required:
+ - semanticType
+ - required:
+ - workspaceApproval
+ - required:
+ - workspaceProfile
+ unevaluatedProperties: false
title: SettingValue
- additionalProperties: false
description: The data in setting value.
bytebase.v1.Sheet:
type: object
@@ -19801,6 +20031,10 @@ components:
$ref: '#/components/schemas/google.protobuf.Timestamp'
title: StartMFAEnrollmentResponse
additionalProperties: false
+ bytebase.v1.StartTrialRequest:
+ type: object
+ title: StartTrialRequest
+ additionalProperties: false
bytebase.v1.State:
type: string
title: State
@@ -20158,8 +20392,14 @@ components:
title: object_schema
required:
- objectSchema
+ - not:
+ anyOf:
+ - required:
+ - columns
+ - required:
+ - objectSchema
+ unevaluatedProperties: false
title: TableCatalog
- additionalProperties: false
description: Table metadata within a schema.
bytebase.v1.TableCatalog.Columns:
type: object
@@ -20466,8 +20706,14 @@ components:
title: database_update
required:
- databaseUpdate
+ - not:
+ anyOf:
+ - required:
+ - databaseCreate
+ - required:
+ - databaseUpdate
+ unevaluatedProperties: false
title: Task
- additionalProperties: false
bytebase.v1.Task.DatabaseCreate:
type: object
properties:
@@ -20499,8 +20745,14 @@ components:
title: sheet
required:
- sheet
+ - not:
+ anyOf:
+ - required:
+ - release
+ - required:
+ - sheet
+ unevaluatedProperties: false
title: DatabaseUpdate
- additionalProperties: false
description: Payload for updating a database schema.
bytebase.v1.Task.Status:
type: string
@@ -20656,8 +20908,12 @@ components:
title: parallel_tasks_limit
required:
- parallelTasksLimit
+ - not:
+ anyOf:
+ - required:
+ - parallelTasksLimit
+ unevaluatedProperties: false
title: WaitingCause
- additionalProperties: false
description: Information about why a task run is waiting.
bytebase.v1.TaskRun.Status:
type: string
@@ -21033,8 +21289,12 @@ components:
title: postgres
required:
- postgres
+ - not:
+ anyOf:
+ - required:
+ - postgres
+ unevaluatedProperties: false
title: TaskRunSession
- additionalProperties: false
bytebase.v1.TaskRunSession.Postgres:
type: object
properties:
@@ -21224,8 +21484,16 @@ components:
title: oidc_context
required:
- oidcContext
+ - not:
+ anyOf:
+ - required:
+ - ldapContext
+ - required:
+ - oauth2Context
+ - required:
+ - oidcContext
+ unevaluatedProperties: false
title: TestIdentityProviderRequest
- additionalProperties: false
bytebase.v1.TestIdentityProviderResponse:
type: object
properties:
@@ -22663,8 +22931,28 @@ components:
title: uint64_value
required:
- uint64Value
+ - not:
+ anyOf:
+ - required:
+ - boolValue
+ - required:
+ - bytesValue
+ - required:
+ - doubleValue
+ - required:
+ - durationValue
+ - required:
+ - int64Value
+ - required:
+ - nullValue
+ - required:
+ - stringValue
+ - required:
+ - timestampValue
+ - required:
+ - uint64Value
+ unevaluatedProperties: false
title: Constant
- additionalProperties: false
description: |-
Represents a primitive literal.
@@ -22758,8 +23046,24 @@ components:
title: struct_expr
required:
- structExpr
+ - not:
+ anyOf:
+ - required:
+ - callExpr
+ - required:
+ - comprehensionExpr
+ - required:
+ - constExpr
+ - required:
+ - identExpr
+ - required:
+ - listExpr
+ - required:
+ - selectExpr
+ - required:
+ - structExpr
+ unevaluatedProperties: false
title: Expr
- additionalProperties: false
description: |-
An abstract representation of a common expression.
@@ -23012,8 +23316,14 @@ components:
title: map_key
required:
- mapKey
+ - not:
+ anyOf:
+ - required:
+ - fieldKey
+ - required:
+ - mapKey
+ unevaluatedProperties: false
title: Entry
- additionalProperties: false
description: Represents an entry.
google.api.expr.v1alpha1.Expr.Ident:
type: object
diff --git a/backend/api/v1/subscription_service.go b/backend/api/v1/subscription_service.go
index 311626b5ed..651f3e7bae 100644
--- a/backend/api/v1/subscription_service.go
+++ b/backend/api/v1/subscription_service.go
@@ -48,7 +48,7 @@ func NewSubscriptionService(
// GetSubscription gets the subscription.
func (s *SubscriptionService) GetSubscription(ctx context.Context, _ *connect.Request[v1pb.GetSubscriptionRequest]) (*connect.Response[v1pb.Subscription], error) {
workspaceID := common.GetWorkspaceIDFromContext(ctx)
- subscription := s.licenseService.LoadSubscription(ctx, workspaceID)
+ subscription := s.licenseService.LoadEffectiveSubscription(ctx, workspaceID)
// Attach etag from subscription table for optimistic concurrency.
if subscription.Plan != v1pb.PlanType_FREE {
if existing, err := s.store.GetSubscriptionByWorkspace(ctx, workspaceID); err == nil && existing != nil {
@@ -106,7 +106,7 @@ func escapeCSVFormula(value string) string {
// UploadLicense uploads an enterprise license (self-hosted only).
func (s *SubscriptionService) UploadLicense(ctx context.Context, req *connect.Request[v1pb.UploadLicenseRequest]) (*connect.Response[v1pb.Subscription], error) {
- if s.profile.SaaS && s.profile.Mode == common.ReleaseModeProd {
+ if s.profile.SaaS {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("use purchase APIs in SaaS mode"))
}
@@ -117,10 +117,49 @@ func (s *SubscriptionService) UploadLicense(ctx context.Context, req *connect.Re
return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to store license"))
}
- subscription := s.licenseService.LoadSubscription(ctx, common.GetWorkspaceIDFromContext(ctx))
+ subscription := s.licenseService.LoadEffectiveSubscription(ctx, common.GetWorkspaceIDFromContext(ctx))
return connect.NewResponse(subscription), nil
}
+// StartTrial starts a free trial for an eligible SaaS workspace.
+func (s *SubscriptionService) StartTrial(ctx context.Context, _ *connect.Request[v1pb.StartTrialRequest]) (*connect.Response[v1pb.Subscription], error) {
+ if !s.profile.SaaS || s.profile.Mode != common.ReleaseModeDev {
+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("trial is only available in SaaS development mode"))
+ }
+
+ workspaceID := common.GetWorkspaceIDFromContext(ctx)
+ params := newTrialLicenseParams(workspaceID, time.Now())
+
+ existing, err := s.store.GetSubscriptionByWorkspace(ctx, workspaceID)
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrap(err, "failed to get subscription"))
+ }
+ if existing != nil {
+ return nil, connect.NewError(connect.CodeFailedPrecondition, errors.New("workspace is not eligible for a free trial"))
+ }
+
+ currentSubscription, err := s.licenseService.LoadSubscriptionFromDB(ctx, workspaceID)
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrap(err, "failed to load subscription"))
+ }
+ if currentSubscription != nil {
+ return nil, connect.NewError(connect.CodeFailedPrecondition, errors.New("workspace is not eligible for a free trial"))
+ }
+
+ license, err := s.licenseService.CreateLicense(params)
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrap(err, "failed to create trial license"))
+ }
+ if err := s.store.CreateTrialLicense(ctx, workspaceID, license); errors.Is(err, store.ErrTrialNotEligible) {
+ return nil, connect.NewError(connect.CodeFailedPrecondition, errors.New("workspace is not eligible for a free trial"))
+ } else if err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrap(err, "failed to store trial license"))
+ }
+ s.licenseService.InvalidateCache(workspaceID)
+
+ return connect.NewResponse(subscriptionFromTrialParams(params)), nil
+}
+
// CreatePurchase creates a Stripe Checkout session (SaaS only).
// Stateless — no subscription record is created. The subscription is only
// created when the Stripe webhook confirms payment.
diff --git a/backend/api/v1/subscription_service_trial_test.go b/backend/api/v1/subscription_service_trial_test.go
new file mode 100644
index 0000000000..5e96adf6a4
--- /dev/null
+++ b/backend/api/v1/subscription_service_trial_test.go
@@ -0,0 +1,178 @@
+package v1
+
+import (
+ "context"
+ "crypto/rand"
+ "crypto/rsa"
+ "crypto/x509"
+ "encoding/pem"
+ "reflect"
+ "testing"
+ "time"
+ "unsafe"
+
+ "connectrpc.com/connect"
+ "github.com/stretchr/testify/require"
+ "google.golang.org/protobuf/types/known/timestamppb"
+
+ "github.com/bytebase/bytebase/backend/common"
+ "github.com/bytebase/bytebase/backend/common/testcontainer"
+ "github.com/bytebase/bytebase/backend/component/config"
+ "github.com/bytebase/bytebase/backend/enterprise"
+ storepb "github.com/bytebase/bytebase/backend/generated-go/store"
+ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
+ "github.com/bytebase/bytebase/backend/store"
+)
+
+func TestNewTrialLicenseParams(t *testing.T) {
+ startedAt := time.Date(2026, time.September, 8, 3, 4, 5, 123, time.FixedZone("test", 8*60*60))
+ params := newTrialLicenseParams("workspace-a", startedAt)
+ require.Equal(t, v1pb.PlanType_ENTERPRISE.String(), params.Plan)
+ require.Equal(t, 20, params.Seats)
+ require.Equal(t, 10, params.Instances)
+ require.Equal(t, "workspace-a", params.WorkspaceID)
+ require.True(t, params.Trialing)
+ require.Equal(t, time.Date(2026, time.September, 21, 19, 4, 5, 0, time.UTC), params.ExpiresAt)
+
+ subscription := subscriptionFromTrialParams(params)
+ require.Equal(t, v1pb.PlanType_ENTERPRISE, subscription.Plan)
+ require.Equal(t, int32(20), subscription.Seats)
+ require.Equal(t, int32(10), subscription.Instances)
+ require.Equal(t, int32(10), subscription.ActiveInstances)
+ require.True(t, subscription.Trialing)
+ require.Equal(t, params.ExpiresAt, subscription.ExpiresTime.AsTime())
+}
+
+func TestSubscriptionServiceStartTrial(t *testing.T) {
+ ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
+ t.Cleanup(cancel)
+ _, stores, _ := testcontainer.NewMetadataDB(t)
+
+ privateKey, err := rsa.GenerateKey(rand.Reader, 2048)
+ require.NoError(t, err)
+ privateKeyPEM := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(privateKey)})
+ licenseService, err := enterprise.NewLicenseService(common.ReleaseModeDev, stores, true, string(privateKeyPEM))
+ require.NoError(t, err)
+ setLicenseServicePublicKey(t, licenseService, &privateKey.PublicKey)
+
+ service := NewSubscriptionService(&config.Profile{SaaS: true, Mode: common.ReleaseModeDev}, stores, licenseService)
+ createWorkspace := func(t *testing.T, workspace string) context.Context {
+ t.Helper()
+ _, err := stores.GetDB().ExecContext(ctx, `INSERT INTO workspace (resource_id) VALUES ($1)`, workspace)
+ require.NoError(t, err)
+ _, err = stores.UpsertSetting(ctx, &store.SettingMessage{
+ Name: storepb.SettingName_SYSTEM,
+ Workspace: workspace,
+ Value: &storepb.SystemSetting{},
+ })
+ require.NoError(t, err)
+ return context.WithValue(ctx, common.WorkspaceIDContextKey, workspace)
+ }
+
+ t.Run("starts ENTERPRISE trial", func(t *testing.T) {
+ requestContext := createWorkspace(t, "starts-enterprise-trial")
+ response, err := service.StartTrial(requestContext, connect.NewRequest(&v1pb.StartTrialRequest{}))
+ require.NoError(t, err)
+ require.Equal(t, v1pb.PlanType_ENTERPRISE, response.Msg.Plan)
+ require.Equal(t, int32(20), response.Msg.Seats)
+ require.Equal(t, int32(10), response.Msg.Instances)
+ require.True(t, response.Msg.Trialing)
+ require.WithinDuration(t, time.Now().Add(14*24*time.Hour), response.Msg.ExpiresTime.AsTime(), 5*time.Second)
+
+ setting, err := stores.GetSystemSettingUncached(requestContext, "starts-enterprise-trial")
+ require.NoError(t, err)
+ require.NotEmpty(t, setting.License)
+ stored, err := licenseService.LoadSubscriptionFromDB(requestContext, "starts-enterprise-trial")
+ require.NoError(t, err)
+ require.Equal(t, v1pb.PlanType_ENTERPRISE, stored.Plan)
+ require.True(t, stored.Trialing)
+ billingSubscription, err := stores.GetSubscriptionByWorkspace(requestContext, "starts-enterprise-trial")
+ require.NoError(t, err)
+ require.Nil(t, billingSubscription, "a trial must not create Stripe subscription history")
+
+ current, err := service.GetSubscription(requestContext, connect.NewRequest(&v1pb.GetSubscriptionRequest{}))
+ require.NoError(t, err)
+ require.Equal(t, v1pb.PlanType_ENTERPRISE, current.Msg.Plan)
+ require.True(t, current.Msg.Trialing)
+
+ _, err = service.StartTrial(requestContext, connect.NewRequest(&v1pb.StartTrialRequest{}))
+ require.Equal(t, connect.CodeFailedPrecondition, connect.CodeOf(err))
+ })
+
+ t.Run("rejects subscription history", func(t *testing.T) {
+ for _, tc := range []struct {
+ name string
+ payload *storepb.SubscriptionPayload
+ }{
+ {name: "active", payload: &storepb.SubscriptionPayload{Status: storepb.SubscriptionPayload_ACTIVE}},
+ {name: "paused", payload: &storepb.SubscriptionPayload{Status: storepb.SubscriptionPayload_PAUSED}},
+ {name: "canceled", payload: &storepb.SubscriptionPayload{Status: storepb.SubscriptionPayload_CANCELED}},
+ {name: "unspecified", payload: &storepb.SubscriptionPayload{}},
+ {name: "expired", payload: &storepb.SubscriptionPayload{
+ Status: storepb.SubscriptionPayload_ACTIVE,
+ ExpiresAt: timestamppb.New(time.Now().Add(-time.Hour)),
+ }},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ workspace := "subscription-history-" + tc.name
+ requestContext := createWorkspace(t, workspace)
+ _, err := stores.UpsertSubscription(requestContext, workspace, tc.payload)
+ require.NoError(t, err)
+
+ _, err = service.StartTrial(requestContext, connect.NewRequest(&v1pb.StartTrialRequest{}))
+ require.Equal(t, connect.CodeFailedPrecondition, connect.CodeOf(err))
+ })
+ }
+ })
+
+ t.Run("rejects expired trial", func(t *testing.T) {
+ requestContext := createWorkspace(t, "expired-trial")
+ license, err := licenseService.CreateLicense(&enterprise.LicenseParams{
+ Plan: v1pb.PlanType_TEAM.String(),
+ WorkspaceID: "expired-trial",
+ Trialing: true,
+ ExpiresAt: time.Now().Add(-time.Hour),
+ })
+ require.NoError(t, err)
+ require.NoError(t, stores.UpdateLicense(requestContext, "expired-trial", license))
+
+ _, err = service.StartTrial(requestContext, connect.NewRequest(&v1pb.StartTrialRequest{}))
+ require.Equal(t, connect.CodeFailedPrecondition, connect.CodeOf(err))
+ })
+
+ t.Run("rejects invalid stored license", func(t *testing.T) {
+ requestContext := createWorkspace(t, "invalid-license")
+ require.NoError(t, stores.UpdateLicense(requestContext, "invalid-license", "not-a-license"))
+
+ _, err := service.StartTrial(requestContext, connect.NewRequest(&v1pb.StartTrialRequest{}))
+ require.Equal(t, connect.CodeInternal, connect.CodeOf(err))
+ })
+
+ t.Run("rejects self-host", func(t *testing.T) {
+ requestContext := createWorkspace(t, "self-host")
+ selfHostService := NewSubscriptionService(&config.Profile{}, stores, licenseService)
+ _, err := selfHostService.StartTrial(requestContext, connect.NewRequest(&v1pb.StartTrialRequest{}))
+ require.Equal(t, connect.CodeUnimplemented, connect.CodeOf(err))
+ })
+
+ t.Run("rejects SaaS production", func(t *testing.T) {
+ requestContext := createWorkspace(t, "saas-production")
+ productionService := NewSubscriptionService(&config.Profile{SaaS: true, Mode: common.ReleaseModeProd}, stores, licenseService)
+ _, err := productionService.StartTrial(requestContext, connect.NewRequest(&v1pb.StartTrialRequest{}))
+ require.Equal(t, connect.CodeUnimplemented, connect.CodeOf(err))
+ })
+
+ t.Run("rejects license upload in SaaS development", func(t *testing.T) {
+ requestContext := createWorkspace(t, "saas-development-upload")
+ _, err := service.UploadLicense(requestContext, connect.NewRequest(&v1pb.UploadLicenseRequest{}))
+ require.Equal(t, connect.CodeUnimplemented, connect.CodeOf(err))
+ })
+}
+
+func setLicenseServicePublicKey(t *testing.T, service *enterprise.LicenseService, publicKey *rsa.PublicKey) {
+ t.Helper()
+ field := reflect.ValueOf(service).Elem().FieldByName("config")
+ licenseConfig, ok := reflect.NewAt(field.Type(), unsafe.Pointer(field.UnsafeAddr())).Elem().Interface().(*enterprise.Config)
+ require.True(t, ok)
+ licenseConfig.PublicKey = publicKey
+}
diff --git a/backend/api/v1/testdata/mcp_method_classification.md b/backend/api/v1/testdata/mcp_method_classification.md
index ffadc85307..83c5279e31 100644
--- a/backend/api/v1/testdata/mcp_method_classification.md
+++ b/backend/api/v1/testdata/mcp_method_classification.md
@@ -18,10 +18,10 @@ served by no ceiling.
|---|---|---|
| READ | 56 | served to a read-only session and above |
| WRITE | 41 | served to a read-write session only |
-| EXCLUDED | 85 | served by no ceiling this phase ships |
+| EXCLUDED | 86 | served by no ceiling this phase ships |
| FORBIDDEN | 35 | never served, whatever the ceiling |
| MCP_METHOD_CLASS_UNSPECIFIED | 0 | unclassified — CI rejects this, and the gate refuses it |
-| **total** | **217** | |
+| **total** | **218** | |
| Method | Class | Reason | Permission |
|---|---|---|---|
@@ -209,6 +209,7 @@ served by no ceiling.
| SubscriptionService/GetPaymentInfo | EXCLUDED | ADMINISTERS_THE_WORKSPACE | bb.subscription.manage |
| SubscriptionService/GetSubscription | EXCLUDED | ADMINISTERS_THE_WORKSPACE | — |
| SubscriptionService/ListPurchasePlans | EXCLUDED | ADMINISTERS_THE_WORKSPACE | — |
+| SubscriptionService/StartTrial | EXCLUDED | ADMINISTERS_THE_WORKSPACE | bb.subscription.manage |
| SubscriptionService/UpdatePurchase | EXCLUDED | ADMINISTERS_THE_WORKSPACE | bb.subscription.manage |
| SubscriptionService/UploadLicense | EXCLUDED | ADMINISTERS_THE_WORKSPACE | bb.subscription.manage |
| SubscriptionService/VerifyCheckoutSession | EXCLUDED | ADMINISTERS_THE_WORKSPACE | bb.subscription.manage |
diff --git a/backend/api/v1/trial.go b/backend/api/v1/trial.go
new file mode 100644
index 0000000000..b159aeb735
--- /dev/null
+++ b/backend/api/v1/trial.go
@@ -0,0 +1,39 @@
+package v1
+
+import (
+ "time"
+
+ "google.golang.org/protobuf/types/known/timestamppb"
+
+ "github.com/bytebase/bytebase/backend/enterprise"
+ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
+)
+
+const (
+ trialDuration = 14 * 24 * time.Hour
+ trialSeats = 20
+ trialInstances = 10
+)
+
+func newTrialLicenseParams(workspaceID string, startedAt time.Time) *enterprise.LicenseParams {
+ startedAt = startedAt.UTC().Truncate(time.Second)
+ return &enterprise.LicenseParams{
+ Plan: v1pb.PlanType_ENTERPRISE.String(),
+ Seats: trialSeats,
+ Instances: trialInstances,
+ WorkspaceID: workspaceID,
+ Trialing: true,
+ ExpiresAt: startedAt.Add(trialDuration),
+ }
+}
+
+func subscriptionFromTrialParams(params *enterprise.LicenseParams) *v1pb.Subscription {
+ return &v1pb.Subscription{
+ Plan: v1pb.PlanType_ENTERPRISE,
+ Seats: int32(params.Seats),
+ Instances: int32(params.Instances),
+ ActiveInstances: int32(params.Instances),
+ ExpiresTime: timestamppb.New(params.ExpiresAt),
+ Trialing: true,
+ }
+}
diff --git a/backend/enterprise/license.go b/backend/enterprise/license.go
index 985106eb35..40b4ee44a6 100644
--- a/backend/enterprise/license.go
+++ b/backend/enterprise/license.go
@@ -195,59 +195,50 @@ func licenseCacheKey(workspaceID string) string {
return "license/" + workspaceID
}
-// LoadSubscription will load subscription.
-// If there is no license, we will return a free plan subscription without expiration time.
-// If there is expired license, we will return a free plan subscription with the expiration time of the expired license.
-func (s *LicenseService) LoadSubscription(ctx context.Context, workspaceID string) *v1pb.Subscription {
+// LoadEffectiveSubscription returns the subscription used for entitlement
+// checks. Missing, invalid, and unreadable licenses fall back to Free; expired
+// licenses retain their expiration time but no paid-plan entitlement.
+func (s *LicenseService) LoadEffectiveSubscription(ctx context.Context, workspaceID string) *v1pb.Subscription {
if workspaceID == "" {
return defaultFreeSubscription
}
key := licenseCacheKey(workspaceID)
- // Fast path: cache hit (TTL handled automatically by expirable.LRU)
- if sub, ok := s.cache.Get(key); ok {
- return sub
- }
-
- // Slow path: load from DB with singleflight to prevent thundering herd
- v, _, _ := s.sfGroup.Do(key, func() (any, error) {
- // Double check after entering singleflight
- if sub, ok := s.cache.Get(key); ok {
- return sub, nil
- }
-
- subscription := s.loadSubscriptionFromDB(ctx, workspaceID)
-
- // Only cache non-free subscriptions. Free plan may be a transient failure
- // (e.g. DB not ready during startup), and caching it would mask the real
- // license for the TTL duration.
- if subscription.Plan != v1pb.PlanType_FREE {
+ subscription, ok := s.cache.Get(key)
+ if !ok {
+ // Load from DB with singleflight to prevent thundering herd.
+ v, err, _ := s.sfGroup.Do(key, func() (any, error) {
+ if sub, ok := s.cache.Get(key); ok {
+ return sub, nil
+ }
+
+ subscription, err := s.LoadSubscriptionFromDB(ctx, workspaceID)
+ if err != nil {
+ return nil, err
+ }
+ if subscription == nil {
+ return nil, nil
+ }
s.cache.Add(key, subscription)
+ return subscription, nil
+ })
+ if err != nil {
+ slog.Debug("failed to load subscription", log.BBError(err))
+ return defaultFreeSubscription
+ }
+ var valid bool
+ subscription, valid = v.(*v1pb.Subscription)
+ if !valid {
+ return defaultFreeSubscription
}
- return subscription, nil
- })
-
- if sub, ok := v.(*v1pb.Subscription); ok {
- return sub
- }
- return defaultFreeSubscription
-}
-
-func (s *LicenseService) loadSubscriptionFromDB(ctx context.Context, workspaceID string) *v1pb.Subscription {
- setting, err := s.store.GetSystemSetting(ctx, workspaceID)
- if err != nil {
- slog.Debug("failed to get system setting", log.BBError(err))
- return defaultFreeSubscription
- }
-
- if setting.License == "" {
- return defaultFreeSubscription
}
- subscription, err := s.parseLicense(setting.License, workspaceID)
- if err != nil {
- slog.Debug("failed to parse enterprise license", log.BBError(err))
- return defaultFreeSubscription
+ // Switch to free plan if the subscription is expired.
+ if isExpired(subscription) {
+ return &v1pb.Subscription{
+ Plan: v1pb.PlanType_FREE,
+ ExpiresTime: subscription.ExpiresTime,
+ }
}
slog.Debug(
@@ -260,15 +251,25 @@ func (s *LicenseService) loadSubscriptionFromDB(ctx context.Context, workspaceID
slog.Int("seats", int(subscription.Seats)),
)
- // Switch to free plan if the subscription is expired.
- if isExpired(subscription) {
- return &v1pb.Subscription{
- Plan: v1pb.PlanType_FREE,
- ExpiresTime: subscription.ExpiresTime,
- }
+ return subscription
+}
+
+// LoadSubscriptionFromDB reads and verifies the workspace license without
+// applying expiration or Free-plan fallback behavior. No license returns nil.
+func (s *LicenseService) LoadSubscriptionFromDB(ctx context.Context, workspaceID string) (*v1pb.Subscription, error) {
+ setting, err := s.store.GetSystemSetting(ctx, workspaceID)
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to get system setting")
+ }
+ if setting == nil || setting.License == "" {
+ return nil, nil
}
- return subscription
+ subscription, err := s.parseLicenseUncheckedExpiry(setting.License, workspaceID)
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to parse enterprise license")
+ }
+ return subscription, nil
}
func isExpired(sub *v1pb.Subscription) bool {
@@ -280,7 +281,7 @@ func isExpired(sub *v1pb.Subscription) bool {
// GetEffectivePlan gets the effective plan.
func (s *LicenseService) GetEffectivePlan(ctx context.Context, workspaceID string) v1pb.PlanType {
- return s.LoadSubscription(ctx, workspaceID).Plan
+ return s.LoadEffectiveSubscription(ctx, workspaceID).Plan
}
// IsFeatureEnabled returns whether a feature is enabled.
@@ -319,7 +320,7 @@ func (s *LicenseService) IsFeatureEnabledForInstance(ctx context.Context, worksp
// GetUserLimit gets the user limit value for the plan.
func (s *LicenseService) GetUserLimit(ctx context.Context, workspaceID string) int {
- return userLimitFromSubscription(s.LoadSubscription(ctx, workspaceID))
+ return userLimitFromSubscription(s.LoadEffectiveSubscription(ctx, workspaceID))
}
// GetUserLimitUncached returns the effective user limit read directly from the
@@ -353,7 +354,7 @@ func userLimitFromSubscription(subscription *v1pb.Subscription) int {
// GetInstanceLimit gets the instance limit value for the plan.
func (s *LicenseService) GetInstanceLimit(ctx context.Context, workspaceID string) int {
- subscription := s.LoadSubscription(ctx, workspaceID)
+ subscription := s.LoadEffectiveSubscription(ctx, workspaceID)
// Prefer to take values from the license first.
if subscription.Instances > 0 {
return int(subscription.Instances)
@@ -425,7 +426,7 @@ func instanceLimitFromSubscription(subscription *v1pb.Subscription) int {
// GetActivatedInstanceLimit returns the activated instance limit for the current subscription.
func (s *LicenseService) GetActivatedInstanceLimit(ctx context.Context, workspaceID string) int {
- limit := s.LoadSubscription(ctx, workspaceID).ActiveInstances
+ limit := s.LoadEffectiveSubscription(ctx, workspaceID).ActiveInstances
if limit < 0 {
return math.MaxInt
}
@@ -455,7 +456,7 @@ func (s *LicenseService) IsInstanceEffectivelyActivated(ctx context.Context, wor
// StoreLicense will store license into file.
func (s *LicenseService) StoreLicense(ctx context.Context, workspaceID string, license string) error {
if license != "" {
- if _, err := s.parseLicense(license, workspaceID); err != nil {
+ if err := s.validateLicense(license, workspaceID); err != nil {
return err
}
}
@@ -476,6 +477,7 @@ type LicenseParams struct {
Seats int
Instances int
WorkspaceID string
+ Trialing bool
ExpiresAt time.Time // zero value means no expiration
}
@@ -486,6 +488,7 @@ func newLicenseClaims(params *LicenseParams) *Claims {
ActiveInstances: params.Instances,
Instances: params.Instances,
WorkspaceID: params.WorkspaceID,
+ Trialing: params.Trialing,
}
}
@@ -581,7 +584,7 @@ func (s *LicenseService) CheckReplicaLimit(ctx context.Context) error {
return nil
}
workspaceID, _ := s.store.GetWorkspaceID(ctx)
- if s.LoadSubscription(ctx, workspaceID).Ha {
+ if s.LoadEffectiveSubscription(ctx, workspaceID).Ha {
return nil // HA license, no limit
}
@@ -596,15 +599,15 @@ func (s *LicenseService) CheckReplicaLimit(ctx context.Context) error {
return nil
}
-func (s *LicenseService) parseLicense(license, workspaceID string) (*v1pb.Subscription, error) {
+func (s *LicenseService) validateLicense(license, workspaceID string) error {
subscription, err := s.parseLicenseUncheckedExpiry(license, workspaceID)
if err != nil {
- return nil, err
+ return err
}
if isExpired(subscription) {
- return nil, common.Errorf(common.Invalid, "license has expired at %v", subscription.ExpiresTime.AsTime())
+ return common.Errorf(common.Invalid, "license has expired at %v", subscription.ExpiresTime.AsTime())
}
- return subscription, nil
+ return nil
}
// parseLicenseUncheckedExpiry verifies a license's signature and all static
diff --git a/backend/enterprise/license_test.go b/backend/enterprise/license_test.go
index 743262de71..55837b6bed 100644
--- a/backend/enterprise/license_test.go
+++ b/backend/enterprise/license_test.go
@@ -136,6 +136,14 @@ func TestCreateLicenseUsesEqualInstanceClaims(t *testing.T) {
}
}
+func TestNewLicenseClaimsPropagatesTrialing(t *testing.T) {
+ trial := newLicenseClaims(&LicenseParams{Plan: v1pb.PlanType_TEAM.String(), Trialing: true})
+ require.True(t, trial.Trialing)
+
+ paid := newLicenseClaims(&LicenseParams{Plan: v1pb.PlanType_TEAM.String()})
+ require.False(t, paid.Trialing)
+}
+
func TestParseLicenseExpiredIsInvalid(t *testing.T) {
privateKey, err := rsa.GenerateKey(rand.Reader, 2048)
require.NoError(t, err)
@@ -154,10 +162,71 @@ func TestParseLicenseExpiredIsInvalid(t *testing.T) {
})
require.NoError(t, err)
- _, err = service.parseLicense(license, "test-workspace")
+ err = service.validateLicense(license, "test-workspace")
require.Equal(t, common.Invalid, common.ErrorCode(err))
}
+func TestLoadSubscriptionFromDB(t *testing.T) {
+ ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
+ t.Cleanup(cancel)
+ _, stores, _ := testcontainer.NewMetadataDBWithCache(t, true)
+
+ _, err := stores.GetDB().ExecContext(ctx, `INSERT INTO workspace (resource_id) VALUES ('default')`)
+ require.NoError(t, err)
+ _, err = stores.UpsertSetting(ctx, &store.SettingMessage{
+ Name: storepb.SettingName_SYSTEM,
+ Workspace: "default",
+ Value: &storepb.SystemSetting{},
+ })
+ require.NoError(t, err)
+
+ privateKey, err := rsa.GenerateKey(rand.Reader, 2048)
+ require.NoError(t, err)
+ service := &LicenseService{
+ store: stores,
+ config: &Config{
+ PublicKey: &privateKey.PublicKey,
+ PrivateKey: privateKey,
+ Version: keyID,
+ Issuer: issuer,
+ Audience: audience,
+ },
+ cache: expirable.NewLRU[string, *v1pb.Subscription](8, nil, time.Minute),
+ }
+
+ stored, err := service.LoadSubscriptionFromDB(ctx, "default")
+ require.NoError(t, err)
+ require.Nil(t, stored)
+ require.Equal(t, v1pb.PlanType_FREE, service.LoadEffectiveSubscription(ctx, "default").Plan)
+
+ expiresAt := time.Now().Add(-time.Hour).UTC().Truncate(time.Second)
+ license, err := service.CreateLicense(&LicenseParams{
+ Plan: v1pb.PlanType_TEAM.String(),
+ WorkspaceID: "default",
+ Trialing: true,
+ ExpiresAt: expiresAt,
+ })
+ require.NoError(t, err)
+ require.NoError(t, stores.UpdateLicense(ctx, "default", license))
+ service.InvalidateCache("default")
+
+ stored, err = service.LoadSubscriptionFromDB(ctx, "default")
+ require.NoError(t, err)
+ require.Equal(t, v1pb.PlanType_TEAM, stored.Plan)
+ require.True(t, stored.Trialing)
+ require.Equal(t, expiresAt, stored.ExpiresTime.AsTime())
+
+ effective := service.LoadEffectiveSubscription(ctx, "default")
+ require.Equal(t, v1pb.PlanType_FREE, effective.Plan)
+ require.Equal(t, expiresAt, effective.ExpiresTime.AsTime())
+
+ require.NoError(t, stores.UpdateLicense(ctx, "default", "not-a-license"))
+ service.InvalidateCache("default")
+ _, err = service.LoadSubscriptionFromDB(ctx, "default")
+ require.Error(t, err)
+ require.Equal(t, v1pb.PlanType_FREE, service.LoadEffectiveSubscription(ctx, "default").Plan)
+}
+
func TestGetUserLimitUncached(t *testing.T) {
ctx := context.Background()
_, s, _ := testcontainer.NewMetadataDB(t)
diff --git a/backend/generated-go/v1/subscription_service.pb.go b/backend/generated-go/v1/subscription_service.pb.go
index 82096f6ecd..f436c85ebc 100644
--- a/backend/generated-go/v1/subscription_service.pb.go
+++ b/backend/generated-go/v1/subscription_service.pb.go
@@ -1677,6 +1677,42 @@ func (x *PlanLimitConfig) GetFeatures() []PlanFeature {
return nil
}
+type StartTrialRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *StartTrialRequest) Reset() {
+ *x = StartTrialRequest{}
+ mi := &file_v1_subscription_service_proto_msgTypes[21]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *StartTrialRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*StartTrialRequest) ProtoMessage() {}
+
+func (x *StartTrialRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_subscription_service_proto_msgTypes[21]
+ 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 StartTrialRequest.ProtoReflect.Descriptor instead.
+func (*StartTrialRequest) Descriptor() ([]byte, []int) {
+ return file_v1_subscription_service_proto_rawDescGZIP(), []int{21}
+}
+
var File_v1_subscription_service_proto protoreflect.FileDescriptor
const file_v1_subscription_service_proto_rawDesc = "" +
@@ -1770,7 +1806,8 @@ const file_v1_subscription_service_proto_rawDesc = "" +
"\x04type\x18\x01 \x01(\x0e2\x15.bytebase.v1.PlanTypeR\x04type\x124\n" +
"\x16maximum_instance_count\x18\x02 \x01(\x05R\x14maximumInstanceCount\x12,\n" +
"\x12maximum_seat_count\x18\x03 \x01(\x05R\x10maximumSeatCount\x124\n" +
- "\bfeatures\x18\x04 \x03(\x0e2\x18.bytebase.v1.PlanFeatureR\bfeatures*H\n" +
+ "\bfeatures\x18\x04 \x03(\x0e2\x18.bytebase.v1.PlanFeatureR\bfeatures\"\x13\n" +
+ "\x11StartTrialRequest*H\n" +
"\x0fBillingInterval\x12 \n" +
"\x1cBILLING_INTERVAL_UNSPECIFIED\x10\x00\x12\t\n" +
"\x05MONTH\x10\x01\x12\b\n" +
@@ -1854,11 +1891,13 @@ const file_v1_subscription_service_proto_rawDesc = "" +
"\x12FEATURE_CUSTOM_MSA\x10D\x12\x1d\n" +
"\x19FEATURE_COMMUNITY_SUPPORT\x10E\x12\x19\n" +
"\x15FEATURE_EMAIL_SUPPORT\x10F\x12&\n" +
- "\"FEATURE_DEDICATED_SUPPORT_WITH_SLA\x10G2\xf1\v\n" +
+ "\"FEATURE_DEDICATED_SUPPORT_WITH_SLA\x10G2\x8d\r\n" +
"\x13SubscriptionService\x12v\n" +
"\x0fGetSubscription\x12#.bytebase.v1.GetSubscriptionRequest\x1a\x19.bytebase.v1.Subscription\"#\xdaA\x00\xa0\xea0\x04\xa8\xea0\t\x82\xd3\xe4\x93\x02\x12\x12\x10/v1/subscription\x12\xcc\x01\n" +
"\x16ExportVCSProviderUsers\x12*.bytebase.v1.ExportVCSProviderUsersRequest\x1a+.bytebase.v1.ExportVCSProviderUsersResponse\"Y\x8a\xea0\x16bb.subscription.manage\x90\xea0\x01\x98\xea0\x01\xa0\xea0\x04\xa8\xea0\t\x82\xd3\xe4\x93\x02)\x12'/v1/subscription:vcsProviderUsersExport\x12\x9c\x01\n" +
- "\rUploadLicense\x12!.bytebase.v1.UploadLicenseRequest\x1a\x19.bytebase.v1.Subscription\"M\x8a\xea0\x16bb.subscription.manage\x90\xea0\x01\x98\xea0\x01\xa0\xea0\x04\xa8\xea0\t\x82\xd3\xe4\x93\x02\x1d:\x01*2\x18/v1/subscription/license\x12\xa3\x01\n" +
+ "\rUploadLicense\x12!.bytebase.v1.UploadLicenseRequest\x1a\x19.bytebase.v1.Subscription\"M\x8a\xea0\x16bb.subscription.manage\x90\xea0\x01\x98\xea0\x01\xa0\xea0\x04\xa8\xea0\t\x82\xd3\xe4\x93\x02\x1d:\x01*2\x18/v1/subscription/license\x12\x99\x01\n" +
+ "\n" +
+ "StartTrial\x12\x1e.bytebase.v1.StartTrialRequest\x1a\x19.bytebase.v1.Subscription\"P\x8a\xea0\x16bb.subscription.manage\x90\xea0\x01\x98\xea0\x01\xa0\xea0\x04\xa8\xea0\t\x82\xd3\xe4\x93\x02 :\x01*\"\x1b/v1/subscription:startTrial\x12\xa3\x01\n" +
"\x0eCreatePurchase\x12\".bytebase.v1.CreatePurchaseRequest\x1a\x1d.bytebase.v1.PurchaseResponse\"N\x8a\xea0\x16bb.subscription.manage\x90\xea0\x01\x98\xea0\x01\xa0\xea0\x04\xa8\xea0\t\x82\xd3\xe4\x93\x02\x1e:\x01*\"\x19/v1/subscription:purchase\x12\xa9\x01\n" +
"\x0eUpdatePurchase\x12\".bytebase.v1.UpdatePurchaseRequest\x1a\x1d.bytebase.v1.PurchaseResponse\"T\x8a\xea0\x16bb.subscription.manage\x90\xea0\x01\x98\xea0\x01\xa0\xea0\x04\xa8\xea0\t\x82\xd3\xe4\x93\x02$:\x01*\"\x1f/v1/subscription:updatePurchase\x12\xa9\x01\n" +
"\x0eCancelPurchase\x12\".bytebase.v1.CancelPurchaseRequest\x1a\x1d.bytebase.v1.PurchaseResponse\"T\x8a\xea0\x16bb.subscription.manage\x90\xea0\x01\x98\xea0\x01\xa0\xea0\x04\xa8\xea0\t\x82\xd3\xe4\x93\x02$:\x01*\"\x1f/v1/subscription:cancelPurchase\x12\x9a\x01\n" +
@@ -1880,7 +1919,7 @@ func file_v1_subscription_service_proto_rawDescGZIP() []byte {
}
var file_v1_subscription_service_proto_enumTypes = make([]protoimpl.EnumInfo, 5)
-var file_v1_subscription_service_proto_msgTypes = make([]protoimpl.MessageInfo, 21)
+var file_v1_subscription_service_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
var file_v1_subscription_service_proto_goTypes = []any{
(BillingInterval)(0), // 0: bytebase.v1.BillingInterval
(PlanType)(0), // 1: bytebase.v1.PlanType
@@ -1908,7 +1947,8 @@ var file_v1_subscription_service_proto_goTypes = []any{
(*Subscription)(nil), // 23: bytebase.v1.Subscription
(*PlanConfig)(nil), // 24: bytebase.v1.PlanConfig
(*PlanLimitConfig)(nil), // 25: bytebase.v1.PlanLimitConfig
- (*timestamppb.Timestamp)(nil), // 26: google.protobuf.Timestamp
+ (*StartTrialRequest)(nil), // 26: bytebase.v1.StartTrialRequest
+ (*timestamppb.Timestamp)(nil), // 27: google.protobuf.Timestamp
}
var file_v1_subscription_service_proto_depIdxs = []int32{
1, // 0: bytebase.v1.CreatePurchaseRequest.plan:type_name -> bytebase.v1.PlanType
@@ -1924,7 +1964,7 @@ var file_v1_subscription_service_proto_depIdxs = []int32{
4, // 10: bytebase.v1.PurchaseDiscount.type:type_name -> bytebase.v1.PurchaseDiscount.Type
17, // 11: bytebase.v1.ListPurchasePlansResponse.plans:type_name -> bytebase.v1.PurchasePlan
1, // 12: bytebase.v1.Subscription.plan:type_name -> bytebase.v1.PlanType
- 26, // 13: bytebase.v1.Subscription.expires_time:type_name -> google.protobuf.Timestamp
+ 27, // 13: bytebase.v1.Subscription.expires_time:type_name -> google.protobuf.Timestamp
25, // 14: bytebase.v1.PlanConfig.plans:type_name -> bytebase.v1.PlanLimitConfig
2, // 15: bytebase.v1.PlanConfig.instance_features:type_name -> bytebase.v1.PlanFeature
1, // 16: bytebase.v1.PlanLimitConfig.type:type_name -> bytebase.v1.PlanType
@@ -1932,23 +1972,25 @@ var file_v1_subscription_service_proto_depIdxs = []int32{
5, // 18: bytebase.v1.SubscriptionService.GetSubscription:input_type -> bytebase.v1.GetSubscriptionRequest
6, // 19: bytebase.v1.SubscriptionService.ExportVCSProviderUsers:input_type -> bytebase.v1.ExportVCSProviderUsersRequest
8, // 20: bytebase.v1.SubscriptionService.UploadLicense:input_type -> bytebase.v1.UploadLicenseRequest
- 9, // 21: bytebase.v1.SubscriptionService.CreatePurchase:input_type -> bytebase.v1.CreatePurchaseRequest
- 13, // 22: bytebase.v1.SubscriptionService.UpdatePurchase:input_type -> bytebase.v1.UpdatePurchaseRequest
- 14, // 23: bytebase.v1.SubscriptionService.CancelPurchase:input_type -> bytebase.v1.CancelPurchaseRequest
- 15, // 24: bytebase.v1.SubscriptionService.GetPaymentInfo:input_type -> bytebase.v1.GetPaymentInfoRequest
- 11, // 25: bytebase.v1.SubscriptionService.VerifyCheckoutSession:input_type -> bytebase.v1.VerifyCheckoutSessionRequest
- 21, // 26: bytebase.v1.SubscriptionService.ListPurchasePlans:input_type -> bytebase.v1.ListPurchasePlansRequest
- 23, // 27: bytebase.v1.SubscriptionService.GetSubscription:output_type -> bytebase.v1.Subscription
- 7, // 28: bytebase.v1.SubscriptionService.ExportVCSProviderUsers:output_type -> bytebase.v1.ExportVCSProviderUsersResponse
- 23, // 29: bytebase.v1.SubscriptionService.UploadLicense:output_type -> bytebase.v1.Subscription
- 10, // 30: bytebase.v1.SubscriptionService.CreatePurchase:output_type -> bytebase.v1.PurchaseResponse
- 10, // 31: bytebase.v1.SubscriptionService.UpdatePurchase:output_type -> bytebase.v1.PurchaseResponse
- 10, // 32: bytebase.v1.SubscriptionService.CancelPurchase:output_type -> bytebase.v1.PurchaseResponse
- 16, // 33: bytebase.v1.SubscriptionService.GetPaymentInfo:output_type -> bytebase.v1.PaymentInfo
- 12, // 34: bytebase.v1.SubscriptionService.VerifyCheckoutSession:output_type -> bytebase.v1.VerifyCheckoutSessionResponse
- 22, // 35: bytebase.v1.SubscriptionService.ListPurchasePlans:output_type -> bytebase.v1.ListPurchasePlansResponse
- 27, // [27:36] is the sub-list for method output_type
- 18, // [18:27] is the sub-list for method input_type
+ 26, // 21: bytebase.v1.SubscriptionService.StartTrial:input_type -> bytebase.v1.StartTrialRequest
+ 9, // 22: bytebase.v1.SubscriptionService.CreatePurchase:input_type -> bytebase.v1.CreatePurchaseRequest
+ 13, // 23: bytebase.v1.SubscriptionService.UpdatePurchase:input_type -> bytebase.v1.UpdatePurchaseRequest
+ 14, // 24: bytebase.v1.SubscriptionService.CancelPurchase:input_type -> bytebase.v1.CancelPurchaseRequest
+ 15, // 25: bytebase.v1.SubscriptionService.GetPaymentInfo:input_type -> bytebase.v1.GetPaymentInfoRequest
+ 11, // 26: bytebase.v1.SubscriptionService.VerifyCheckoutSession:input_type -> bytebase.v1.VerifyCheckoutSessionRequest
+ 21, // 27: bytebase.v1.SubscriptionService.ListPurchasePlans:input_type -> bytebase.v1.ListPurchasePlansRequest
+ 23, // 28: bytebase.v1.SubscriptionService.GetSubscription:output_type -> bytebase.v1.Subscription
+ 7, // 29: bytebase.v1.SubscriptionService.ExportVCSProviderUsers:output_type -> bytebase.v1.ExportVCSProviderUsersResponse
+ 23, // 30: bytebase.v1.SubscriptionService.UploadLicense:output_type -> bytebase.v1.Subscription
+ 23, // 31: bytebase.v1.SubscriptionService.StartTrial:output_type -> bytebase.v1.Subscription
+ 10, // 32: bytebase.v1.SubscriptionService.CreatePurchase:output_type -> bytebase.v1.PurchaseResponse
+ 10, // 33: bytebase.v1.SubscriptionService.UpdatePurchase:output_type -> bytebase.v1.PurchaseResponse
+ 10, // 34: bytebase.v1.SubscriptionService.CancelPurchase:output_type -> bytebase.v1.PurchaseResponse
+ 16, // 35: bytebase.v1.SubscriptionService.GetPaymentInfo:output_type -> bytebase.v1.PaymentInfo
+ 12, // 36: bytebase.v1.SubscriptionService.VerifyCheckoutSession:output_type -> bytebase.v1.VerifyCheckoutSessionResponse
+ 22, // 37: bytebase.v1.SubscriptionService.ListPurchasePlans:output_type -> bytebase.v1.ListPurchasePlansResponse
+ 28, // [28:38] is the sub-list for method output_type
+ 18, // [18:28] is the sub-list for method input_type
18, // [18:18] is the sub-list for extension type_name
18, // [18:18] is the sub-list for extension extendee
0, // [0:18] is the sub-list for field type_name
@@ -1966,7 +2008,7 @@ func file_v1_subscription_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_subscription_service_proto_rawDesc), len(file_v1_subscription_service_proto_rawDesc)),
NumEnums: 5,
- NumMessages: 21,
+ NumMessages: 22,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/backend/generated-go/v1/subscription_service.pb.gw.go b/backend/generated-go/v1/subscription_service.pb.gw.go
index afff46c86b..808256c0b8 100644
--- a/backend/generated-go/v1/subscription_service.pb.gw.go
+++ b/backend/generated-go/v1/subscription_service.pb.gw.go
@@ -104,6 +104,33 @@ func local_request_SubscriptionService_UploadLicense_0(ctx context.Context, mars
return msg, metadata, err
}
+func request_SubscriptionService_StartTrial_0(ctx context.Context, marshaler runtime.Marshaler, client SubscriptionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq StartTrialRequest
+ metadata runtime.ServerMetadata
+ )
+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if req.Body != nil {
+ _, _ = io.Copy(io.Discard, req.Body)
+ }
+ msg, err := client.StartTrial(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_SubscriptionService_StartTrial_0(ctx context.Context, marshaler runtime.Marshaler, server SubscriptionServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq StartTrialRequest
+ metadata runtime.ServerMetadata
+ )
+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ msg, err := server.StartTrial(ctx, &protoReq)
+ return msg, metadata, err
+}
+
func request_SubscriptionService_CreatePurchase_0(ctx context.Context, marshaler runtime.Marshaler, client SubscriptionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq CreatePurchaseRequest
@@ -332,6 +359,26 @@ func RegisterSubscriptionServiceHandlerServer(ctx context.Context, mux *runtime.
}
forward_SubscriptionService_UploadLicense_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodPost, pattern_SubscriptionService_StartTrial_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.SubscriptionService/StartTrial", runtime.WithHTTPPathPattern("/v1/subscription:startTrial"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_SubscriptionService_StartTrial_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_SubscriptionService_StartTrial_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
mux.Handle(http.MethodPost, pattern_SubscriptionService_CreatePurchase_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -543,6 +590,23 @@ func RegisterSubscriptionServiceHandlerClient(ctx context.Context, mux *runtime.
}
forward_SubscriptionService_UploadLicense_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodPost, pattern_SubscriptionService_StartTrial_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.SubscriptionService/StartTrial", runtime.WithHTTPPathPattern("/v1/subscription:startTrial"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_SubscriptionService_StartTrial_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_SubscriptionService_StartTrial_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
mux.Handle(http.MethodPost, pattern_SubscriptionService_CreatePurchase_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -652,6 +716,7 @@ var (
pattern_SubscriptionService_GetSubscription_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "subscription"}, ""))
pattern_SubscriptionService_ExportVCSProviderUsers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "subscription"}, "vcsProviderUsersExport"))
pattern_SubscriptionService_UploadLicense_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "subscription", "license"}, ""))
+ pattern_SubscriptionService_StartTrial_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "subscription"}, "startTrial"))
pattern_SubscriptionService_CreatePurchase_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "subscription"}, "purchase"))
pattern_SubscriptionService_UpdatePurchase_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "subscription"}, "updatePurchase"))
pattern_SubscriptionService_CancelPurchase_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "subscription"}, "cancelPurchase"))
@@ -664,6 +729,7 @@ var (
forward_SubscriptionService_GetSubscription_0 = runtime.ForwardResponseMessage
forward_SubscriptionService_ExportVCSProviderUsers_0 = runtime.ForwardResponseMessage
forward_SubscriptionService_UploadLicense_0 = runtime.ForwardResponseMessage
+ forward_SubscriptionService_StartTrial_0 = runtime.ForwardResponseMessage
forward_SubscriptionService_CreatePurchase_0 = runtime.ForwardResponseMessage
forward_SubscriptionService_UpdatePurchase_0 = runtime.ForwardResponseMessage
forward_SubscriptionService_CancelPurchase_0 = runtime.ForwardResponseMessage
diff --git a/backend/generated-go/v1/subscription_service_equal.pb.go b/backend/generated-go/v1/subscription_service_equal.pb.go
index d183db656f..656e0402db 100644
--- a/backend/generated-go/v1/subscription_service_equal.pb.go
+++ b/backend/generated-go/v1/subscription_service_equal.pb.go
@@ -395,3 +395,13 @@ func (x *PlanLimitConfig) Equal(y *PlanLimitConfig) bool {
}
return true
}
+
+func (x *StartTrialRequest) Equal(y *StartTrialRequest) bool {
+ if x == y {
+ return true
+ }
+ if x == nil || y == nil {
+ return x == nil && y == nil
+ }
+ return true
+}
diff --git a/backend/generated-go/v1/subscription_service_grpc.pb.go b/backend/generated-go/v1/subscription_service_grpc.pb.go
index 039fbf039d..2f9962bfbd 100644
--- a/backend/generated-go/v1/subscription_service_grpc.pb.go
+++ b/backend/generated-go/v1/subscription_service_grpc.pb.go
@@ -22,6 +22,7 @@ const (
SubscriptionService_GetSubscription_FullMethodName = "/bytebase.v1.SubscriptionService/GetSubscription"
SubscriptionService_ExportVCSProviderUsers_FullMethodName = "/bytebase.v1.SubscriptionService/ExportVCSProviderUsers"
SubscriptionService_UploadLicense_FullMethodName = "/bytebase.v1.SubscriptionService/UploadLicense"
+ SubscriptionService_StartTrial_FullMethodName = "/bytebase.v1.SubscriptionService/StartTrial"
SubscriptionService_CreatePurchase_FullMethodName = "/bytebase.v1.SubscriptionService/CreatePurchase"
SubscriptionService_UpdatePurchase_FullMethodName = "/bytebase.v1.SubscriptionService/UpdatePurchase"
SubscriptionService_CancelPurchase_FullMethodName = "/bytebase.v1.SubscriptionService/CancelPurchase"
@@ -44,6 +45,8 @@ type SubscriptionServiceClient interface {
ExportVCSProviderUsers(ctx context.Context, in *ExportVCSProviderUsersRequest, opts ...grpc.CallOption) (*ExportVCSProviderUsersResponse, error)
// Uploads an enterprise license (self-hosted only).
UploadLicense(ctx context.Context, in *UploadLicenseRequest, opts ...grpc.CallOption) (*Subscription, error)
+ // StartTrial starts a free trial for an eligible SaaS workspace.
+ StartTrial(ctx context.Context, in *StartTrialRequest, opts ...grpc.CallOption) (*Subscription, error)
// CreatePurchase creates a new subscription purchase (SaaS only).
// Returns a Stripe Checkout URL for the user to complete payment.
CreatePurchase(ctx context.Context, in *CreatePurchaseRequest, opts ...grpc.CallOption) (*PurchaseResponse, error)
@@ -98,6 +101,16 @@ func (c *subscriptionServiceClient) UploadLicense(ctx context.Context, in *Uploa
return out, nil
}
+func (c *subscriptionServiceClient) StartTrial(ctx context.Context, in *StartTrialRequest, opts ...grpc.CallOption) (*Subscription, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(Subscription)
+ err := c.cc.Invoke(ctx, SubscriptionService_StartTrial_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
func (c *subscriptionServiceClient) CreatePurchase(ctx context.Context, in *CreatePurchaseRequest, opts ...grpc.CallOption) (*PurchaseResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PurchaseResponse)
@@ -172,6 +185,8 @@ type SubscriptionServiceServer interface {
ExportVCSProviderUsers(context.Context, *ExportVCSProviderUsersRequest) (*ExportVCSProviderUsersResponse, error)
// Uploads an enterprise license (self-hosted only).
UploadLicense(context.Context, *UploadLicenseRequest) (*Subscription, error)
+ // StartTrial starts a free trial for an eligible SaaS workspace.
+ StartTrial(context.Context, *StartTrialRequest) (*Subscription, error)
// CreatePurchase creates a new subscription purchase (SaaS only).
// Returns a Stripe Checkout URL for the user to complete payment.
CreatePurchase(context.Context, *CreatePurchaseRequest) (*PurchaseResponse, error)
@@ -205,6 +220,9 @@ func (UnimplementedSubscriptionServiceServer) ExportVCSProviderUsers(context.Con
func (UnimplementedSubscriptionServiceServer) UploadLicense(context.Context, *UploadLicenseRequest) (*Subscription, error) {
return nil, status.Error(codes.Unimplemented, "method UploadLicense not implemented")
}
+func (UnimplementedSubscriptionServiceServer) StartTrial(context.Context, *StartTrialRequest) (*Subscription, error) {
+ return nil, status.Error(codes.Unimplemented, "method StartTrial not implemented")
+}
func (UnimplementedSubscriptionServiceServer) CreatePurchase(context.Context, *CreatePurchaseRequest) (*PurchaseResponse, error) {
return nil, status.Error(codes.Unimplemented, "method CreatePurchase not implemented")
}
@@ -298,6 +316,24 @@ func _SubscriptionService_UploadLicense_Handler(srv interface{}, ctx context.Con
return interceptor(ctx, in, info, handler)
}
+func _SubscriptionService_StartTrial_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(StartTrialRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(SubscriptionServiceServer).StartTrial(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: SubscriptionService_StartTrial_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(SubscriptionServiceServer).StartTrial(ctx, req.(*StartTrialRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
func _SubscriptionService_CreatePurchase_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreatePurchaseRequest)
if err := dec(in); err != nil {
@@ -425,6 +461,10 @@ var SubscriptionService_ServiceDesc = grpc.ServiceDesc{
MethodName: "UploadLicense",
Handler: _SubscriptionService_UploadLicense_Handler,
},
+ {
+ MethodName: "StartTrial",
+ Handler: _SubscriptionService_StartTrial_Handler,
+ },
{
MethodName: "CreatePurchase",
Handler: _SubscriptionService_CreatePurchase_Handler,
diff --git a/backend/generated-go/v1/v1connect/subscription_service.connect.go b/backend/generated-go/v1/v1connect/subscription_service.connect.go
index db9aa00d6f..2228636a90 100644
--- a/backend/generated-go/v1/v1connect/subscription_service.connect.go
+++ b/backend/generated-go/v1/v1connect/subscription_service.connect.go
@@ -42,6 +42,9 @@ const (
// SubscriptionServiceUploadLicenseProcedure is the fully-qualified name of the
// SubscriptionService's UploadLicense RPC.
SubscriptionServiceUploadLicenseProcedure = "/bytebase.v1.SubscriptionService/UploadLicense"
+ // SubscriptionServiceStartTrialProcedure is the fully-qualified name of the SubscriptionService's
+ // StartTrial RPC.
+ SubscriptionServiceStartTrialProcedure = "/bytebase.v1.SubscriptionService/StartTrial"
// SubscriptionServiceCreatePurchaseProcedure is the fully-qualified name of the
// SubscriptionService's CreatePurchase RPC.
SubscriptionServiceCreatePurchaseProcedure = "/bytebase.v1.SubscriptionService/CreatePurchase"
@@ -72,6 +75,8 @@ type SubscriptionServiceClient interface {
ExportVCSProviderUsers(context.Context, *connect.Request[v1.ExportVCSProviderUsersRequest]) (*connect.Response[v1.ExportVCSProviderUsersResponse], error)
// Uploads an enterprise license (self-hosted only).
UploadLicense(context.Context, *connect.Request[v1.UploadLicenseRequest]) (*connect.Response[v1.Subscription], error)
+ // StartTrial starts a free trial for an eligible SaaS workspace.
+ StartTrial(context.Context, *connect.Request[v1.StartTrialRequest]) (*connect.Response[v1.Subscription], error)
// CreatePurchase creates a new subscription purchase (SaaS only).
// Returns a Stripe Checkout URL for the user to complete payment.
CreatePurchase(context.Context, *connect.Request[v1.CreatePurchaseRequest]) (*connect.Response[v1.PurchaseResponse], error)
@@ -117,6 +122,12 @@ func NewSubscriptionServiceClient(httpClient connect.HTTPClient, baseURL string,
connect.WithSchema(subscriptionServiceMethods.ByName("UploadLicense")),
connect.WithClientOptions(opts...),
),
+ startTrial: connect.NewClient[v1.StartTrialRequest, v1.Subscription](
+ httpClient,
+ baseURL+SubscriptionServiceStartTrialProcedure,
+ connect.WithSchema(subscriptionServiceMethods.ByName("StartTrial")),
+ connect.WithClientOptions(opts...),
+ ),
createPurchase: connect.NewClient[v1.CreatePurchaseRequest, v1.PurchaseResponse](
httpClient,
baseURL+SubscriptionServiceCreatePurchaseProcedure,
@@ -161,6 +172,7 @@ type subscriptionServiceClient struct {
getSubscription *connect.Client[v1.GetSubscriptionRequest, v1.Subscription]
exportVCSProviderUsers *connect.Client[v1.ExportVCSProviderUsersRequest, v1.ExportVCSProviderUsersResponse]
uploadLicense *connect.Client[v1.UploadLicenseRequest, v1.Subscription]
+ startTrial *connect.Client[v1.StartTrialRequest, v1.Subscription]
createPurchase *connect.Client[v1.CreatePurchaseRequest, v1.PurchaseResponse]
updatePurchase *connect.Client[v1.UpdatePurchaseRequest, v1.PurchaseResponse]
cancelPurchase *connect.Client[v1.CancelPurchaseRequest, v1.PurchaseResponse]
@@ -184,6 +196,11 @@ func (c *subscriptionServiceClient) UploadLicense(ctx context.Context, req *conn
return c.uploadLicense.CallUnary(ctx, req)
}
+// StartTrial calls bytebase.v1.SubscriptionService.StartTrial.
+func (c *subscriptionServiceClient) StartTrial(ctx context.Context, req *connect.Request[v1.StartTrialRequest]) (*connect.Response[v1.Subscription], error) {
+ return c.startTrial.CallUnary(ctx, req)
+}
+
// CreatePurchase calls bytebase.v1.SubscriptionService.CreatePurchase.
func (c *subscriptionServiceClient) CreatePurchase(ctx context.Context, req *connect.Request[v1.CreatePurchaseRequest]) (*connect.Response[v1.PurchaseResponse], error) {
return c.createPurchase.CallUnary(ctx, req)
@@ -224,6 +241,8 @@ type SubscriptionServiceHandler interface {
ExportVCSProviderUsers(context.Context, *connect.Request[v1.ExportVCSProviderUsersRequest]) (*connect.Response[v1.ExportVCSProviderUsersResponse], error)
// Uploads an enterprise license (self-hosted only).
UploadLicense(context.Context, *connect.Request[v1.UploadLicenseRequest]) (*connect.Response[v1.Subscription], error)
+ // StartTrial starts a free trial for an eligible SaaS workspace.
+ StartTrial(context.Context, *connect.Request[v1.StartTrialRequest]) (*connect.Response[v1.Subscription], error)
// CreatePurchase creates a new subscription purchase (SaaS only).
// Returns a Stripe Checkout URL for the user to complete payment.
CreatePurchase(context.Context, *connect.Request[v1.CreatePurchaseRequest]) (*connect.Response[v1.PurchaseResponse], error)
@@ -265,6 +284,12 @@ func NewSubscriptionServiceHandler(svc SubscriptionServiceHandler, opts ...conne
connect.WithSchema(subscriptionServiceMethods.ByName("UploadLicense")),
connect.WithHandlerOptions(opts...),
)
+ subscriptionServiceStartTrialHandler := connect.NewUnaryHandler(
+ SubscriptionServiceStartTrialProcedure,
+ svc.StartTrial,
+ connect.WithSchema(subscriptionServiceMethods.ByName("StartTrial")),
+ connect.WithHandlerOptions(opts...),
+ )
subscriptionServiceCreatePurchaseHandler := connect.NewUnaryHandler(
SubscriptionServiceCreatePurchaseProcedure,
svc.CreatePurchase,
@@ -309,6 +334,8 @@ func NewSubscriptionServiceHandler(svc SubscriptionServiceHandler, opts ...conne
subscriptionServiceExportVCSProviderUsersHandler.ServeHTTP(w, r)
case SubscriptionServiceUploadLicenseProcedure:
subscriptionServiceUploadLicenseHandler.ServeHTTP(w, r)
+ case SubscriptionServiceStartTrialProcedure:
+ subscriptionServiceStartTrialHandler.ServeHTTP(w, r)
case SubscriptionServiceCreatePurchaseProcedure:
subscriptionServiceCreatePurchaseHandler.ServeHTTP(w, r)
case SubscriptionServiceUpdatePurchaseProcedure:
@@ -342,6 +369,10 @@ func (UnimplementedSubscriptionServiceHandler) UploadLicense(context.Context, *c
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.SubscriptionService.UploadLicense is not implemented"))
}
+func (UnimplementedSubscriptionServiceHandler) StartTrial(context.Context, *connect.Request[v1.StartTrialRequest]) (*connect.Response[v1.Subscription], error) {
+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.SubscriptionService.StartTrial is not implemented"))
+}
+
func (UnimplementedSubscriptionServiceHandler) CreatePurchase(context.Context, *connect.Request[v1.CreatePurchaseRequest]) (*connect.Response[v1.PurchaseResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.SubscriptionService.CreatePurchase is not implemented"))
}
diff --git a/backend/store/subscription.go b/backend/store/subscription.go
index 2ee92d15cf..819bb96d13 100644
--- a/backend/store/subscription.go
+++ b/backend/store/subscription.go
@@ -8,11 +8,15 @@ import (
"github.com/pkg/errors"
"google.golang.org/protobuf/encoding/protojson"
+ "google.golang.org/protobuf/proto"
"github.com/bytebase/bytebase/backend/common"
storepb "github.com/bytebase/bytebase/backend/generated-go/store"
)
+// ErrTrialNotEligible means the workspace already has subscription history or a license.
+var ErrTrialNotEligible = errors.New("workspace is not eligible for a trial")
+
// SubscriptionMessage is the message for a workspace subscription.
type SubscriptionMessage struct {
Workspace string
@@ -70,3 +74,33 @@ func (s *Store) GetSubscriptionByWorkspace(ctx context.Context, workspace string
sub.Etag = generateEtag(sub.UpdatedAt)
return sub, nil
}
+
+// CreateTrialLicense stores a trial license only when the workspace has no
+// subscription history and no existing license.
+func (s *Store) CreateTrialLicense(ctx context.Context, workspace string, license string) error {
+ existing, err := s.GetSubscriptionByWorkspace(ctx, workspace)
+ if err != nil {
+ return errors.Wrap(err, "failed to check subscription history")
+ }
+ if existing != nil {
+ return ErrTrialNotEligible
+ }
+
+ if _, err := s.UpdateSettingAtomic(ctx, workspace, storepb.SettingName_SYSTEM, func(current proto.Message) (proto.Message, error) {
+ systemSetting, ok := current.(*storepb.SystemSetting)
+ if !ok {
+ return nil, errors.Errorf("invalid system setting value type %T", current)
+ }
+ if systemSetting.License != "" {
+ return nil, ErrTrialNotEligible
+ }
+ systemSetting.License = license
+ return systemSetting, nil
+ }, nil); err != nil {
+ if errors.Is(err, ErrTrialNotEligible) {
+ return err
+ }
+ return errors.Wrap(err, "failed to update system setting")
+ }
+ return nil
+}
diff --git a/backend/store/subscription_trial_test.go b/backend/store/subscription_trial_test.go
new file mode 100644
index 0000000000..a37a4ab343
--- /dev/null
+++ b/backend/store/subscription_trial_test.go
@@ -0,0 +1,124 @@
+package store_test
+
+import (
+ "context"
+ "sync"
+ "testing"
+ "time"
+
+ "github.com/stretchr/testify/require"
+ "google.golang.org/protobuf/types/known/timestamppb"
+
+ "github.com/bytebase/bytebase/backend/common/testcontainer"
+ storepb "github.com/bytebase/bytebase/backend/generated-go/store"
+ "github.com/bytebase/bytebase/backend/store"
+)
+
+func newTrialLicenseFixture(t *testing.T) (context.Context, *store.Store) {
+ t.Helper()
+ ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
+ t.Cleanup(cancel)
+ _, stores, _ := testcontainer.NewMetadataDBWithCache(t, true)
+
+ _, err := stores.GetDB().ExecContext(ctx, `INSERT INTO workspace (resource_id) VALUES ('default')`)
+ require.NoError(t, err)
+ _, err = stores.UpsertSetting(ctx, &store.SettingMessage{
+ Name: storepb.SettingName_SYSTEM,
+ Workspace: "default",
+ Value: &storepb.SystemSetting{},
+ })
+ require.NoError(t, err)
+ return ctx, stores
+}
+
+func TestCreateTrialLicenseRejectsSubscriptionHistory(t *testing.T) {
+ t.Parallel()
+ for _, tc := range []struct {
+ name string
+ payload *storepb.SubscriptionPayload
+ }{
+ {name: "active", payload: &storepb.SubscriptionPayload{Status: storepb.SubscriptionPayload_ACTIVE}},
+ {name: "paused", payload: &storepb.SubscriptionPayload{Status: storepb.SubscriptionPayload_PAUSED}},
+ {name: "canceled", payload: &storepb.SubscriptionPayload{Status: storepb.SubscriptionPayload_CANCELED}},
+ {name: "unspecified", payload: &storepb.SubscriptionPayload{}},
+ {name: "expired", payload: &storepb.SubscriptionPayload{
+ Status: storepb.SubscriptionPayload_ACTIVE,
+ ExpiresAt: timestamppb.New(time.Now().Add(-time.Hour)),
+ }},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ t.Parallel()
+ ctx, stores := newTrialLicenseFixture(t)
+
+ _, err := stores.UpsertSubscription(ctx, "default", tc.payload)
+ require.NoError(t, err)
+
+ err = stores.CreateTrialLicense(ctx, "default", "trial-license")
+ require.ErrorIs(t, err, store.ErrTrialNotEligible)
+
+ setting, err := stores.GetSystemSettingUncached(ctx, "default")
+ require.NoError(t, err)
+ require.Empty(t, setting.License)
+ })
+ }
+}
+
+func TestCreateTrialLicenseRejectsExistingLicense(t *testing.T) {
+ t.Parallel()
+ ctx, stores := newTrialLicenseFixture(t)
+ require.NoError(t, stores.UpdateLicense(ctx, "default", "existing-license"))
+
+ err := stores.CreateTrialLicense(ctx, "default", "trial-license")
+ require.ErrorIs(t, err, store.ErrTrialNotEligible)
+
+ setting, err := stores.GetSystemSettingUncached(ctx, "default")
+ require.NoError(t, err)
+ require.Equal(t, "existing-license", setting.License)
+}
+
+func TestCreateTrialLicenseConcurrentCallsCreateOnce(t *testing.T) {
+ t.Parallel()
+ ctx, stores := newTrialLicenseFixture(t)
+
+ type result struct {
+ license string
+ err error
+ }
+ start := make(chan struct{})
+ results := make(chan result, 2)
+ var ready sync.WaitGroup
+ ready.Add(2)
+ for _, license := range []string{"trial-license-a", "trial-license-b"} {
+ go func(license string) {
+ ready.Done()
+ <-start
+ err := stores.CreateTrialLicense(ctx, "default", license)
+ results <- result{license: license, err: err}
+ }(license)
+ }
+ ready.Wait()
+ close(start)
+
+ var winner string
+ for range 2 {
+ select {
+ case result := <-results:
+ if result.err == nil {
+ require.Empty(t, winner, "only one trial may be created")
+ winner = result.license
+ } else {
+ require.ErrorIs(t, result.err, store.ErrTrialNotEligible)
+ }
+ case <-time.After(15 * time.Second):
+ t.Fatal("trial creation did not complete; possible deadlock")
+ }
+ }
+ require.NotEmpty(t, winner)
+
+ setting, err := stores.GetSystemSettingUncached(ctx, "default")
+ require.NoError(t, err)
+ require.Equal(t, winner, setting.License)
+ cached, err := stores.GetSystemSetting(ctx, "default")
+ require.NoError(t, err)
+ require.Equal(t, winner, cached.License)
+}
diff --git a/frontend/src/types/proto-es/v1/subscription_service_pb.d.ts b/frontend/src/types/proto-es/v1/subscription_service_pb.d.ts
index ec3e218566..a146bbba8f 100644
--- a/frontend/src/types/proto-es/v1/subscription_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/subscription_service_pb.d.ts
@@ -592,6 +592,18 @@ export declare type PlanLimitConfig = Message<"bytebase.v1.PlanLimitConfig"> & {
*/
export declare const PlanLimitConfigSchema: GenMessage<PlanLimitConfig>;
+/**
+ * @generated from message bytebase.v1.StartTrialRequest
+ */
+export declare type StartTrialRequest = Message<"bytebase.v1.StartTrialRequest"> & {
+};
+
+/**
+ * Describes the message bytebase.v1.StartTrialRequest.
+ * Use `create(StartTrialRequestSchema)` to create a new message.
+ */
+export declare const StartTrialRequestSchema: GenMessage<StartTrialRequest>;
+
/**
* @generated from enum bytebase.v1.BillingInterval
*/
@@ -1074,6 +1086,16 @@ export declare const SubscriptionService: GenService<{
input: typeof UploadLicenseRequestSchema;
output: typeof SubscriptionSchema;
},
+ /**
+ * StartTrial starts a free trial for an eligible SaaS workspace.
+ *
+ * @generated from rpc bytebase.v1.SubscriptionService.StartTrial
+ */
+ startTrial: {
+ methodKind: "unary";
+ input: typeof StartTrialRequestSchema;
+ output: typeof SubscriptionSchema;
+ },
/**
* CreatePurchase creates a new subscription purchase (SaaS only).
* Returns a Stripe Checkout URL for the user to complete payment.
diff --git a/frontend/src/types/proto-es/v1/subscription_service_pb.js b/frontend/src/types/proto-es/v1/subscription_service_pb.js
index 3fd9a7cd20..63441f5269 100644
--- a/frontend/src/types/proto-es/v1/subscription_service_pb.js
+++ b/frontend/src/types/proto-es/v1/subscription_service_pb.js
@@ -13,7 +13,7 @@ import { file_v1_annotation } from "./annotation_pb";
* Describes the file v1/subscription_service.proto.
*/
export const file_v1_subscription_service = /*@__PURE__*/
- fileDesc("Ch12MS9zdWJzY3JpcHRpb25fc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiGAoWR2V0U3Vic2NyaXB0aW9uUmVxdWVzdCIfCh1FeHBvcnRWQ1NQcm92aWRlclVzZXJzUmVxdWVzdCI3Ch5FeHBvcnRWQ1NQcm92aWRlclVzZXJzUmVzcG9uc2USFQoHY29udGVudBgBIAEoDEIE0OowAiItChRVcGxvYWRMaWNlbnNlUmVxdWVzdBIVCgdsaWNlbnNlGAEgASgJQgTQ6jABInsKFUNyZWF0ZVB1cmNoYXNlUmVxdWVzdBIjCgRwbGFuGAEgASgOMhUuYnl0ZWJhc2UudjEuUGxhblR5cGUSLgoIaW50ZXJ2YWwYAiABKA4yHC5ieXRlYmFzZS52MS5CaWxsaW5nSW50ZXJ2YWwSDQoFc2VhdHMYAyABKAUiRwoQUHVyY2hhc2VSZXNwb25zZRIZCgtwYXltZW50X3VybBgBIAEoCUIE0OowARIYCgpzZXNzaW9uX2lkGAIgASgJQgTQ6jABIjgKHFZlcmlmeUNoZWNrb3V0U2Vzc2lvblJlcXVlc3QSGAoKc2Vzc2lvbl9pZBgBIAEoCUIE0OowASIvCh1WZXJpZnlDaGVja291dFNlc3Npb25SZXNwb25zZRIOCgZzdGF0dXMYASABKAkiiQEKFVVwZGF0ZVB1cmNoYXNlUmVxdWVzdBIjCgRwbGFuGAEgASgOMhUuYnl0ZWJhc2UudjEuUGxhblR5cGUSLgoIaW50ZXJ2YWwYAiABKA4yHC5ieXRlYmFzZS52MS5CaWxsaW5nSW50ZXJ2YWwSDQoFc2VhdHMYAyABKAUSDAoEZXRhZxgEIAEoCSI6ChVDYW5jZWxQdXJjaGFzZVJlcXVlc3QSEAoIZmVlZGJhY2sYASABKAkSDwoHY29tbWVudBgCIAEoCSIXChVHZXRQYXltZW50SW5mb1JlcXVlc3QirAEKC1BheW1lbnRJbmZvEhMKC3RvdGFsX3ByaWNlGAEgASgJEhAKCGN1cnJlbmN5GAIgASgJEhQKDHBlcmlvZF9zdGFydBgDIAEoCRISCgpwZXJpb2RfZW5kGAQgASgJEhMKC2ludm9pY2VfdXJsGAUgASgJEhwKFGNhbmNlbF9hdF9wZXJpb2RfZW5kGAYgASgIEhkKEW5leHRfcGVyaW9kX3ByaWNlGAcgASgJIskBCgxQdXJjaGFzZVBsYW4SIwoEdHlwZRgBIAEoDjIVLmJ5dGViYXNlLnYxLlBsYW5UeXBlEh0KFXNlbGZfc2VydmljZV9wdXJjaGFzZRgCIAEoCBI4CgthZGRpdGlvbmFscxgDIAMoCzIjLmJ5dGViYXNlLnYxLlB1cmNoYXNlUGxhbkFkZGl0aW9uYWwSOwoPYmlsbGluZ19tZXRob2RzGAQgAygLMiIuYnl0ZWJhc2UudjEuUHVyY2hhc2VCaWxsaW5nTWV0aG9kIs4BChZQdXJjaGFzZVBsYW5BZGRpdGlvbmFsEjYKBHR5cGUYASABKA4yKC5ieXRlYmFzZS52MS5QdXJjaGFzZVBsYW5BZGRpdGlvbmFsLlR5cGUSEgoKdW5pdF9wcmljZRgCIAEoBRISCgpmcmVlX2NvdW50GAMgASgFEhUKDW1pbmltdW1fY291bnQYBCABKAUSFQoNbWF4aW11bV9jb3VudBgFIAEoBSImCgRUeXBlEhQKEFRZUEVfVU5TUEVDSUZJRUQQABIICgRVU0VSEAEieAoVUHVyY2hhc2VCaWxsaW5nTWV0aG9kEi4KCGludGVydmFsGAEgASgOMhwuYnl0ZWJhc2UudjEuQmlsbGluZ0ludGVydmFsEi8KCGRpc2NvdW50GAIgASgLMh0uYnl0ZWJhc2UudjEuUHVyY2hhc2VEaXNjb3VudCKvAQoQUHVyY2hhc2VEaXNjb3VudBIwCgR0eXBlGAEgASgOMiIuYnl0ZWJhc2UudjEuUHVyY2hhc2VEaXNjb3VudC5UeXBlEg0KBXZhbHVlGAIgASgFIloKBFR5cGUSFAoQVFlQRV9VTlNQRUNJRklFRBAAEhIKDlBFUkNFTlRBR0VfT0ZGEAESEwoPRklYRURfTU9OVEhfT0ZGEAISEwoPRklYRURfUFJJQ0VfT0ZGEAMiGgoYTGlzdFB1cmNoYXNlUGxhbnNSZXF1ZXN0IkUKGUxpc3RQdXJjaGFzZVBsYW5zUmVzcG9uc2USKAoFcGxhbnMYASADKAsyGS5ieXRlYmFzZS52MS5QdXJjaGFzZVBsYW4ijAIKDFN1YnNjcmlwdGlvbhIoCgRwbGFuGAEgASgOMhUuYnl0ZWJhc2UudjEuUGxhblR5cGVCA+BBAxISCgVzZWF0cxgCIAEoBUID4EEDEhYKCWluc3RhbmNlcxgDIAEoBUID4EEDEh0KEGFjdGl2ZV9pbnN0YW5jZXMYBCABKAVCA+BBAxI1CgxleHBpcmVzX3RpbWUYBSABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQMSFQoIdHJpYWxpbmcYBiABKAhCA+BBAxIVCghvcmdfbmFtZRgHIAEoCUID4EEDEg8KAmhhGAggASgIQgPgQQMSEQoEZXRhZxgJIAEoCUID4EEDIm4KClBsYW5Db25maWcSKwoFcGxhbnMYASADKAsyHC5ieXRlYmFzZS52MS5QbGFuTGltaXRDb25maWcSMwoRaW5zdGFuY2VfZmVhdHVyZXMYAiADKA4yGC5ieXRlYmFzZS52MS5QbGFuRmVhdHVyZSKeAQoPUGxhbkxpbWl0Q29uZmlnEiMKBHR5cGUYASABKA4yFS5ieXRlYmFzZS52MS5QbGFuVHlwZRIeChZtYXhpbXVtX2luc3RhbmNlX2NvdW50GAIgASgFEhoKEm1heGltdW1fc2VhdF9jb3VudBgDIAEoBRIqCghmZWF0dXJlcxgEIAMoDjIYLmJ5dGViYXNlLnYxLlBsYW5GZWF0dXJlKkgKD0JpbGxpbmdJbnRlcnZhbBIgChxCSUxMSU5HX0lOVEVSVkFMX1VOU1BFQ0lGSUVEEAASCQoFTU9OVEgQARIICgRZRUFSEAIqSQoIUGxhblR5cGUSGQoVUExBTl9UWVBFX1VOU1BFQ0lGSUVEEAASCAoERlJFRRABEggKBFRFQU0QAhIOCgpFTlRFUlBSSVNFEAMq5RIKC1BsYW5GZWF0dXJlEhcKE0ZFQVRVUkVfVU5TUEVDSUZJRUQQABIbChdGRUFUVVJFX0RBVEFCQVNFX0NIQU5HRRABEiwKKEZFQVRVUkVfR0lUX0JBU0VEX1NDSEVNQV9WRVJTSU9OX0NPTlRST0wQAhIoCiRGRUFUVVJFX0RFQ0xBUkFUSVZFX1NDSEVNQV9NSUdSQVRJT04QAxIjCh9GRUFUVVJFX0NPTVBBUkVfQU5EX1NZTkNfU0NIRU1BEAQSIAocRkVBVFVSRV9PTkxJTkVfU0NIRU1BX0NIQU5HRRAFEiUKIUZFQVRVUkVfUFJFX0RFUExPWU1FTlRfU1FMX1JFVklFVxAGEjAKLEZFQVRVUkVfQVVUT01BVElDX0JBQ0tVUF9CRUZPUkVfREFUQV9DSEFOR0VTEAcSIwofRkVBVFVSRV9PTkVfQ0xJQ0tfREFUQV9ST0xMQkFDSxAIEigKJEZFQVRVUkVfTVVMVElfREFUQUJBU0VfQkFUQ0hfQ0hBTkdFUxAJEi4KKkZFQVRVUkVfUFJPR1JFU1NJVkVfRU5WSVJPTk1FTlRfREVQTE9ZTUVOVBAKEiIKHkZFQVRVUkVfU0NIRURVTEVEX1JPTExPVVRfVElNRRALEh4KGkZFQVRVUkVfREFUQUJBU0VfQ0hBTkdFTE9HEAwSJgoeRkVBVFVSRV9TQ0hFTUFfRFJJRlRfREVURUNUSU9OEA0aAggBEhoKFkZFQVRVUkVfUk9MTE9VVF9QT0xJQ1kQDhIgChxGRUFUVVJFX1dFQl9CQVNFRF9TUUxfRURJVE9SEA8SIQodRkVBVFVSRV9TUUxfRURJVE9SX0FETUlOX01PREUQEBIjCh9GRUFUVVJFX05BVFVSQUxfTEFOR1VBR0VfVE9fU1FMEBESIAocRkVBVFVSRV9BSV9RVUVSWV9FWFBMQU5BVElPThASEiAKHEZFQVRVUkVfQUlfUVVFUllfU1VHR0VTVElPTlMQExIZChVGRUFUVVJFX0FVVE9fQ09NUExFVEUQFBIaChZGRUFUVVJFX1NDSEVNQV9ESUFHUkFNEBUSGQoVRkVBVFVSRV9TQ0hFTUFfRURJVE9SEBYSFwoTRkVBVFVSRV9EQVRBX0VYUE9SVBAXEh8KG0ZFQVRVUkVfREFUQV9PRkZMSU5FX0VYUE9SVBAYEhkKFUZFQVRVUkVfUVVFUllfSElTVE9SWRAZEigKJEZFQVRVUkVfU0FWRURfQU5EX1NIQVJFRF9TUUxfU0NSSVBUUxAaEhcKE0ZFQVRVUkVfQkFUQ0hfUVVFUlkQGxIpCiVGRUFUVVJFX0lOU1RBTkNFX1JFQURfT05MWV9DT05ORUNUSU9OEBwSGAoURkVBVFVSRV9RVUVSWV9QT0xJQ1kQHRIhCh1GRUFUVVJFX1JFU1RSSUNUX0NPUFlJTkdfREFUQRAeEg8KC0ZFQVRVUkVfSUFNEB8SIwofRkVBVFVSRV9JTlNUQU5DRV9TU0xfQ09OTkVDVElPThAgEi8KK0ZFQVRVUkVfSU5TVEFOQ0VfQ09OTkVDVElPTl9PVkVSX1NTSF9UVU5ORUwQIRIyCi5GRUFUVVJFX0lOU1RBTkNFX0NPTk5FQ1RJT05fSUFNX0FVVEhFTlRJQ0FUSU9OECISIQodRkVBVFVSRV9HT09HTEVfQU5EX0dJVEhVQl9TU08QIxIXChNGRUFUVVJFX1VTRVJfR1JPVVBTECQSKAokRkVBVFVSRV9ESVNBTExPV19TRUxGX1NFUlZJQ0VfU0lHTlVQECUSJQohRkVBVFVSRV9DVVNUT01fSU5TVEFOQ0VfU1lOQ19USU1FECYSLAooRkVBVFVSRV9DVVNUT01fSU5TVEFOQ0VfQ09OTkVDVElPTl9MSU1JVBAnEhsKF0ZFQVRVUkVfUklTS19BU1NFU1NNRU5UECgSHQoZRkVBVFVSRV9BUFBST1ZBTF9XT1JLRkxPVxApEhUKEUZFQVRVUkVfQVVESVRfTE9HECoSGgoWRkVBVFVSRV9FTlRFUlBSSVNFX1NTTxArEhIKDkZFQVRVUkVfVFdPX0ZBECwSIQodRkVBVFVSRV9QQVNTV09SRF9SRVNUUklDVElPTlMQLRIkCiBGRUFUVVJFX0RJU0FMTE9XX1BBU1NXT1JEX1NJR05JThAuEhgKFEZFQVRVUkVfQ1VTVE9NX1JPTEVTEC8SIQodRkVBVFVSRV9SRVFVRVNUX1JPTEVfV09SS0ZMT1cQMBIPCgtGRUFUVVJFX0pJVBAxEhgKFEZFQVRVUkVfREFUQV9NQVNLSU5HEDISHwobRkVBVFVSRV9EQVRBX0NMQVNTSUZJQ0FUSU9OEDMSEAoMRkVBVFVSRV9TQ0lNEDQSGgoWRkVBVFVSRV9ESVJFQ1RPUllfU1lOQxA1EiIKHkZFQVRVUkVfVE9LRU5fRFVSQVRJT05fQ09OVFJPTBA2EiMKH0ZFQVRVUkVfRVhURVJOQUxfU0VDUkVUX01BTkFHRVIQNxIpCiVGRUFUVVJFX1VTRVJfRU1BSUxfRE9NQUlOX1JFU1RSSUNUSU9OEDgSHgoaRkVBVFVSRV9QUk9KRUNUX01BTkFHRU1FTlQQORIiCh5GRUFUVVJFX0VOVklST05NRU5UX01BTkFHRU1FTlQQOhIcChhGRUFUVVJFX0lNX05PVElGSUNBVElPTlMQOxIeChpGRUFUVVJFX1RFUlJBRk9STV9QUk9WSURFUhA8EhsKF0ZFQVRVUkVfREFUQUJBU0VfR1JPVVBTED0SHQoZRkVBVFVSRV9FTlZJUk9OTUVOVF9USUVSUxA+EiIKHkZFQVRVUkVfREFTSEJPQVJEX0FOTk9VTkNFTUVOVBA/EiQKIEZFQVRVUkVfQVBJX0lOVEVHUkFUSU9OX0dVSURBTkNFEEASFwoTRkVBVFVSRV9DVVNUT01fTE9HTxBBEhUKEUZFQVRVUkVfV0FURVJNQVJLEEISIgoeRkVBVFVSRV9ST0FETUFQX1BSSU9SSVRJWkFUSU9OEEMSFgoSRkVBVFVSRV9DVVNUT01fTVNBEEQSHQoZRkVBVFVSRV9DT01NVU5JVFlfU1VQUE9SVBBFEhkKFUZFQVRVUkVfRU1BSUxfU1VQUE9SVBBGEiYKIkZFQVRVUkVfREVESUNBVEVEX1NVUFBPUlRfV0lUSF9TTEEQRzLxCwoTU3Vic2NyaXB0aW9uU2VydmljZRJ2Cg9HZXRTdWJzY3JpcHRpb24SIy5ieXRlYmFzZS52MS5HZXRTdWJzY3JpcHRpb25SZXF1ZXN0GhkuYnl0ZWJhc2UudjEuU3Vic2NyaXB0aW9uIiPaQQCg6jAEqOowCYLT5JMCEhIQL3YxL3N1YnNjcmlwdGlvbhLMAQoWRXhwb3J0VkNTUHJvdmlkZXJVc2VycxIqLmJ5dGViYXNlLnYxLkV4cG9ydFZDU1Byb3ZpZGVyVXNlcnNSZXF1ZXN0GisuYnl0ZWJhc2UudjEuRXhwb3J0VkNTUHJvdmlkZXJVc2Vyc1Jlc3BvbnNlIlmK6jAWYmIuc3Vic2NyaXB0aW9uLm1hbmFnZZDqMAGY6jABoOowBKjqMAmC0+STAikSJy92MS9zdWJzY3JpcHRpb246dmNzUHJvdmlkZXJVc2Vyc0V4cG9ydBKcAQoNVXBsb2FkTGljZW5zZRIhLmJ5dGViYXNlLnYxLlVwbG9hZExpY2Vuc2VSZXF1ZXN0GhkuYnl0ZWJhc2UudjEuU3Vic2NyaXB0aW9uIk2K6jAWYmIuc3Vic2NyaXB0aW9uLm1hbmFnZZDqMAGY6jABoOowBKjqMAmC0+STAh06ASoyGC92MS9zdWJzY3JpcHRpb24vbGljZW5zZRKjAQoOQ3JlYXRlUHVyY2hhc2USIi5ieXRlYmFzZS52MS5DcmVhdGVQdXJjaGFzZVJlcXVlc3QaHS5ieXRlYmFzZS52MS5QdXJjaGFzZVJlc3BvbnNlIk6K6jAWYmIuc3Vic2NyaXB0aW9uLm1hbmFnZZDqMAGY6jABoOowBKjqMAmC0+STAh46ASoiGS92MS9zdWJzY3JpcHRpb246cHVyY2hhc2USqQEKDlVwZGF0ZVB1cmNoYXNlEiIuYnl0ZWJhc2UudjEuVXBkYXRlUHVyY2hhc2VSZXF1ZXN0Gh0uYnl0ZWJhc2UudjEuUHVyY2hhc2VSZXNwb25zZSJUiuowFmJiLnN1YnNjcmlwdGlvbi5tYW5hZ2WQ6jABmOowAaDqMASo6jAJgtPkkwIkOgEqIh8vdjEvc3Vic2NyaXB0aW9uOnVwZGF0ZVB1cmNoYXNlEqkBCg5DYW5jZWxQdXJjaGFzZRIiLmJ5dGViYXNlLnYxLkNhbmNlbFB1cmNoYXNlUmVxdWVzdBodLmJ5dGViYXNlLnYxLlB1cmNoYXNlUmVzcG9uc2UiVIrqMBZiYi5zdWJzY3JpcHRpb24ubWFuYWdlkOowAZjqMAGg6jAEqOowCYLT5JMCJDoBKiIfL3YxL3N1YnNjcmlwdGlvbjpjYW5jZWxQdXJjaGFzZRKaAQoOR2V0UGF5bWVudEluZm8SIi5ieXRlYmFzZS52MS5HZXRQYXltZW50SW5mb1JlcXVlc3QaGC5ieXRlYmFzZS52MS5QYXltZW50SW5mbyJKiuowFmJiLnN1YnNjcmlwdGlvbi5tYW5hZ2WQ6jABoOowBKjqMAmC0+STAh4SHC92MS9zdWJzY3JpcHRpb24vcGF5bWVudEluZm8SywEKFVZlcmlmeUNoZWNrb3V0U2Vzc2lvbhIpLmJ5dGViYXNlLnYxLlZlcmlmeUNoZWNrb3V0U2Vzc2lvblJlcXVlc3QaKi5ieXRlYmFzZS52MS5WZXJpZnlDaGVja291dFNlc3Npb25SZXNwb25zZSJbiuowFmJiLnN1YnNjcmlwdGlvbi5tYW5hZ2WQ6jABoOowBKjqMAmC0+STAi8SLS92MS9zdWJzY3JpcHRpb24vY2hlY2tvdXRTZXNzaW9uL3tzZXNzaW9uX2lkfRKKAQoRTGlzdFB1cmNoYXNlUGxhbnMSJS5ieXRlYmFzZS52MS5MaXN0UHVyY2hhc2VQbGFuc1JlcXVlc3QaJi5ieXRlYmFzZS52MS5MaXN0UHVyY2hhc2VQbGFuc1Jlc3BvbnNlIiag6jAEqOowCYLT5JMCGBIWL3YxL3N1YnNjcmlwdGlvbi9wbGFuc0KuAQoPY29tLmJ5dGViYXNlLnYxQhhTdWJzY3JpcHRpb25TZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_protobuf_timestamp, file_v1_annotation]);
+ fileDesc("Ch12MS9zdWJzY3JpcHRpb25fc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiGAoWR2V0U3Vic2NyaXB0aW9uUmVxdWVzdCIfCh1FeHBvcnRWQ1NQcm92aWRlclVzZXJzUmVxdWVzdCI3Ch5FeHBvcnRWQ1NQcm92aWRlclVzZXJzUmVzcG9uc2USFQoHY29udGVudBgBIAEoDEIE0OowAiItChRVcGxvYWRMaWNlbnNlUmVxdWVzdBIVCgdsaWNlbnNlGAEgASgJQgTQ6jABInsKFUNyZWF0ZVB1cmNoYXNlUmVxdWVzdBIjCgRwbGFuGAEgASgOMhUuYnl0ZWJhc2UudjEuUGxhblR5cGUSLgoIaW50ZXJ2YWwYAiABKA4yHC5ieXRlYmFzZS52MS5CaWxsaW5nSW50ZXJ2YWwSDQoFc2VhdHMYAyABKAUiRwoQUHVyY2hhc2VSZXNwb25zZRIZCgtwYXltZW50X3VybBgBIAEoCUIE0OowARIYCgpzZXNzaW9uX2lkGAIgASgJQgTQ6jABIjgKHFZlcmlmeUNoZWNrb3V0U2Vzc2lvblJlcXVlc3QSGAoKc2Vzc2lvbl9pZBgBIAEoCUIE0OowASIvCh1WZXJpZnlDaGVja291dFNlc3Npb25SZXNwb25zZRIOCgZzdGF0dXMYASABKAkiiQEKFVVwZGF0ZVB1cmNoYXNlUmVxdWVzdBIjCgRwbGFuGAEgASgOMhUuYnl0ZWJhc2UudjEuUGxhblR5cGUSLgoIaW50ZXJ2YWwYAiABKA4yHC5ieXRlYmFzZS52MS5CaWxsaW5nSW50ZXJ2YWwSDQoFc2VhdHMYAyABKAUSDAoEZXRhZxgEIAEoCSI6ChVDYW5jZWxQdXJjaGFzZVJlcXVlc3QSEAoIZmVlZGJhY2sYASABKAkSDwoHY29tbWVudBgCIAEoCSIXChVHZXRQYXltZW50SW5mb1JlcXVlc3QirAEKC1BheW1lbnRJbmZvEhMKC3RvdGFsX3ByaWNlGAEgASgJEhAKCGN1cnJlbmN5GAIgASgJEhQKDHBlcmlvZF9zdGFydBgDIAEoCRISCgpwZXJpb2RfZW5kGAQgASgJEhMKC2ludm9pY2VfdXJsGAUgASgJEhwKFGNhbmNlbF9hdF9wZXJpb2RfZW5kGAYgASgIEhkKEW5leHRfcGVyaW9kX3ByaWNlGAcgASgJIskBCgxQdXJjaGFzZVBsYW4SIwoEdHlwZRgBIAEoDjIVLmJ5dGViYXNlLnYxLlBsYW5UeXBlEh0KFXNlbGZfc2VydmljZV9wdXJjaGFzZRgCIAEoCBI4CgthZGRpdGlvbmFscxgDIAMoCzIjLmJ5dGViYXNlLnYxLlB1cmNoYXNlUGxhbkFkZGl0aW9uYWwSOwoPYmlsbGluZ19tZXRob2RzGAQgAygLMiIuYnl0ZWJhc2UudjEuUHVyY2hhc2VCaWxsaW5nTWV0aG9kIs4BChZQdXJjaGFzZVBsYW5BZGRpdGlvbmFsEjYKBHR5cGUYASABKA4yKC5ieXRlYmFzZS52MS5QdXJjaGFzZVBsYW5BZGRpdGlvbmFsLlR5cGUSEgoKdW5pdF9wcmljZRgCIAEoBRISCgpmcmVlX2NvdW50GAMgASgFEhUKDW1pbmltdW1fY291bnQYBCABKAUSFQoNbWF4aW11bV9jb3VudBgFIAEoBSImCgRUeXBlEhQKEFRZUEVfVU5TUEVDSUZJRUQQABIICgRVU0VSEAEieAoVUHVyY2hhc2VCaWxsaW5nTWV0aG9kEi4KCGludGVydmFsGAEgASgOMhwuYnl0ZWJhc2UudjEuQmlsbGluZ0ludGVydmFsEi8KCGRpc2NvdW50GAIgASgLMh0uYnl0ZWJhc2UudjEuUHVyY2hhc2VEaXNjb3VudCKvAQoQUHVyY2hhc2VEaXNjb3VudBIwCgR0eXBlGAEgASgOMiIuYnl0ZWJhc2UudjEuUHVyY2hhc2VEaXNjb3VudC5UeXBlEg0KBXZhbHVlGAIgASgFIloKBFR5cGUSFAoQVFlQRV9VTlNQRUNJRklFRBAAEhIKDlBFUkNFTlRBR0VfT0ZGEAESEwoPRklYRURfTU9OVEhfT0ZGEAISEwoPRklYRURfUFJJQ0VfT0ZGEAMiGgoYTGlzdFB1cmNoYXNlUGxhbnNSZXF1ZXN0IkUKGUxpc3RQdXJjaGFzZVBsYW5zUmVzcG9uc2USKAoFcGxhbnMYASADKAsyGS5ieXRlYmFzZS52MS5QdXJjaGFzZVBsYW4ijAIKDFN1YnNjcmlwdGlvbhIoCgRwbGFuGAEgASgOMhUuYnl0ZWJhc2UudjEuUGxhblR5cGVCA+BBAxISCgVzZWF0cxgCIAEoBUID4EEDEhYKCWluc3RhbmNlcxgDIAEoBUID4EEDEh0KEGFjdGl2ZV9pbnN0YW5jZXMYBCABKAVCA+BBAxI1CgxleHBpcmVzX3RpbWUYBSABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQMSFQoIdHJpYWxpbmcYBiABKAhCA+BBAxIVCghvcmdfbmFtZRgHIAEoCUID4EEDEg8KAmhhGAggASgIQgPgQQMSEQoEZXRhZxgJIAEoCUID4EEDIm4KClBsYW5Db25maWcSKwoFcGxhbnMYASADKAsyHC5ieXRlYmFzZS52MS5QbGFuTGltaXRDb25maWcSMwoRaW5zdGFuY2VfZmVhdHVyZXMYAiADKA4yGC5ieXRlYmFzZS52MS5QbGFuRmVhdHVyZSKeAQoPUGxhbkxpbWl0Q29uZmlnEiMKBHR5cGUYASABKA4yFS5ieXRlYmFzZS52MS5QbGFuVHlwZRIeChZtYXhpbXVtX2luc3RhbmNlX2NvdW50GAIgASgFEhoKEm1heGltdW1fc2VhdF9jb3VudBgDIAEoBRIqCghmZWF0dXJlcxgEIAMoDjIYLmJ5dGViYXNlLnYxLlBsYW5GZWF0dXJlIhMKEVN0YXJ0VHJpYWxSZXF1ZXN0KkgKD0JpbGxpbmdJbnRlcnZhbBIgChxCSUxMSU5HX0lOVEVSVkFMX1VOU1BFQ0lGSUVEEAASCQoFTU9OVEgQARIICgRZRUFSEAIqSQoIUGxhblR5cGUSGQoVUExBTl9UWVBFX1VOU1BFQ0lGSUVEEAASCAoERlJFRRABEggKBFRFQU0QAhIOCgpFTlRFUlBSSVNFEAMq5RIKC1BsYW5GZWF0dXJlEhcKE0ZFQVRVUkVfVU5TUEVDSUZJRUQQABIbChdGRUFUVVJFX0RBVEFCQVNFX0NIQU5HRRABEiwKKEZFQVRVUkVfR0lUX0JBU0VEX1NDSEVNQV9WRVJTSU9OX0NPTlRST0wQAhIoCiRGRUFUVVJFX0RFQ0xBUkFUSVZFX1NDSEVNQV9NSUdSQVRJT04QAxIjCh9GRUFUVVJFX0NPTVBBUkVfQU5EX1NZTkNfU0NIRU1BEAQSIAocRkVBVFVSRV9PTkxJTkVfU0NIRU1BX0NIQU5HRRAFEiUKIUZFQVRVUkVfUFJFX0RFUExPWU1FTlRfU1FMX1JFVklFVxAGEjAKLEZFQVRVUkVfQVVUT01BVElDX0JBQ0tVUF9CRUZPUkVfREFUQV9DSEFOR0VTEAcSIwofRkVBVFVSRV9PTkVfQ0xJQ0tfREFUQV9ST0xMQkFDSxAIEigKJEZFQVRVUkVfTVVMVElfREFUQUJBU0VfQkFUQ0hfQ0hBTkdFUxAJEi4KKkZFQVRVUkVfUFJPR1JFU1NJVkVfRU5WSVJPTk1FTlRfREVQTE9ZTUVOVBAKEiIKHkZFQVRVUkVfU0NIRURVTEVEX1JPTExPVVRfVElNRRALEh4KGkZFQVRVUkVfREFUQUJBU0VfQ0hBTkdFTE9HEAwSJgoeRkVBVFVSRV9TQ0hFTUFfRFJJRlRfREVURUNUSU9OEA0aAggBEhoKFkZFQVRVUkVfUk9MTE9VVF9QT0xJQ1kQDhIgChxGRUFUVVJFX1dFQl9CQVNFRF9TUUxfRURJVE9SEA8SIQodRkVBVFVSRV9TUUxfRURJVE9SX0FETUlOX01PREUQEBIjCh9GRUFUVVJFX05BVFVSQUxfTEFOR1VBR0VfVE9fU1FMEBESIAocRkVBVFVSRV9BSV9RVUVSWV9FWFBMQU5BVElPThASEiAKHEZFQVRVUkVfQUlfUVVFUllfU1VHR0VTVElPTlMQExIZChVGRUFUVVJFX0FVVE9fQ09NUExFVEUQFBIaChZGRUFUVVJFX1NDSEVNQV9ESUFHUkFNEBUSGQoVRkVBVFVSRV9TQ0hFTUFfRURJVE9SEBYSFwoTRkVBVFVSRV9EQVRBX0VYUE9SVBAXEh8KG0ZFQVRVUkVfREFUQV9PRkZMSU5FX0VYUE9SVBAYEhkKFUZFQVRVUkVfUVVFUllfSElTVE9SWRAZEigKJEZFQVRVUkVfU0FWRURfQU5EX1NIQVJFRF9TUUxfU0NSSVBUUxAaEhcKE0ZFQVRVUkVfQkFUQ0hfUVVFUlkQGxIpCiVGRUFUVVJFX0lOU1RBTkNFX1JFQURfT05MWV9DT05ORUNUSU9OEBwSGAoURkVBVFVSRV9RVUVSWV9QT0xJQ1kQHRIhCh1GRUFUVVJFX1JFU1RSSUNUX0NPUFlJTkdfREFUQRAeEg8KC0ZFQVRVUkVfSUFNEB8SIwofRkVBVFVSRV9JTlNUQU5DRV9TU0xfQ09OTkVDVElPThAgEi8KK0ZFQVRVUkVfSU5TVEFOQ0VfQ09OTkVDVElPTl9PVkVSX1NTSF9UVU5ORUwQIRIyCi5GRUFUVVJFX0lOU1RBTkNFX0NPTk5FQ1RJT05fSUFNX0FVVEhFTlRJQ0FUSU9OECISIQodRkVBVFVSRV9HT09HTEVfQU5EX0dJVEhVQl9TU08QIxIXChNGRUFUVVJFX1VTRVJfR1JPVVBTECQSKAokRkVBVFVSRV9ESVNBTExPV19TRUxGX1NFUlZJQ0VfU0lHTlVQECUSJQohRkVBVFVSRV9DVVNUT01fSU5TVEFOQ0VfU1lOQ19USU1FECYSLAooRkVBVFVSRV9DVVNUT01fSU5TVEFOQ0VfQ09OTkVDVElPTl9MSU1JVBAnEhsKF0ZFQVRVUkVfUklTS19BU1NFU1NNRU5UECgSHQoZRkVBVFVSRV9BUFBST1ZBTF9XT1JLRkxPVxApEhUKEUZFQVRVUkVfQVVESVRfTE9HECoSGgoWRkVBVFVSRV9FTlRFUlBSSVNFX1NTTxArEhIKDkZFQVRVUkVfVFdPX0ZBECwSIQodRkVBVFVSRV9QQVNTV09SRF9SRVNUUklDVElPTlMQLRIkCiBGRUFUVVJFX0RJU0FMTE9XX1BBU1NXT1JEX1NJR05JThAuEhgKFEZFQVRVUkVfQ1VTVE9NX1JPTEVTEC8SIQodRkVBVFVSRV9SRVFVRVNUX1JPTEVfV09SS0ZMT1cQMBIPCgtGRUFUVVJFX0pJVBAxEhgKFEZFQVRVUkVfREFUQV9NQVNLSU5HEDISHwobRkVBVFVSRV9EQVRBX0NMQVNTSUZJQ0FUSU9OEDMSEAoMRkVBVFVSRV9TQ0lNEDQSGgoWRkVBVFVSRV9ESVJFQ1RPUllfU1lOQxA1EiIKHkZFQVRVUkVfVE9LRU5fRFVSQVRJT05fQ09OVFJPTBA2EiMKH0ZFQVRVUkVfRVhURVJOQUxfU0VDUkVUX01BTkFHRVIQNxIpCiVGRUFUVVJFX1VTRVJfRU1BSUxfRE9NQUlOX1JFU1RSSUNUSU9OEDgSHgoaRkVBVFVSRV9QUk9KRUNUX01BTkFHRU1FTlQQORIiCh5GRUFUVVJFX0VOVklST05NRU5UX01BTkFHRU1FTlQQOhIcChhGRUFUVVJFX0lNX05PVElGSUNBVElPTlMQOxIeChpGRUFUVVJFX1RFUlJBRk9STV9QUk9WSURFUhA8EhsKF0ZFQVRVUkVfREFUQUJBU0VfR1JPVVBTED0SHQoZRkVBVFVSRV9FTlZJUk9OTUVOVF9USUVSUxA+EiIKHkZFQVRVUkVfREFTSEJPQVJEX0FOTk9VTkNFTUVOVBA/EiQKIEZFQVRVUkVfQVBJX0lOVEVHUkFUSU9OX0dVSURBTkNFEEASFwoTRkVBVFVSRV9DVVNUT01fTE9HTxBBEhUKEUZFQVRVUkVfV0FURVJNQVJLEEISIgoeRkVBVFVSRV9ST0FETUFQX1BSSU9SSVRJWkFUSU9OEEMSFgoSRkVBVFVSRV9DVVNUT01fTVNBEEQSHQoZRkVBVFVSRV9DT01NVU5JVFlfU1VQUE9SVBBFEhkKFUZFQVRVUkVfRU1BSUxfU1VQUE9SVBBGEiYKIkZFQVRVUkVfREVESUNBVEVEX1NVUFBPUlRfV0lUSF9TTEEQRzKNDQoTU3Vic2NyaXB0aW9uU2VydmljZRJ2Cg9HZXRTdWJzY3JpcHRpb24SIy5ieXRlYmFzZS52MS5HZXRTdWJzY3JpcHRpb25SZXF1ZXN0GhkuYnl0ZWJhc2UudjEuU3Vic2NyaXB0aW9uIiPaQQCg6jAEqOowCYLT5JMCEhIQL3YxL3N1YnNjcmlwdGlvbhLMAQoWRXhwb3J0VkNTUHJvdmlkZXJVc2VycxIqLmJ5dGViYXNlLnYxLkV4cG9ydFZDU1Byb3ZpZGVyVXNlcnNSZXF1ZXN0GisuYnl0ZWJhc2UudjEuRXhwb3J0VkNTUHJvdmlkZXJVc2Vyc1Jlc3BvbnNlIlmK6jAWYmIuc3Vic2NyaXB0aW9uLm1hbmFnZZDqMAGY6jABoOowBKjqMAmC0+STAikSJy92MS9zdWJzY3JpcHRpb246dmNzUHJvdmlkZXJVc2Vyc0V4cG9ydBKcAQoNVXBsb2FkTGljZW5zZRIhLmJ5dGViYXNlLnYxLlVwbG9hZExpY2Vuc2VSZXF1ZXN0GhkuYnl0ZWJhc2UudjEuU3Vic2NyaXB0aW9uIk2K6jAWYmIuc3Vic2NyaXB0aW9uLm1hbmFnZZDqMAGY6jABoOowBKjqMAmC0+STAh06ASoyGC92MS9zdWJzY3JpcHRpb24vbGljZW5zZRKZAQoKU3RhcnRUcmlhbBIeLmJ5dGViYXNlLnYxLlN0YXJ0VHJpYWxSZXF1ZXN0GhkuYnl0ZWJhc2UudjEuU3Vic2NyaXB0aW9uIlCK6jAWYmIuc3Vic2NyaXB0aW9uLm1hbmFnZZDqMAGY6jABoOowBKjqMAmC0+STAiA6ASoiGy92MS9zdWJzY3JpcHRpb246c3RhcnRUcmlhbBKjAQoOQ3JlYXRlUHVyY2hhc2USIi5ieXRlYmFzZS52MS5DcmVhdGVQdXJjaGFzZVJlcXVlc3QaHS5ieXRlYmFzZS52MS5QdXJjaGFzZVJlc3BvbnNlIk6K6jAWYmIuc3Vic2NyaXB0aW9uLm1hbmFnZZDqMAGY6jABoOowBKjqMAmC0+STAh46ASoiGS92MS9zdWJzY3JpcHRpb246cHVyY2hhc2USqQEKDlVwZGF0ZVB1cmNoYXNlEiIuYnl0ZWJhc2UudjEuVXBkYXRlUHVyY2hhc2VSZXF1ZXN0Gh0uYnl0ZWJhc2UudjEuUHVyY2hhc2VSZXNwb25zZSJUiuowFmJiLnN1YnNjcmlwdGlvbi5tYW5hZ2WQ6jABmOowAaDqMASo6jAJgtPkkwIkOgEqIh8vdjEvc3Vic2NyaXB0aW9uOnVwZGF0ZVB1cmNoYXNlEqkBCg5DYW5jZWxQdXJjaGFzZRIiLmJ5dGViYXNlLnYxLkNhbmNlbFB1cmNoYXNlUmVxdWVzdBodLmJ5dGViYXNlLnYxLlB1cmNoYXNlUmVzcG9uc2UiVIrqMBZiYi5zdWJzY3JpcHRpb24ubWFuYWdlkOowAZjqMAGg6jAEqOowCYLT5JMCJDoBKiIfL3YxL3N1YnNjcmlwdGlvbjpjYW5jZWxQdXJjaGFzZRKaAQoOR2V0UGF5bWVudEluZm8SIi5ieXRlYmFzZS52MS5HZXRQYXltZW50SW5mb1JlcXVlc3QaGC5ieXRlYmFzZS52MS5QYXltZW50SW5mbyJKiuowFmJiLnN1YnNjcmlwdGlvbi5tYW5hZ2WQ6jABoOowBKjqMAmC0+STAh4SHC92MS9zdWJzY3JpcHRpb24vcGF5bWVudEluZm8SywEKFVZlcmlmeUNoZWNrb3V0U2Vzc2lvbhIpLmJ5dGViYXNlLnYxLlZlcmlmeUNoZWNrb3V0U2Vzc2lvblJlcXVlc3QaKi5ieXRlYmFzZS52MS5WZXJpZnlDaGVja291dFNlc3Npb25SZXNwb25zZSJbiuowFmJiLnN1YnNjcmlwdGlvbi5tYW5hZ2WQ6jABoOowBKjqMAmC0+STAi8SLS92MS9zdWJzY3JpcHRpb24vY2hlY2tvdXRTZXNzaW9uL3tzZXNzaW9uX2lkfRKKAQoRTGlzdFB1cmNoYXNlUGxhbnMSJS5ieXRlYmFzZS52MS5MaXN0UHVyY2hhc2VQbGFuc1JlcXVlc3QaJi5ieXRlYmFzZS52MS5MaXN0UHVyY2hhc2VQbGFuc1Jlc3BvbnNlIiag6jAEqOowCYLT5JMCGBIWL3YxL3N1YnNjcmlwdGlvbi9wbGFuc0KuAQoPY29tLmJ5dGViYXNlLnYxQhhTdWJzY3JpcHRpb25TZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_protobuf_timestamp, file_v1_annotation]);
/**
* Describes the message bytebase.v1.GetSubscriptionRequest.
@@ -186,6 +186,13 @@ export const PlanConfigSchema = /*@__PURE__*/
export const PlanLimitConfigSchema = /*@__PURE__*/
messageDesc(file_v1_subscription_service, 20);
+/**
+ * Describes the message bytebase.v1.StartTrialRequest.
+ * Use `create(StartTrialRequestSchema)` to create a new message.
+ */
+export const StartTrialRequestSchema = /*@__PURE__*/
+ messageDesc(file_v1_subscription_service, 21);
+
/**
* Describes the enum bytebase.v1.BillingInterval.
*/
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 113f8b2ae4..1cae0ce392 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -2792,8 +2792,14 @@ paths:
title: schema
required:
- schema
+ - not:
+ anyOf:
+ - required:
+ - changelog
+ - required:
+ - schema
+ unevaluatedProperties: false
title: DiffSchemaRequest
- additionalProperties: false
required: true
responses:
"200":
@@ -3760,1354 +3766,3445 @@ paths:
schema:
type: string
title: use_default
- - name: metadata.schemas.tables.partitions.subpartitions.checkConstraints.name
+ - name: metadata.schemas.tables.partitions.indexes.name
in: query
- description: The name is the name of a check constraint.
+ description: The name is the name of an index.
schema:
type: string
title: name
- - name: metadata.schemas.tables.partitions.subpartitions.checkConstraints.expression
+ - name: metadata.schemas.tables.partitions.indexes.expressions
in: query
- description: The expression is the expression of a check constraint.
+ description: |-
+ The expressions are the ordered columns or expressions of an index.
+ This could refer to a column or an expression.
schema:
- type: string
- title: expression
- - name: metadata.schemas.tables.owner
+ type: array
+ items:
+ type: string
+ title: expressions
+ - name: metadata.schemas.tables.partitions.indexes.keyLength
in: query
- description: The owner of the table.
+ description: |-
+ The key_lengths are the ordered key lengths of an index.
+ If the key length is not specified, it's -1.
schema:
- type: string
- title: owner
- - name: metadata.schemas.tables.sortingKeys
+ type: array
+ items:
+ type:
+ - integer
+ - string
+ format: int64
+ title: key_length
+ - name: metadata.schemas.tables.partitions.indexes.descending
in: query
- description: |-
- 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
+ description: The descending is the ordered descending of an index.
schema:
type: array
items:
- type: string
- title: sorting_keys
- - name: metadata.schemas.tables.triggers.name
+ type: boolean
+ title: descending
+ - name: metadata.schemas.tables.partitions.indexes.type
in: query
- description: The name is the name of the trigger.
+ description: The type is the type of an index.
schema:
type: string
- title: name
- - name: metadata.schemas.tables.triggers.event
+ title: type
+ - name: metadata.schemas.tables.partitions.indexes.unique
in: query
- description: |-
- The event is the event of the trigger, such as INSERT, UPDATE, DELETE,
- TRUNCATE.
+ description: The unique is whether the index is unique.
schema:
- type: string
- title: event
- - name: metadata.schemas.tables.triggers.timing
+ type: boolean
+ title: unique
+ - name: metadata.schemas.tables.partitions.indexes.primary
in: query
- description: The timing is the timing of the trigger, such as BEFORE, AFTER.
+ description: The primary is whether the index is a primary key index.
schema:
- type: string
- title: timing
- - name: metadata.schemas.tables.triggers.body
+ type: boolean
+ title: primary
+ - name: metadata.schemas.tables.partitions.indexes.visible
in: query
- description: The body is the body of the trigger.
+ description: The visible is whether the index is visible.
schema:
- type: string
- title: body
- - name: metadata.schemas.tables.triggers.sqlMode
+ type: boolean
+ title: visible
+ - name: metadata.schemas.tables.partitions.indexes.comment
in: query
- description: The SQL mode setting for the trigger.
+ description: The comment is the comment of an index.
schema:
type: string
- title: sql_mode
- - name: metadata.schemas.tables.triggers.characterSetClient
+ title: comment
+ - name: metadata.schemas.tables.partitions.indexes.definition
in: query
- description: The character set used by the client creating the trigger.
+ description: The definition of an index.
schema:
type: string
- title: character_set_client
- - name: metadata.schemas.tables.triggers.collationConnection
+ title: definition
+ - name: metadata.schemas.tables.partitions.indexes.parentIndexSchema
in: query
- description: The collation used for the connection when creating the trigger.
+ description: The schema name of the parent index.
schema:
type: string
- title: collation_connection
- - name: metadata.schemas.tables.triggers.comment
+ title: parent_index_schema
+ - name: metadata.schemas.tables.partitions.indexes.parentIndexName
in: query
- description: The comment describing the trigger.
+ description: The index name of the parent index.
schema:
type: string
- title: comment
- - name: metadata.schemas.tables.triggers.skipDump
+ title: parent_index_name
+ - name: metadata.schemas.tables.partitions.indexes.granularity
in: query
- description: Whether to skip this trigger during schema dump operations.
+ description: The number of granules in the block. It's a ClickHouse specific field.
schema:
- type: boolean
- title: skip_dump
- - name: metadata.schemas.tables.skipDump
+ type:
+ - integer
+ - string
+ title: granularity
+ format: int64
+ - name: metadata.schemas.tables.partitions.indexes.isConstraint
in: query
- description: Whether to skip this table during schema dump operations.
+ description: |-
+ It's a PostgreSQL specific field.
+ The unique constraint and unique index are not the same thing in PostgreSQL.
schema:
type: boolean
- title: skip_dump
- - name: metadata.schemas.tables.shardingInfo
+ title: is_constraint
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.method
in: query
- description: https://docs.pingcap.com/tidb/stable/information-schema-tables/
+ description: Spatial indexing method (e.g., "SPATIAL", "R-TREE", "GIST")
schema:
type: string
- title: sharding_info
- - name: metadata.schemas.tables.primaryKeyType
+ title: method
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.tessellation.scheme
in: query
- description: |-
- https://docs.pingcap.com/tidb/stable/clustered-indexes/#clustered-indexes
- CLUSTERED or NONCLUSTERED.
+ description: Tessellation scheme (e.g., "GEOMETRY_GRID", "GEOGRAPHY_GRID", "GEOMETRY_AUTO_GRID")
schema:
type: string
- title: primary_key_type
- - name: metadata.schemas.externalTables.name
+ title: scheme
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.tessellation.gridLevels.level
in: query
- description: The name is the name of a external table.
+ description: Grid level number (1-4 for SQL Server)
schema:
- type: string
- title: name
- - name: metadata.schemas.externalTables.externalServerName
+ type: integer
+ title: level
+ format: int32
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.tessellation.gridLevels.density
in: query
- description: The external_server_name is the name of the external server.
+ description: Grid density (LOW, MEDIUM, HIGH)
schema:
type: string
- title: external_server_name
- - name: metadata.schemas.externalTables.externalDatabaseName
+ title: density
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.tessellation.cellsPerObject
in: query
- description: The external_database_name is the name of the external database.
+ description: Number of cells per object (1-8192 for SQL Server)
schema:
- type: string
- title: external_database_name
- - name: metadata.schemas.views.name
+ type: integer
+ title: cells_per_object
+ format: int32
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.tessellation.boundingBox.xmin
in: query
- description: The name is the name of a view.
+ description: Minimum X coordinate
schema:
- type: string
- title: name
- - name: metadata.schemas.views.definition
+ type: number
+ title: xmin
+ format: double
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.tessellation.boundingBox.ymin
in: query
- description: The definition is the definition of a view.
+ description: Minimum Y coordinate
schema:
- type: string
- title: definition
- - name: metadata.schemas.views.comment
+ type: number
+ title: ymin
+ format: double
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.tessellation.boundingBox.xmax
in: query
- description: The comment is the comment of a view.
+ description: Maximum X coordinate
schema:
- type: string
- title: comment
- - name: metadata.schemas.views.dependencyColumns.schema
+ type: number
+ title: xmax
+ format: double
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.tessellation.boundingBox.ymax
in: query
- description: The schema is the schema of a reference column.
+ description: Maximum Y coordinate
schema:
- type: string
- title: schema
- - name: metadata.schemas.views.dependencyColumns.table
+ type: number
+ title: ymax
+ format: double
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.fillfactor
in: query
- description: The table is the table of a reference column.
+ description: Fill factor percentage (1-100)
schema:
- type: string
- title: table
- - name: metadata.schemas.views.dependencyColumns.column
+ type: integer
+ title: fillfactor
+ format: int32
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.buffering
in: query
- description: The column is the name of a reference column.
+ description: Buffering mode for PostgreSQL (auto, on, off)
schema:
type: string
- title: column
- - name: metadata.schemas.views.skipDump
- in: query
- schema:
- type: boolean
- title: skip_dump
- - name: metadata.schemas.functions.name
+ title: buffering
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.tablespace
in: query
- description: The name is the name of a function.
+ description: Tablespace configuration for Oracle
schema:
type: string
- title: name
- - name: metadata.schemas.functions.definition
+ title: tablespace
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.workTablespace
in: query
- description: The definition is the definition of a function.
schema:
type: string
- title: definition
- - name: metadata.schemas.functions.signature
+ title: work_tablespace
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.sdoLevel
in: query
- description: |-
- The signature is the name with the number and type of input arguments the
- function takes.
schema:
- type: string
- title: signature
- - name: metadata.schemas.functions.characterSetClient
+ type: integer
+ title: sdo_level
+ format: int32
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.commitInterval
in: query
- description: MySQL specific metadata.
schema:
- type: string
- title: character_set_client
- - name: metadata.schemas.functions.collationConnection
+ type: integer
+ title: commit_interval
+ format: int32
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.padIndex
in: query
+ description: SQL Server specific parameters
schema:
- type: string
- title: collation_connection
- - name: metadata.schemas.functions.databaseCollation
+ type: boolean
+ title: pad_index
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.sortInTempdb
in: query
+ description: ON, OFF
schema:
type: string
- title: database_collation
- - name: metadata.schemas.functions.sqlMode
+ title: sort_in_tempdb
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.dropExisting
in: query
schema:
- type: string
- title: sql_mode
- - name: metadata.schemas.functions.comment
+ type: boolean
+ title: drop_existing
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.online
in: query
schema:
- type: string
- title: comment
- - name: metadata.schemas.functions.dependencyTables.schema
+ type: boolean
+ title: online
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.allowRowLocks
in: query
- description: The schema is the schema of a reference table.
schema:
- type: string
- title: schema
- - name: metadata.schemas.functions.dependencyTables.table
+ type: boolean
+ title: allow_row_locks
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.allowPageLocks
in: query
- description: The table is the name of a reference table.
schema:
- type: string
- title: table
- - name: metadata.schemas.functions.skipDump
+ type: boolean
+ title: allow_page_locks
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.maxdop
in: query
schema:
- type: boolean
- title: skip_dump
- - name: metadata.schemas.procedures.name
+ type: integer
+ title: maxdop
+ format: int32
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.dataCompression
in: query
- description: The name is the name of a procedure.
+ description: NONE, ROW, PAGE
schema:
type: string
- title: name
- - name: metadata.schemas.procedures.definition
+ title: data_compression
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.dimensional.dimensions
in: query
- description: The definition is the definition of a procedure.
+ description: Number of dimensions (2-4, default 2)
schema:
- type: string
- title: definition
- - name: metadata.schemas.procedures.signature
+ type: integer
+ title: dimensions
+ format: int32
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.dimensional.dataType
in: query
- description: |-
- The signature is the name with the number and type of input arguments the
- procedure takes.
+ description: Spatial data type (GEOMETRY, GEOGRAPHY, POINT, POLYGON, etc.)
schema:
type: string
- title: signature
- - name: metadata.schemas.procedures.characterSetClient
+ title: data_type
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.dimensional.srid
in: query
- description: MySQL specific metadata.
+ description: Spatial reference system identifier (SRID)
schema:
- type: string
- title: character_set_client
- - name: metadata.schemas.procedures.collationConnection
+ type: integer
+ title: srid
+ format: int32
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.dimensional.constraints.dimension
in: query
+ description: Dimension name/type (X, Y, Z, M, etc.)
schema:
type: string
- title: collation_connection
- - name: metadata.schemas.procedures.databaseCollation
+ title: dimension
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.dimensional.constraints.minValue
in: query
+ description: Minimum value for this dimension
schema:
- type: string
- title: database_collation
- - name: metadata.schemas.procedures.sqlMode
+ type: number
+ title: min_value
+ format: double
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.dimensional.constraints.maxValue
+ in: query
+ description: Maximum value for this dimension
+ schema:
+ type: number
+ title: max_value
+ format: double
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.dimensional.constraints.tolerance
in: query
+ description: Tolerance for this dimension
schema:
- type: string
- title: sql_mode
- - name: metadata.schemas.procedures.comment
+ type: number
+ title: tolerance
+ format: double
+ - name: metadata.schemas.tables.partitions.indexes.opclassNames
in: query
- description: The comment is the comment of a procedure.
+ description: |-
+ https://www.postgresql.org/docs/current/catalog-pg-opclass.html
+ Name of the operator class for each column. (PostgreSQL specific).
schema:
- type: string
- title: comment
- - name: metadata.schemas.procedures.skipDump
+ type: array
+ items:
+ type: string
+ title: opclass_names
+ - name: metadata.schemas.tables.partitions.indexes.opclassDefaults
in: query
+ description: True if the operator class is the default. (PostgreSQL specific).
schema:
- type: boolean
- title: skip_dump
- - name: metadata.schemas.streams.name
+ type: array
+ items:
+ type: boolean
+ title: opclass_defaults
+ - name: metadata.schemas.tables.partitions.checkConstraints.name
in: query
- description: The name is the name of a stream.
+ description: The name is the name of a check constraint.
schema:
type: string
title: name
- - name: metadata.schemas.streams.tableName
+ - name: metadata.schemas.tables.partitions.checkConstraints.expression
in: query
- description: The table_name is the name of the table/view that the stream is created on.
+ description: The expression is the expression of a check constraint.
schema:
type: string
- title: table_name
- - name: metadata.schemas.streams.owner
+ title: expression
+ - name: metadata.schemas.tables.checkConstraints.name
in: query
- description: The owner of the stream.
+ description: The name is the name of a check constraint.
schema:
type: string
- title: owner
- - name: metadata.schemas.streams.comment
+ title: name
+ - name: metadata.schemas.tables.checkConstraints.expression
in: query
- description: The comment of the stream.
+ description: The expression is the expression of a check constraint.
schema:
type: string
- title: comment
- - name: metadata.schemas.streams.type
+ title: expression
+ - name: metadata.schemas.tables.owner
in: query
- description: The type of the stream.
+ description: The owner of the table.
schema:
- title: type
- $ref: '#/components/schemas/bytebase.v1.StreamMetadata.Type'
- - name: metadata.schemas.streams.stale
+ type: string
+ title: owner
+ - name: metadata.schemas.tables.sortingKeys
in: query
- description: Indicates whether the stream was last read before the `stale_after` time.
+ description: |-
+ 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
schema:
- type: boolean
- title: stale
- - name: metadata.schemas.streams.mode
+ type: array
+ items:
+ type: string
+ title: sorting_keys
+ - name: metadata.schemas.tables.triggers.name
in: query
- description: The mode of the stream.
+ description: The name is the name of the trigger.
schema:
- title: mode
- $ref: '#/components/schemas/bytebase.v1.StreamMetadata.Mode'
- - name: metadata.schemas.streams.definition
+ type: string
+ title: name
+ - name: metadata.schemas.tables.triggers.event
in: query
- description: The definition of the stream.
+ description: |-
+ The event is the event of the trigger, such as INSERT, UPDATE, DELETE,
+ TRUNCATE.
schema:
type: string
- title: definition
- - name: metadata.schemas.tasks.name
+ title: event
+ - name: metadata.schemas.tables.triggers.timing
in: query
- description: The name is the name of a task.
+ description: The timing is the timing of the trigger, such as BEFORE, AFTER.
schema:
type: string
- title: name
- - name: metadata.schemas.tasks.id
+ title: timing
+ - name: metadata.schemas.tables.triggers.body
in: query
- description: |-
- The id is the snowflake-generated id of a task.
- Example: 01ad32a0-1bb6-5e93-0000-000000000001
+ description: The body is the body of the trigger.
schema:
type: string
- title: id
- - name: metadata.schemas.tasks.owner
+ title: body
+ - name: metadata.schemas.tables.triggers.sqlMode
in: query
- description: The owner of the task.
+ description: The SQL mode setting for the trigger.
schema:
type: string
- title: owner
- - name: metadata.schemas.tasks.comment
+ title: sql_mode
+ - name: metadata.schemas.tables.triggers.characterSetClient
in: query
- description: The comment of the task.
+ description: The character set used by the client creating the trigger.
schema:
type: string
- title: comment
- - name: metadata.schemas.tasks.warehouse
+ title: character_set_client
+ - name: metadata.schemas.tables.triggers.collationConnection
in: query
- description: The warehouse of the task.
+ description: The collation used for the connection when creating the trigger.
schema:
type: string
- title: warehouse
- - name: metadata.schemas.tasks.schedule
+ title: collation_connection
+ - name: metadata.schemas.tables.triggers.comment
in: query
- description: The schedule interval of the task.
+ description: The comment describing the trigger.
schema:
type: string
- title: schedule
- - name: metadata.schemas.tasks.predecessors
+ title: comment
+ - name: metadata.schemas.tables.triggers.skipDump
in: query
- description: The predecessor tasks of the task.
+ description: Whether to skip this trigger during schema dump operations.
schema:
- type: array
- items:
- type: string
- title: predecessors
- - name: metadata.schemas.tasks.state
+ type: boolean
+ title: skip_dump
+ - name: metadata.schemas.tables.skipDump
in: query
- description: The state of the task.
+ description: Whether to skip this table during schema dump operations.
schema:
- title: state
- $ref: '#/components/schemas/bytebase.v1.TaskMetadata.State'
- - name: metadata.schemas.tasks.condition
+ type: boolean
+ title: skip_dump
+ - name: metadata.schemas.tables.shardingInfo
in: query
- description: The condition of the task.
+ description: https://docs.pingcap.com/tidb/stable/information-schema-tables/
schema:
type: string
- title: condition
- - name: metadata.schemas.tasks.definition
+ title: sharding_info
+ - name: metadata.schemas.tables.primaryKeyType
in: query
- description: The definition of the task.
+ description: |-
+ https://docs.pingcap.com/tidb/stable/clustered-indexes/#clustered-indexes
+ CLUSTERED or NONCLUSTERED.
schema:
type: string
- title: definition
- - name: metadata.schemas.materializedViews.name
+ title: primary_key_type
+ - name: metadata.schemas.externalTables.name
in: query
- description: The name is the name of a materialized view.
+ description: The name is the name of a external table.
schema:
type: string
title: name
- - name: metadata.schemas.materializedViews.definition
+ - name: metadata.schemas.externalTables.externalServerName
in: query
- description: The definition is the definition of a materialized view.
+ description: The external_server_name is the name of the external server.
schema:
type: string
- title: definition
- - name: metadata.schemas.materializedViews.comment
+ title: external_server_name
+ - name: metadata.schemas.externalTables.externalDatabaseName
in: query
- description: The comment is the comment of a materialized view.
+ description: The external_database_name is the name of the external database.
schema:
type: string
- title: comment
- - name: metadata.schemas.materializedViews.skipDump
- in: query
- schema:
- type: boolean
- title: skip_dump
- - name: metadata.schemas.packages.name
+ title: external_database_name
+ - name: metadata.schemas.externalTables.columns.name
in: query
- description: The name is the name of a package.
+ description: The name is the name of a column.
schema:
type: string
title: name
- - name: metadata.schemas.packages.definition
+ - name: metadata.schemas.externalTables.columns.position
in: query
- description: The definition is the definition of a package.
+ description: The position is the position in columns.
schema:
- type: string
- title: definition
- - name: metadata.schemas.owner
+ type: integer
+ title: position
+ format: int32
+ - name: metadata.schemas.externalTables.columns.hasDefault
in: query
- description: The owner of the schema.
schema:
- type: string
- title: owner
- - name: metadata.schemas.sequences.name
+ type: boolean
+ title: has_default
+ - name: metadata.schemas.externalTables.columns.default
in: query
- description: The name of a sequence.
+ description: The default value of column.
schema:
type: string
- title: name
- - name: metadata.schemas.sequences.dataType
+ title: default
+ - name: metadata.schemas.externalTables.columns.defaultOnNull
in: query
- description: The data type of a sequence.
+ description: |-
+ Oracle specific metadata.
+ The default_on_null is the default on null of a column.
schema:
- type: string
- title: data_type
- - name: metadata.schemas.sequences.start
+ type: boolean
+ title: default_on_null
+ - name: metadata.schemas.externalTables.columns.onUpdate
in: query
- description: The start value of a sequence.
+ description: |-
+ The on_update is the on update action of a column.
+ For MySQL like databases, it's only supported for TIMESTAMP columns with
+ CURRENT_TIMESTAMP as on update value.
schema:
type: string
- title: start
- - name: metadata.schemas.sequences.minValue
+ title: on_update
+ - name: metadata.schemas.externalTables.columns.nullable
in: query
- description: The minimum value of a sequence.
+ description: The nullable is the nullable of a column.
schema:
- type: string
- title: min_value
- - name: metadata.schemas.sequences.maxValue
+ type: boolean
+ title: nullable
+ - name: metadata.schemas.externalTables.columns.type
in: query
- description: The maximum value of a sequence.
+ description: The type is the type of a column.
schema:
type: string
- title: max_value
- - name: metadata.schemas.sequences.increment
+ title: type
+ - name: metadata.schemas.externalTables.columns.characterSet
in: query
- description: Increment value of a sequence.
+ description: The character_set is the character_set of a column.
schema:
type: string
- title: increment
- - name: metadata.schemas.sequences.cycle
+ title: character_set
+ - name: metadata.schemas.externalTables.columns.collation
in: query
- description: Cycle is whether the sequence cycles.
+ description: The collation is the collation of a column.
schema:
- type: boolean
- title: cycle
- - name: metadata.schemas.sequences.cacheSize
+ type: string
+ title: collation
+ - name: metadata.schemas.externalTables.columns.comment
in: query
- description: Cache size of a sequence.
+ description: The comment is the comment of a column.
schema:
type: string
- title: cache_size
- - name: metadata.schemas.sequences.lastValue
+ title: comment
+ - name: metadata.schemas.externalTables.columns.generation.type
in: query
- description: Last value of a sequence.
schema:
- type: string
- title: last_value
- - name: metadata.schemas.sequences.ownerTable
+ title: type
+ $ref: '#/components/schemas/bytebase.v1.GenerationMetadata.Type'
+ - name: metadata.schemas.externalTables.columns.generation.expression
in: query
- description: The owner table of the sequence.
schema:
type: string
- title: owner_table
- - name: metadata.schemas.sequences.ownerColumn
+ title: expression
+ - name: metadata.schemas.externalTables.columns.isIdentity
in: query
- description: The owner column of the sequence.
schema:
- type: string
- title: owner_column
- - name: metadata.schemas.sequences.comment
+ type: boolean
+ title: is_identity
+ - name: metadata.schemas.externalTables.columns.identityGeneration
in: query
- description: The comment describing the sequence.
+ description: The identity_generation is for identity columns, PG only.
schema:
- type: string
- title: comment
- - name: metadata.schemas.sequences.skipDump
+ title: identity_generation
+ $ref: '#/components/schemas/bytebase.v1.ColumnMetadata.IdentityGeneration'
+ - name: metadata.schemas.externalTables.columns.identitySeed
in: query
- description: Whether to skip this sequence during schema dump operations.
+ description: The identity_seed is for identity columns, MSSQL only.
schema:
- type: boolean
- title: skip_dump
- - name: metadata.schemas.events.name
+ type:
+ - integer
+ - string
+ title: identity_seed
+ format: int64
+ - name: metadata.schemas.externalTables.columns.identityIncrement
in: query
- description: The name of the event.
+ description: The identity_increment is for identity columns, MSSQL only.
schema:
- type: string
- title: name
- - name: metadata.schemas.events.definition
+ type:
+ - integer
+ - string
+ title: identity_increment
+ format: int64
+ - name: metadata.schemas.externalTables.columns.defaultConstraintName
in: query
- description: The schedule of the event.
+ description: |-
+ The default_constraint_name is the name of the default constraint, MSSQL only.
+ In MSSQL, default values are implemented as named constraints. When modifying or
+ dropping a column's default value, you must reference the constraint by name.
+ This field stores the actual constraint name from the database.
+
+ Example: A column definition like:
+ CREATE TABLE employees (
+ status NVARCHAR(20) DEFAULT 'active'
+ )
+
+ Will create a constraint with an auto-generated name like 'DF__employees__statu__3B75D760'
+ or a user-defined name if specified:
+ ALTER TABLE employees ADD CONSTRAINT DF_employees_status DEFAULT 'active' FOR status
+
+ To modify the default, you must first drop the existing constraint by name:
+ ALTER TABLE employees DROP CONSTRAINT DF__employees__statu__3B75D760
+ ALTER TABLE employees ADD CONSTRAINT DF_employees_status DEFAULT 'inactive' FOR status
+
+ This field is populated when syncing from the database. When empty (e.g., when parsing
+ from SQL files), the system cannot automatically drop the constraint.
schema:
type: string
- title: definition
- - name: metadata.schemas.events.timeZone
+ title: default_constraint_name
+ - name: metadata.schemas.externalTables.columns.srid
in: query
- description: The time zone of the event.
+ description: |-
+ The spatial reference system identifier of a spatial column, MySQL 8.0 only.
+ Unset means the column declares no SRID; presence carries the explicit SRID,
+ including the valid SRID 0. SRS_IDs are unsigned 32-bit (custom SRSs may exceed
+ int32).
schema:
- type: string
- title: time_zone
- - name: metadata.schemas.events.sqlMode
+ type: integer
+ title: srid
+ - name: metadata.schemas.externalTables.columns.isInvisible
in: query
- description: The SQL mode setting for the event.
+ description: Whether the column is invisible (hidden from SELECT *), MySQL 8.0.23+ only.
schema:
- type: string
- title: sql_mode
- - name: metadata.schemas.events.characterSetClient
+ type: boolean
+ title: is_invisible
+ - name: metadata.schemas.views.name
in: query
- description: The character set used by the client creating the event.
+ description: The name is the name of a view.
schema:
type: string
- title: character_set_client
- - name: metadata.schemas.events.collationConnection
+ title: name
+ - name: metadata.schemas.views.definition
in: query
- description: The collation used for the connection when creating the event.
+ description: The definition is the definition of a view.
schema:
type: string
- title: collation_connection
- - name: metadata.schemas.events.comment
+ title: definition
+ - name: metadata.schemas.views.comment
in: query
- description: The comment is the comment of an event.
+ description: The comment is the comment of a view.
schema:
type: string
title: comment
- - name: metadata.schemas.enumTypes.name
+ - name: metadata.schemas.views.dependencyColumns.schema
in: query
- description: The name of a type.
+ description: The schema is the schema of a reference column.
schema:
type: string
- title: name
- - name: metadata.schemas.enumTypes.values
- in: query
- description: The enum values of a type.
- schema:
- type: array
- items:
- type: string
- title: values
- - name: metadata.schemas.enumTypes.comment
+ title: schema
+ - name: metadata.schemas.views.dependencyColumns.table
in: query
- description: The comment describing the enum type.
+ description: The table is the table of a reference column.
schema:
type: string
- title: comment
- - name: metadata.schemas.enumTypes.skipDump
+ title: table
+ - name: metadata.schemas.views.dependencyColumns.column
in: query
- description: Whether to skip this enum type during schema dump operations.
+ description: The column is the name of a reference column.
schema:
- type: boolean
- title: skip_dump
- - name: metadata.schemas.skipDump
+ type: string
+ title: column
+ - name: metadata.schemas.views.columns.name
in: query
- description: Whether to skip this schema during schema dump operations.
+ description: The name is the name of a column.
schema:
- type: boolean
- title: skip_dump
- - name: metadata.schemas.comment
+ type: string
+ title: name
+ - name: metadata.schemas.views.columns.position
in: query
- description: The comment is the comment of a schema.
+ description: The position is the position in columns.
schema:
- type: string
- title: comment
- - name: metadata.schemas.compositeTypes.name
+ type: integer
+ title: position
+ format: int32
+ - name: metadata.schemas.views.columns.hasDefault
in: query
- description: The name of the composite type.
schema:
- type: string
- title: name
- - name: metadata.schemas.compositeTypes.attributes.name
+ type: boolean
+ title: has_default
+ - name: metadata.schemas.views.columns.default
in: query
- description: The name of the attribute.
+ description: The default value of column.
schema:
type: string
- title: name
- - name: metadata.schemas.compositeTypes.attributes.type
+ title: default
+ - name: metadata.schemas.views.columns.defaultOnNull
in: query
- description: The attribute type. User-defined types are always schema-qualified.
+ description: |-
+ Oracle specific metadata.
+ The default_on_null is the default on null of a column.
schema:
- type: string
- title: type
- - name: metadata.schemas.compositeTypes.attributes.collation
+ type: boolean
+ title: default_on_null
+ - name: metadata.schemas.views.columns.onUpdate
in: query
description: |-
- The non-default collation of the attribute as an emit-ready SQL
- identifier reference (quoted as needed, schema-qualified when outside
- pg_catalog), empty otherwise. e.g. `"C"` or `locale.en_us`.
+ The on_update is the on update action of a column.
+ For MySQL like databases, it's only supported for TIMESTAMP columns with
+ CURRENT_TIMESTAMP as on update value.
schema:
type: string
- title: collation
- - name: metadata.schemas.compositeTypes.attributes.comment
+ title: on_update
+ - name: metadata.schemas.views.columns.nullable
in: query
- description: The comment describing the attribute.
+ description: The nullable is the nullable of a column.
schema:
- type: string
- title: comment
- - name: metadata.schemas.compositeTypes.comment
+ type: boolean
+ title: nullable
+ - name: metadata.schemas.views.columns.type
in: query
- description: The comment describing the composite type.
+ description: The type is the type of a column.
schema:
type: string
- title: comment
- - name: metadata.characterSet
+ title: type
+ - name: metadata.schemas.views.columns.characterSet
in: query
- description: The character_set is the character set of a database.
+ description: The character_set is the character_set of a column.
schema:
type: string
title: character_set
- - name: metadata.collation
+ - name: metadata.schemas.views.columns.collation
in: query
- description: The collation is the collation of a database.
+ description: The collation is the collation of a column.
schema:
type: string
title: collation
- - name: metadata.extensions.name
+ - name: metadata.schemas.views.columns.comment
in: query
- description: The name is the name of an extension.
+ description: The comment is the comment of a column.
schema:
type: string
- title: name
- - name: metadata.extensions.schema
+ title: comment
+ - name: metadata.schemas.views.columns.generation.type
in: query
- description: |-
- The schema is the extension that is installed to. But the extension usage
- is not limited to the schema.
schema:
- type: string
- title: schema
- - name: metadata.extensions.version
+ title: type
+ $ref: '#/components/schemas/bytebase.v1.GenerationMetadata.Type'
+ - name: metadata.schemas.views.columns.generation.expression
in: query
- description: The version is the version of an extension.
schema:
type: string
- title: version
- - name: metadata.extensions.description
+ title: expression
+ - name: metadata.schemas.views.columns.isIdentity
in: query
- description: The description is the description of an extension.
schema:
- type: string
- title: description
- - name: metadata.owner
+ type: boolean
+ title: is_identity
+ - name: metadata.schemas.views.columns.identityGeneration
in: query
- description: The owner of the database.
+ description: The identity_generation is for identity columns, PG only.
schema:
- type: string
- title: owner
- - name: metadata.searchPath
+ title: identity_generation
+ $ref: '#/components/schemas/bytebase.v1.ColumnMetadata.IdentityGeneration'
+ - name: metadata.schemas.views.columns.identitySeed
in: query
- description: The search_path is the search path of a PostgreSQL database.
+ description: The identity_seed is for identity columns, MSSQL only.
schema:
- type: string
- title: search_path
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.GetSchemaStringResponse'
- /v1/instances/{instance}/databases/{database}/sdlSchema:
- get:
- tags:
- - DatabaseService
- summary: GetDatabaseSDLSchema
- description: |-
- Retrieves database schema in SDL (Schema Definition Language) format.
- Permissions required: bb.databases.getSchema
- operationId: DatabaseService_GetDatabaseSDLSchema
- parameters:
- - name: instance
- in: path
- description: The instance id.
- required: true
+ type:
+ - integer
+ - string
+ title: identity_seed
+ format: int64
+ - name: metadata.schemas.views.columns.identityIncrement
+ in: query
+ description: The identity_increment is for identity columns, MSSQL only.
+ schema:
+ type:
+ - integer
+ - string
+ title: identity_increment
+ format: int64
+ - name: metadata.schemas.views.columns.defaultConstraintName
+ in: query
+ description: |-
+ The default_constraint_name is the name of the default constraint, MSSQL only.
+ In MSSQL, default values are implemented as named constraints. When modifying or
+ dropping a column's default value, you must reference the constraint by name.
+ This field stores the actual constraint name from the database.
+
+ Example: A column definition like:
+ CREATE TABLE employees (
+ status NVARCHAR(20) DEFAULT 'active'
+ )
+
+ Will create a constraint with an auto-generated name like 'DF__employees__statu__3B75D760'
+ or a user-defined name if specified:
+ ALTER TABLE employees ADD CONSTRAINT DF_employees_status DEFAULT 'active' FOR status
+
+ To modify the default, you must first drop the existing constraint by name:
+ ALTER TABLE employees DROP CONSTRAINT DF__employees__statu__3B75D760
+ ALTER TABLE employees ADD CONSTRAINT DF_employees_status DEFAULT 'inactive' FOR status
+
+ This field is populated when syncing from the database. When empty (e.g., when parsing
+ from SQL files), the system cannot automatically drop the constraint.
schema:
type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ title: default_constraint_name
+ - name: metadata.schemas.views.columns.srid
+ in: query
+ description: |-
+ The spatial reference system identifier of a spatial column, MySQL 8.0 only.
+ Unset means the column declares no SRID; presence carries the explicit SRID,
+ including the valid SRID 0. SRS_IDs are unsigned 32-bit (custom SRSs may exceed
+ int32).
+ schema:
+ type: integer
+ title: srid
+ - name: metadata.schemas.views.columns.isInvisible
+ in: query
+ description: Whether the column is invisible (hidden from SELECT *), MySQL 8.0.23+ only.
+ schema:
+ type: boolean
+ title: is_invisible
+ - name: metadata.schemas.views.triggers.name
+ in: query
+ description: The name is the name of the trigger.
schema:
type: string
- - name: format
+ title: name
+ - name: metadata.schemas.views.triggers.event
in: query
- description: The format of the SDL schema output.
+ description: |-
+ The event is the event of the trigger, such as INSERT, UPDATE, DELETE,
+ TRUNCATE.
schema:
- title: format
- $ref: '#/components/schemas/bytebase.v1.GetDatabaseSDLSchemaRequest.SDLFormat'
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.DatabaseSDLSchema'
- /v1/instances/{instance}/databases/{database}:diffMetadata:
- post:
- tags:
- - DatabaseService
- summary: DiffMetadata
- description: |-
- Generates migration statements from the database's current schema to the
- given target metadata.
- Permissions required: bb.databases.diffMetadata
- operationId: DatabaseService_DiffMetadata
- parameters:
- - name: instance
- in: path
- description: The instance id.
- required: true
+ type: string
+ title: event
+ - name: metadata.schemas.views.triggers.timing
+ in: query
+ description: The timing is the timing of the trigger, such as BEFORE, AFTER.
schema:
type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ title: timing
+ - name: metadata.schemas.views.triggers.body
+ in: query
+ description: The body is the body of the trigger.
schema:
type: string
- requestBody:
- content:
- application/json:
- schema:
- type: object
- properties:
- targetMetadata:
- title: target_metadata
- description: |-
- The metadata of the target schema. The source metadata and the engine are
- read from the database, so only the target travels in the request.
- Must describe the COMPLETE target schema: the diff runs against the full
- stored source, so any object omitted from the target (for example by a
- truncated metadata fetch) is treated as dropped.
- $ref: '#/components/schemas/bytebase.v1.DatabaseMetadata'
- title: DiffMetadataRequest
- required:
- - targetMetadata
- additionalProperties: false
- required: true
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.DiffMetadataResponse'
- /v1/instances/{instance}/databases/{database}:diffSchema:
- post:
- tags:
- - DatabaseService
- summary: DiffSchema
- description: |-
- Compares and generates migration statements between two schemas.
- Permissions required: bb.databases.get
- operationId: DatabaseService_DiffSchema
- parameters:
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: body
+ - name: metadata.schemas.views.triggers.sqlMode
+ in: query
+ description: The SQL mode setting for the trigger.
schema:
type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ title: sql_mode
+ - name: metadata.schemas.views.triggers.characterSetClient
+ in: query
+ description: The character set used by the client creating the trigger.
schema:
type: string
- requestBody:
- content:
- application/json:
- schema:
- type: object
- allOf:
- - {}
- - oneOf:
- - type: object
- properties:
- changelog:
- type: string
- title: changelog
- description: |-
- The resource name of the changelog
- Format:
- instances/{instance}/databases/{database}/changelogs/{changelog} or projects/{project}/instances/{instance}/databases/{database}/changelogs/{changelog}
- title: changelog
- required:
- - changelog
- - type: object
- properties:
- schema:
- type: string
- title: schema
- description: The target schema.
- title: schema
- required:
- - schema
- title: DiffSchemaRequest
- additionalProperties: false
- required: true
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.DiffSchemaResponse'
- /v1/instances/{instance}/databases/{database}:export:
- post:
- tags:
- - SQLService
- summary: Export
- description: |-
- Exports query results to a file format.
- Permissions required: bb.databases.get
- operationId: SQLService_Export
- parameters:
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: character_set_client
+ - name: metadata.schemas.views.triggers.collationConnection
+ in: query
+ description: The collation used for the connection when creating the trigger.
schema:
type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ title: collation_connection
+ - name: metadata.schemas.views.triggers.comment
+ in: query
+ description: The comment describing the trigger.
schema:
type: string
- requestBody:
- content:
- application/json:
- schema:
- type: object
- properties:
- statement:
- type: string
- title: statement
- description: The SQL statement to execute.
- limit:
- type: integer
- title: limit
- format: int32
- description: The maximum number of rows to return.
- format:
- title: format
- description: The export format.
- $ref: '#/components/schemas/bytebase.v1.ExportFormat'
- admin:
- type: boolean
- title: admin
- description: |-
- The admin is used for workspace owner and DBA for exporting data from SQL
- Editor Admin mode. The exported data is not masked.
- password:
- type: string
- title: password
- description: The zip password provide by users.
- dataSourceId:
- type: string
- title: data_source_id
- description: |-
- The id of data source.
- If omitted, Export resolves the data source server-side by using the
- single read-only data source when exactly one exists, or the admin data
- source otherwise. It can also be set explicitly to export from the admin
- data source or a specific read-only data source.
- schema:
- type:
- - string
- - "null"
- title: schema
- description: |-
- The default schema to search objects. Equals to the current schema in
- Oracle and search path in Postgres.
- container:
- type:
- - string
- - "null"
- title: container
- description: |-
- Container is the container name to execute the query against, used for
- CosmosDB only.
- title: ExportRequest
- additionalProperties: false
- required: true
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.ExportResponse'
- /v1/instances/{instance}/databases/{database}:query:
- post:
- tags:
- - SQLService
- summary: Query
- description: |-
- Executes a read-only SQL query against a database.
- Permissions required: bb.databases.get
- operationId: SQLService_Query
- parameters:
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: comment
+ - name: metadata.schemas.views.triggers.skipDump
+ in: query
+ description: Whether to skip this trigger during schema dump operations.
+ schema:
+ type: boolean
+ title: skip_dump
+ - name: metadata.schemas.views.skipDump
+ in: query
+ schema:
+ type: boolean
+ title: skip_dump
+ - name: metadata.schemas.functions.name
+ in: query
+ description: The name is the name of a function.
schema:
type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ title: name
+ - name: metadata.schemas.functions.definition
+ in: query
+ description: The definition is the definition of a function.
schema:
type: string
- requestBody:
- content:
- application/json:
- schema:
- type: object
- properties:
- statement:
- type: string
- title: statement
- description: The SQL statement to execute.
- limit:
- type: integer
- title: limit
- format: int32
- description: The maximum number of rows to return.
- dataSourceId:
- type: string
- title: data_source_id
- description: |-
- The id of data source.
- If omitted, Query resolves the data source server-side by using the single
- read-only data source when exactly one exists, or the admin data source
- otherwise. It can also be set explicitly to query the admin data source or
- a specific read-only data source.
- explain:
- type: boolean
- title: explain
- description: Explain the statement.
- schema:
- type:
- - string
- - "null"
- title: schema
- description: |-
- The default schema to search objects. Equals to the current schema in
- Oracle and search path in Postgres.
- queryOption:
- title: query_option
- $ref: '#/components/schemas/bytebase.v1.QueryOption'
- container:
- type:
- - string
- - "null"
- title: container
- description: |-
- Container is the container name to execute the query against, used for
- CosmosDB only.
- title: QueryRequest
- additionalProperties: false
- required: true
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.QueryResponse'
- /v1/instances/{instance}/databases/{database}:sync:
- post:
- tags:
- - DatabaseService
- summary: SyncDatabase
- description: |-
- Synchronizes database schema from the instance.
- Permissions required: bb.databases.sync
- operationId: DatabaseService_SyncDatabase
- parameters:
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: definition
+ - name: metadata.schemas.functions.signature
+ in: query
+ description: |-
+ The signature is the name with the number and type of input arguments the
+ function takes.
schema:
type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ title: signature
+ - name: metadata.schemas.functions.characterSetClient
+ in: query
+ description: MySQL specific metadata.
schema:
type: string
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.SyncDatabaseResponse'
- /v1/instances/{instance}/databases:batchGet:
- get:
- tags:
- - DatabaseService
- summary: BatchGetDatabases
- description: |-
- Retrieves multiple databases by their names.
- One resource per requested name, in request order. The first name that
- does not resolve fails the whole call (AIP-231: no partial response).
- Permissions required: bb.databases.get (on each named database's project)
- operationId: DatabaseService_BatchGetDatabases2
- parameters:
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: character_set_client
+ - name: metadata.schemas.functions.collationConnection
+ in: query
schema:
type: string
- - name: names
+ title: collation_connection
+ - name: metadata.schemas.functions.databaseCollation
in: query
- description: The list of database names to retrieve.
- required: true
schema:
- type: array
- items:
- type: string
- title: names
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.BatchGetDatabasesResponse'
- /v1/instances/{instance}/databases:batchSync:
- post:
- tags:
- - DatabaseService
- summary: BatchSyncDatabases
- description: |-
- Synchronizes multiple databases in a single batch operation.
- Permissions required: bb.databases.sync
- operationId: DatabaseService_BatchSyncDatabases
- parameters:
- - name: instance
- in: path
- description: The instance id.
- required: true
+ type: string
+ title: database_collation
+ - name: metadata.schemas.functions.sqlMode
+ in: query
schema:
type: string
- requestBody:
- content:
- application/json:
- schema:
- type: object
- properties:
- names:
- type: array
- items:
- type: string
- title: names
- description: The list of database names to sync.
- title: BatchSyncDatabasesRequest
- required:
- - names
- additionalProperties: false
- required: true
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.BatchSyncDatabasesResponse'
- /v1/instances/{instance}/databases:batchUpdate:
- post:
- tags:
- - DatabaseService
- summary: BatchUpdateDatabases
- description: |-
- Updates multiple databases in a single batch operation.
- Permissions required: bb.databases.update
- operationId: DatabaseService_BatchUpdateDatabases
- parameters:
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: sql_mode
+ - name: metadata.schemas.functions.comment
+ in: query
schema:
type: string
- requestBody:
- content:
- application/json:
- schema:
- type: object
- properties:
- requests:
- type: array
- items:
- $ref: '#/components/schemas/bytebase.v1.UpdateDatabaseRequest'
- title: requests
- description: |-
- The request message specifying the resources to update.
- A maximum of 1000 databases can be modified in a batch.
- title: BatchUpdateDatabasesRequest
- required:
- - requests
- additionalProperties: false
- required: true
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.BatchUpdateDatabasesResponse'
- /v1/instances/{instance}/roles:
- get:
- tags:
- - InstanceRoleService
- summary: ListInstanceRoles
- description: |-
- Lists all database roles in an instance.
- Permissions required: bb.instanceRoles.list
- operationId: InstanceRoleService_ListInstanceRoles
- parameters:
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: comment
+ - name: metadata.schemas.functions.dependencyTables.schema
+ in: query
+ description: The schema is the schema of a reference table.
schema:
type: string
- - name: pageSize
+ title: schema
+ - name: metadata.schemas.functions.dependencyTables.table
in: query
- description: |-
- Not used.
- The maximum number of roles to return. The service may return fewer than
- this value.
- If unspecified, at most 10 roles will be returned.
- The maximum value is 1000; values above 1000 will be coerced to 1000.
+ description: The table is the name of a reference table.
schema:
- type: integer
- title: page_size
- format: int32
- - name: pageToken
+ type: string
+ title: table
+ - name: metadata.schemas.functions.skipDump
+ in: query
+ schema:
+ type: boolean
+ title: skip_dump
+ - name: metadata.schemas.procedures.name
+ in: query
+ description: The name is the name of a procedure.
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.procedures.definition
+ in: query
+ description: The definition is the definition of a procedure.
+ schema:
+ type: string
+ title: definition
+ - name: metadata.schemas.procedures.signature
in: query
description: |-
- Not used.
- A page token, received from a previous `ListInstanceRoles` call.
- Provide this to retrieve the subsequent page.
-
- When paginating, all other parameters provided to `ListInstanceRoles` must match
- the call that provided the page token.
+ The signature is the name with the number and type of input arguments the
+ procedure takes.
schema:
type: string
- title: page_token
- - name: refresh
+ title: signature
+ - name: metadata.schemas.procedures.characterSetClient
in: query
- description: Refresh will refresh and return the latest data.
+ description: MySQL specific metadata.
schema:
- type: boolean
- title: refresh
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.ListInstanceRolesResponse'
- /v1/instances/{instance}:addDataSource:
- post:
- tags:
- - InstanceService
- summary: AddDataSource
- description: |-
- Adds a read-only data source to an instance.
- Permissions required: bb.instances.update
- operationId: InstanceService_AddDataSource
- parameters:
- - name: instance
- in: path
- description: The instance id.
- required: true
+ type: string
+ title: character_set_client
+ - name: metadata.schemas.procedures.collationConnection
+ in: query
schema:
type: string
- requestBody:
- content:
- application/json:
- schema:
- type: object
- properties:
- dataSource:
- title: data_source
- description: |-
- Identified by data source ID.
- Only READ_ONLY data source can be added.
- $ref: '#/components/schemas/bytebase.v1.DataSource'
- validateOnly:
- type: boolean
- title: validate_only
- description: Validate only also tests the data source connection.
- title: AddDataSourceRequest
- required:
- - dataSource
- additionalProperties: false
- required: true
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.Instance'
- /v1/instances/{instance}:databases:
- post:
- tags:
- - InstanceService
- summary: ListInstanceDatabase
- description: |-
- Lists all databases within an instance without creating them.
- Permissions required: bb.instances.get
- operationId: InstanceService_ListInstanceDatabase
- parameters:
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: collation_connection
+ - name: metadata.schemas.procedures.databaseCollation
+ in: query
schema:
type: string
- requestBody:
- content:
- application/json:
- schema:
- type: object
- properties:
- instance:
- oneOf:
- - $ref: '#/components/schemas/bytebase.v1.Instance'
- - type: "null"
- title: instance
- description: The target instance. We need to set this field if the target instance is not created yet.
- title: ListInstanceDatabaseRequest
- required:
- - instance
- additionalProperties: false
- required: true
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.ListInstanceDatabaseResponse'
- /v1/instances/{instance}:removeDataSource:
- post:
- tags:
- - InstanceService
- summary: RemoveDataSource
- description: |-
- Removes a read-only data source from an instance.
- Permissions required: bb.instances.update
- operationId: InstanceService_RemoveDataSource
- parameters:
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: database_collation
+ - name: metadata.schemas.procedures.sqlMode
+ in: query
schema:
type: string
- requestBody:
- content:
- application/json:
- schema:
- type: object
- properties:
- dataSource:
- title: data_source
- description: |-
- Identified by data source ID.
- Only READ_ONLY data source can be removed.
- $ref: '#/components/schemas/bytebase.v1.DataSource'
- title: RemoveDataSourceRequest
- required:
- - dataSource
- additionalProperties: false
- required: true
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.Instance'
- /v1/instances/{instance}:sync:
- post:
- tags:
- - InstanceService
- summary: SyncInstance
- description: |-
- Syncs database schemas and metadata from an instance.
- Permissions required: bb.instances.sync
- operationId: InstanceService_SyncInstance
- parameters:
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: sql_mode
+ - name: metadata.schemas.procedures.comment
+ in: query
+ description: The comment is the comment of a procedure.
schema:
type: string
- requestBody:
- content:
- application/json:
- schema:
- type: object
- properties:
- enableFullSync:
- type: boolean
- title: enable_full_sync
- description: |-
- When full sync is enabled, all databases in the instance will be synchronized. Otherwise, only
- the instance metadata (such as the database list) and any newly discovered databases will be synced.
- title: SyncInstanceRequest
+ title: comment
+ - name: metadata.schemas.procedures.skipDump
+ in: query
+ schema:
+ type: boolean
+ title: skip_dump
+ - name: metadata.schemas.streams.name
+ in: query
+ description: The name is the name of a stream.
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.streams.tableName
+ in: query
+ description: The table_name is the name of the table/view that the stream is created on.
+ schema:
+ type: string
+ title: table_name
+ - name: metadata.schemas.streams.owner
+ in: query
+ description: The owner of the stream.
+ schema:
+ type: string
+ title: owner
+ - name: metadata.schemas.streams.comment
+ in: query
+ description: The comment of the stream.
+ schema:
+ type: string
+ title: comment
+ - name: metadata.schemas.streams.type
+ in: query
+ description: The type of the stream.
+ schema:
+ title: type
+ $ref: '#/components/schemas/bytebase.v1.StreamMetadata.Type'
+ - name: metadata.schemas.streams.stale
+ in: query
+ description: Indicates whether the stream was last read before the `stale_after` time.
+ schema:
+ type: boolean
+ title: stale
+ - name: metadata.schemas.streams.mode
+ in: query
+ description: The mode of the stream.
+ schema:
+ title: mode
+ $ref: '#/components/schemas/bytebase.v1.StreamMetadata.Mode'
+ - name: metadata.schemas.streams.definition
+ in: query
+ description: The definition of the stream.
+ schema:
+ type: string
+ title: definition
+ - name: metadata.schemas.tasks.name
+ in: query
+ description: The name is the name of a task.
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.tasks.id
+ in: query
+ description: |-
+ The id is the snowflake-generated id of a task.
+ Example: 01ad32a0-1bb6-5e93-0000-000000000001
+ schema:
+ type: string
+ title: id
+ - name: metadata.schemas.tasks.owner
+ in: query
+ description: The owner of the task.
+ schema:
+ type: string
+ title: owner
+ - name: metadata.schemas.tasks.comment
+ in: query
+ description: The comment of the task.
+ schema:
+ type: string
+ title: comment
+ - name: metadata.schemas.tasks.warehouse
+ in: query
+ description: The warehouse of the task.
+ schema:
+ type: string
+ title: warehouse
+ - name: metadata.schemas.tasks.schedule
+ in: query
+ description: The schedule interval of the task.
+ schema:
+ type: string
+ title: schedule
+ - name: metadata.schemas.tasks.predecessors
+ in: query
+ description: The predecessor tasks of the task.
+ schema:
+ type: array
+ items:
+ type: string
+ title: predecessors
+ - name: metadata.schemas.tasks.state
+ in: query
+ description: The state of the task.
+ schema:
+ title: state
+ $ref: '#/components/schemas/bytebase.v1.TaskMetadata.State'
+ - name: metadata.schemas.tasks.condition
+ in: query
+ description: The condition of the task.
+ schema:
+ type: string
+ title: condition
+ - name: metadata.schemas.tasks.definition
+ in: query
+ description: The definition of the task.
+ schema:
+ type: string
+ title: definition
+ - name: metadata.schemas.materializedViews.name
+ in: query
+ description: The name is the name of a materialized view.
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.materializedViews.definition
+ in: query
+ description: The definition is the definition of a materialized view.
+ schema:
+ type: string
+ title: definition
+ - name: metadata.schemas.materializedViews.comment
+ in: query
+ description: The comment is the comment of a materialized view.
+ schema:
+ type: string
+ title: comment
+ - name: metadata.schemas.materializedViews.dependencyColumns.schema
+ in: query
+ description: The schema is the schema of a reference column.
+ schema:
+ type: string
+ title: schema
+ - name: metadata.schemas.materializedViews.dependencyColumns.table
+ in: query
+ description: The table is the table of a reference column.
+ schema:
+ type: string
+ title: table
+ - name: metadata.schemas.materializedViews.dependencyColumns.column
+ in: query
+ description: The column is the name of a reference column.
+ schema:
+ type: string
+ title: column
+ - name: metadata.schemas.materializedViews.triggers.name
+ in: query
+ description: The name is the name of the trigger.
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.materializedViews.triggers.event
+ in: query
+ description: |-
+ The event is the event of the trigger, such as INSERT, UPDATE, DELETE,
+ TRUNCATE.
+ schema:
+ type: string
+ title: event
+ - name: metadata.schemas.materializedViews.triggers.timing
+ in: query
+ description: The timing is the timing of the trigger, such as BEFORE, AFTER.
+ schema:
+ type: string
+ title: timing
+ - name: metadata.schemas.materializedViews.triggers.body
+ in: query
+ description: The body is the body of the trigger.
+ schema:
+ type: string
+ title: body
+ - name: metadata.schemas.materializedViews.triggers.sqlMode
+ in: query
+ description: The SQL mode setting for the trigger.
+ schema:
+ type: string
+ title: sql_mode
+ - name: metadata.schemas.materializedViews.triggers.characterSetClient
+ in: query
+ description: The character set used by the client creating the trigger.
+ schema:
+ type: string
+ title: character_set_client
+ - name: metadata.schemas.materializedViews.triggers.collationConnection
+ in: query
+ description: The collation used for the connection when creating the trigger.
+ schema:
+ type: string
+ title: collation_connection
+ - name: metadata.schemas.materializedViews.triggers.comment
+ in: query
+ description: The comment describing the trigger.
+ schema:
+ type: string
+ title: comment
+ - name: metadata.schemas.materializedViews.triggers.skipDump
+ in: query
+ description: Whether to skip this trigger during schema dump operations.
+ schema:
+ type: boolean
+ title: skip_dump
+ - name: metadata.schemas.materializedViews.indexes.name
+ in: query
+ description: The name is the name of an index.
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.materializedViews.indexes.expressions
+ in: query
+ description: |-
+ The expressions are the ordered columns or expressions of an index.
+ This could refer to a column or an expression.
+ schema:
+ type: array
+ items:
+ type: string
+ title: expressions
+ - name: metadata.schemas.materializedViews.indexes.keyLength
+ in: query
+ description: |-
+ The key_lengths are the ordered key lengths of an index.
+ If the key length is not specified, it's -1.
+ schema:
+ type: array
+ items:
+ type:
+ - integer
+ - string
+ format: int64
+ title: key_length
+ - name: metadata.schemas.materializedViews.indexes.descending
+ in: query
+ description: The descending is the ordered descending of an index.
+ schema:
+ type: array
+ items:
+ type: boolean
+ title: descending
+ - name: metadata.schemas.materializedViews.indexes.type
+ in: query
+ description: The type is the type of an index.
+ schema:
+ type: string
+ title: type
+ - name: metadata.schemas.materializedViews.indexes.unique
+ in: query
+ description: The unique is whether the index is unique.
+ schema:
+ type: boolean
+ title: unique
+ - name: metadata.schemas.materializedViews.indexes.primary
+ in: query
+ description: The primary is whether the index is a primary key index.
+ schema:
+ type: boolean
+ title: primary
+ - name: metadata.schemas.materializedViews.indexes.visible
+ in: query
+ description: The visible is whether the index is visible.
+ schema:
+ type: boolean
+ title: visible
+ - name: metadata.schemas.materializedViews.indexes.comment
+ in: query
+ description: The comment is the comment of an index.
+ schema:
+ type: string
+ title: comment
+ - name: metadata.schemas.materializedViews.indexes.definition
+ in: query
+ description: The definition of an index.
+ schema:
+ type: string
+ title: definition
+ - name: metadata.schemas.materializedViews.indexes.parentIndexSchema
+ in: query
+ description: The schema name of the parent index.
+ schema:
+ type: string
+ title: parent_index_schema
+ - name: metadata.schemas.materializedViews.indexes.parentIndexName
+ in: query
+ description: The index name of the parent index.
+ schema:
+ type: string
+ title: parent_index_name
+ - name: metadata.schemas.materializedViews.indexes.granularity
+ in: query
+ description: The number of granules in the block. It's a ClickHouse specific field.
+ schema:
+ type:
+ - integer
+ - string
+ title: granularity
+ format: int64
+ - name: metadata.schemas.materializedViews.indexes.isConstraint
+ in: query
+ description: |-
+ It's a PostgreSQL specific field.
+ The unique constraint and unique index are not the same thing in PostgreSQL.
+ schema:
+ type: boolean
+ title: is_constraint
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.method
+ in: query
+ description: Spatial indexing method (e.g., "SPATIAL", "R-TREE", "GIST")
+ schema:
+ type: string
+ title: method
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.tessellation.scheme
+ in: query
+ description: Tessellation scheme (e.g., "GEOMETRY_GRID", "GEOGRAPHY_GRID", "GEOMETRY_AUTO_GRID")
+ schema:
+ type: string
+ title: scheme
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.tessellation.gridLevels.level
+ in: query
+ description: Grid level number (1-4 for SQL Server)
+ schema:
+ type: integer
+ title: level
+ format: int32
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.tessellation.gridLevels.density
+ in: query
+ description: Grid density (LOW, MEDIUM, HIGH)
+ schema:
+ type: string
+ title: density
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.tessellation.cellsPerObject
+ in: query
+ description: Number of cells per object (1-8192 for SQL Server)
+ schema:
+ type: integer
+ title: cells_per_object
+ format: int32
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.tessellation.boundingBox.xmin
+ in: query
+ description: Minimum X coordinate
+ schema:
+ type: number
+ title: xmin
+ format: double
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.tessellation.boundingBox.ymin
+ in: query
+ description: Minimum Y coordinate
+ schema:
+ type: number
+ title: ymin
+ format: double
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.tessellation.boundingBox.xmax
+ in: query
+ description: Maximum X coordinate
+ schema:
+ type: number
+ title: xmax
+ format: double
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.tessellation.boundingBox.ymax
+ in: query
+ description: Maximum Y coordinate
+ schema:
+ type: number
+ title: ymax
+ format: double
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.fillfactor
+ in: query
+ description: Fill factor percentage (1-100)
+ schema:
+ type: integer
+ title: fillfactor
+ format: int32
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.buffering
+ in: query
+ description: Buffering mode for PostgreSQL (auto, on, off)
+ schema:
+ type: string
+ title: buffering
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.tablespace
+ in: query
+ description: Tablespace configuration for Oracle
+ schema:
+ type: string
+ title: tablespace
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.workTablespace
+ in: query
+ schema:
+ type: string
+ title: work_tablespace
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.sdoLevel
+ in: query
+ schema:
+ type: integer
+ title: sdo_level
+ format: int32
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.commitInterval
+ in: query
+ schema:
+ type: integer
+ title: commit_interval
+ format: int32
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.padIndex
+ in: query
+ description: SQL Server specific parameters
+ schema:
+ type: boolean
+ title: pad_index
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.sortInTempdb
+ in: query
+ description: ON, OFF
+ schema:
+ type: string
+ title: sort_in_tempdb
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.dropExisting
+ in: query
+ schema:
+ type: boolean
+ title: drop_existing
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.online
+ in: query
+ schema:
+ type: boolean
+ title: online
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.allowRowLocks
+ in: query
+ schema:
+ type: boolean
+ title: allow_row_locks
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.allowPageLocks
+ in: query
+ schema:
+ type: boolean
+ title: allow_page_locks
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.maxdop
+ in: query
+ schema:
+ type: integer
+ title: maxdop
+ format: int32
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.dataCompression
+ in: query
+ description: NONE, ROW, PAGE
+ schema:
+ type: string
+ title: data_compression
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.dimensional.dimensions
+ in: query
+ description: Number of dimensions (2-4, default 2)
+ schema:
+ type: integer
+ title: dimensions
+ format: int32
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.dimensional.dataType
+ in: query
+ description: Spatial data type (GEOMETRY, GEOGRAPHY, POINT, POLYGON, etc.)
+ schema:
+ type: string
+ title: data_type
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.dimensional.srid
+ in: query
+ description: Spatial reference system identifier (SRID)
+ schema:
+ type: integer
+ title: srid
+ format: int32
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.dimensional.constraints.dimension
+ in: query
+ description: Dimension name/type (X, Y, Z, M, etc.)
+ schema:
+ type: string
+ title: dimension
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.dimensional.constraints.minValue
+ in: query
+ description: Minimum value for this dimension
+ schema:
+ type: number
+ title: min_value
+ format: double
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.dimensional.constraints.maxValue
+ in: query
+ description: Maximum value for this dimension
+ schema:
+ type: number
+ title: max_value
+ format: double
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.dimensional.constraints.tolerance
+ in: query
+ description: Tolerance for this dimension
+ schema:
+ type: number
+ title: tolerance
+ format: double
+ - name: metadata.schemas.materializedViews.indexes.opclassNames
+ in: query
+ description: |-
+ https://www.postgresql.org/docs/current/catalog-pg-opclass.html
+ Name of the operator class for each column. (PostgreSQL specific).
+ schema:
+ type: array
+ items:
+ type: string
+ title: opclass_names
+ - name: metadata.schemas.materializedViews.indexes.opclassDefaults
+ in: query
+ description: True if the operator class is the default. (PostgreSQL specific).
+ schema:
+ type: array
+ items:
+ type: boolean
+ title: opclass_defaults
+ - name: metadata.schemas.materializedViews.skipDump
+ in: query
+ schema:
+ type: boolean
+ title: skip_dump
+ - name: metadata.schemas.packages.name
+ in: query
+ description: The name is the name of a package.
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.packages.definition
+ in: query
+ description: The definition is the definition of a package.
+ schema:
+ type: string
+ title: definition
+ - name: metadata.schemas.owner
+ in: query
+ description: The owner of the schema.
+ schema:
+ type: string
+ title: owner
+ - name: metadata.schemas.sequences.name
+ in: query
+ description: The name of a sequence.
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.sequences.dataType
+ in: query
+ description: The data type of a sequence.
+ schema:
+ type: string
+ title: data_type
+ - name: metadata.schemas.sequences.start
+ in: query
+ description: The start value of a sequence.
+ schema:
+ type: string
+ title: start
+ - name: metadata.schemas.sequences.minValue
+ in: query
+ description: The minimum value of a sequence.
+ schema:
+ type: string
+ title: min_value
+ - name: metadata.schemas.sequences.maxValue
+ in: query
+ description: The maximum value of a sequence.
+ schema:
+ type: string
+ title: max_value
+ - name: metadata.schemas.sequences.increment
+ in: query
+ description: Increment value of a sequence.
+ schema:
+ type: string
+ title: increment
+ - name: metadata.schemas.sequences.cycle
+ in: query
+ description: Cycle is whether the sequence cycles.
+ schema:
+ type: boolean
+ title: cycle
+ - name: metadata.schemas.sequences.cacheSize
+ in: query
+ description: Cache size of a sequence.
+ schema:
+ type: string
+ title: cache_size
+ - name: metadata.schemas.sequences.lastValue
+ in: query
+ description: Last value of a sequence.
+ schema:
+ type: string
+ title: last_value
+ - name: metadata.schemas.sequences.ownerTable
+ in: query
+ description: The owner table of the sequence.
+ schema:
+ type: string
+ title: owner_table
+ - name: metadata.schemas.sequences.ownerColumn
+ in: query
+ description: The owner column of the sequence.
+ schema:
+ type: string
+ title: owner_column
+ - name: metadata.schemas.sequences.comment
+ in: query
+ description: The comment describing the sequence.
+ schema:
+ type: string
+ title: comment
+ - name: metadata.schemas.sequences.skipDump
+ in: query
+ description: Whether to skip this sequence during schema dump operations.
+ schema:
+ type: boolean
+ title: skip_dump
+ - name: metadata.schemas.events.name
+ in: query
+ description: The name of the event.
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.events.definition
+ in: query
+ description: The schedule of the event.
+ schema:
+ type: string
+ title: definition
+ - name: metadata.schemas.events.timeZone
+ in: query
+ description: The time zone of the event.
+ schema:
+ type: string
+ title: time_zone
+ - name: metadata.schemas.events.sqlMode
+ in: query
+ description: The SQL mode setting for the event.
+ schema:
+ type: string
+ title: sql_mode
+ - name: metadata.schemas.events.characterSetClient
+ in: query
+ description: The character set used by the client creating the event.
+ schema:
+ type: string
+ title: character_set_client
+ - name: metadata.schemas.events.collationConnection
+ in: query
+ description: The collation used for the connection when creating the event.
+ schema:
+ type: string
+ title: collation_connection
+ - name: metadata.schemas.events.comment
+ in: query
+ description: The comment is the comment of an event.
+ schema:
+ type: string
+ title: comment
+ - name: metadata.schemas.enumTypes.name
+ in: query
+ description: The name of a type.
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.enumTypes.values
+ in: query
+ description: The enum values of a type.
+ schema:
+ type: array
+ items:
+ type: string
+ title: values
+ - name: metadata.schemas.enumTypes.comment
+ in: query
+ description: The comment describing the enum type.
+ schema:
+ type: string
+ title: comment
+ - name: metadata.schemas.enumTypes.skipDump
+ in: query
+ description: Whether to skip this enum type during schema dump operations.
+ schema:
+ type: boolean
+ title: skip_dump
+ - name: metadata.schemas.skipDump
+ in: query
+ description: Whether to skip this schema during schema dump operations.
+ schema:
+ type: boolean
+ title: skip_dump
+ - name: metadata.schemas.comment
+ in: query
+ description: The comment is the comment of a schema.
+ schema:
+ type: string
+ title: comment
+ - name: metadata.schemas.compositeTypes.name
+ in: query
+ description: The name of the composite type.
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.compositeTypes.attributes.name
+ in: query
+ description: The name of the attribute.
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.compositeTypes.attributes.type
+ in: query
+ description: The attribute type. User-defined types are always schema-qualified.
+ schema:
+ type: string
+ title: type
+ - name: metadata.schemas.compositeTypes.attributes.collation
+ in: query
+ description: |-
+ The non-default collation of the attribute as an emit-ready SQL
+ identifier reference (quoted as needed, schema-qualified when outside
+ pg_catalog), empty otherwise. e.g. `"C"` or `locale.en_us`.
+ schema:
+ type: string
+ title: collation
+ - name: metadata.schemas.compositeTypes.attributes.comment
+ in: query
+ description: The comment describing the attribute.
+ schema:
+ type: string
+ title: comment
+ - name: metadata.schemas.compositeTypes.comment
+ in: query
+ description: The comment describing the composite type.
+ schema:
+ type: string
+ title: comment
+ - name: metadata.characterSet
+ in: query
+ description: The character_set is the character set of a database.
+ schema:
+ type: string
+ title: character_set
+ - name: metadata.collation
+ in: query
+ description: The collation is the collation of a database.
+ schema:
+ type: string
+ title: collation
+ - name: metadata.extensions.name
+ in: query
+ description: The name is the name of an extension.
+ schema:
+ type: string
+ title: name
+ - name: metadata.extensions.schema
+ in: query
+ description: |-
+ The schema is the extension that is installed to. But the extension usage
+ is not limited to the schema.
+ schema:
+ type: string
+ title: schema
+ - name: metadata.extensions.version
+ in: query
+ description: The version is the version of an extension.
+ schema:
+ type: string
+ title: version
+ - name: metadata.extensions.description
+ in: query
+ description: The description is the description of an extension.
+ schema:
+ type: string
+ title: description
+ - name: metadata.owner
+ in: query
+ description: The owner of the database.
+ schema:
+ type: string
+ title: owner
+ - name: metadata.searchPath
+ in: query
+ description: The search_path is the search path of a PostgreSQL database.
+ schema:
+ type: string
+ title: search_path
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.GetSchemaStringResponse'
+ /v1/instances/{instance}/databases/{database}/sdlSchema:
+ get:
+ tags:
+ - DatabaseService
+ summary: GetDatabaseSDLSchema
+ description: |-
+ Retrieves database schema in SDL (Schema Definition Language) format.
+ Permissions required: bb.databases.getSchema
+ operationId: DatabaseService_GetDatabaseSDLSchema
+ parameters:
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ - name: database
+ in: path
+ description: The database id.
+ required: true
+ schema:
+ type: string
+ - name: format
+ in: query
+ description: The format of the SDL schema output.
+ schema:
+ title: format
+ $ref: '#/components/schemas/bytebase.v1.GetDatabaseSDLSchemaRequest.SDLFormat'
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.DatabaseSDLSchema'
+ /v1/instances/{instance}/databases/{database}:diffMetadata:
+ post:
+ tags:
+ - DatabaseService
+ summary: DiffMetadata
+ description: |-
+ Generates migration statements from the database's current schema to the
+ given target metadata.
+ Permissions required: bb.databases.diffMetadata
+ operationId: DatabaseService_DiffMetadata
+ parameters:
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ - name: database
+ in: path
+ description: The database id.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ targetMetadata:
+ title: target_metadata
+ description: |-
+ The metadata of the target schema. The source metadata and the engine are
+ read from the database, so only the target travels in the request.
+ Must describe the COMPLETE target schema: the diff runs against the full
+ stored source, so any object omitted from the target (for example by a
+ truncated metadata fetch) is treated as dropped.
+ $ref: '#/components/schemas/bytebase.v1.DatabaseMetadata'
+ title: DiffMetadataRequest
+ required:
+ - targetMetadata
+ additionalProperties: false
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.DiffMetadataResponse'
+ /v1/instances/{instance}/databases/{database}:diffSchema:
+ post:
+ tags:
+ - DatabaseService
+ summary: DiffSchema
+ description: |-
+ Compares and generates migration statements between two schemas.
+ Permissions required: bb.databases.get
+ operationId: DatabaseService_DiffSchema
+ parameters:
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ - name: database
+ in: path
+ description: The database id.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ allOf:
+ - {}
+ - oneOf:
+ - type: object
+ properties:
+ changelog:
+ type: string
+ title: changelog
+ description: |-
+ The resource name of the changelog
+ Format:
+ instances/{instance}/databases/{database}/changelogs/{changelog} or projects/{project}/instances/{instance}/databases/{database}/changelogs/{changelog}
+ title: changelog
+ required:
+ - changelog
+ - type: object
+ properties:
+ schema:
+ type: string
+ title: schema
+ description: The target schema.
+ title: schema
+ required:
+ - schema
+ - not:
+ anyOf:
+ - required:
+ - changelog
+ - required:
+ - schema
+ unevaluatedProperties: false
+ title: DiffSchemaRequest
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.DiffSchemaResponse'
+ /v1/instances/{instance}/databases/{database}:export:
+ post:
+ tags:
+ - SQLService
+ summary: Export
+ description: |-
+ Exports query results to a file format.
+ Permissions required: bb.databases.get
+ operationId: SQLService_Export
+ parameters:
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ - name: database
+ in: path
+ description: The database id.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ statement:
+ type: string
+ title: statement
+ description: The SQL statement to execute.
+ limit:
+ type: integer
+ title: limit
+ format: int32
+ description: The maximum number of rows to return.
+ format:
+ title: format
+ description: The export format.
+ $ref: '#/components/schemas/bytebase.v1.ExportFormat'
+ admin:
+ type: boolean
+ title: admin
+ description: |-
+ The admin is used for workspace owner and DBA for exporting data from SQL
+ Editor Admin mode. The exported data is not masked.
+ password:
+ type: string
+ title: password
+ description: The zip password provide by users.
+ dataSourceId:
+ type: string
+ title: data_source_id
+ description: |-
+ The id of data source.
+ If omitted, Export resolves the data source server-side by using the
+ single read-only data source when exactly one exists, or the admin data
+ source otherwise. It can also be set explicitly to export from the admin
+ data source or a specific read-only data source.
+ schema:
+ type:
+ - string
+ - "null"
+ title: schema
+ description: |-
+ The default schema to search objects. Equals to the current schema in
+ Oracle and search path in Postgres.
+ container:
+ type:
+ - string
+ - "null"
+ title: container
+ description: |-
+ Container is the container name to execute the query against, used for
+ CosmosDB only.
+ title: ExportRequest
+ additionalProperties: false
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.ExportResponse'
+ /v1/instances/{instance}/databases/{database}:query:
+ post:
+ tags:
+ - SQLService
+ summary: Query
+ description: |-
+ Executes a read-only SQL query against a database.
+ Permissions required: bb.databases.get
+ operationId: SQLService_Query
+ parameters:
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ - name: database
+ in: path
+ description: The database id.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ statement:
+ type: string
+ title: statement
+ description: The SQL statement to execute.
+ limit:
+ type: integer
+ title: limit
+ format: int32
+ description: The maximum number of rows to return.
+ dataSourceId:
+ type: string
+ title: data_source_id
+ description: |-
+ The id of data source.
+ If omitted, Query resolves the data source server-side by using the single
+ read-only data source when exactly one exists, or the admin data source
+ otherwise. It can also be set explicitly to query the admin data source or
+ a specific read-only data source.
+ explain:
+ type: boolean
+ title: explain
+ description: Explain the statement.
+ schema:
+ type:
+ - string
+ - "null"
+ title: schema
+ description: |-
+ The default schema to search objects. Equals to the current schema in
+ Oracle and search path in Postgres.
+ queryOption:
+ title: query_option
+ $ref: '#/components/schemas/bytebase.v1.QueryOption'
+ container:
+ type:
+ - string
+ - "null"
+ title: container
+ description: |-
+ Container is the container name to execute the query against, used for
+ CosmosDB only.
+ title: QueryRequest
+ additionalProperties: false
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.QueryResponse'
+ /v1/instances/{instance}/databases/{database}:sync:
+ post:
+ tags:
+ - DatabaseService
+ summary: SyncDatabase
+ description: |-
+ Synchronizes database schema from the instance.
+ Permissions required: bb.databases.sync
+ operationId: DatabaseService_SyncDatabase
+ parameters:
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ - name: database
+ in: path
+ description: The database id.
+ required: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.SyncDatabaseResponse'
+ /v1/instances/{instance}/databases:batchGet:
+ get:
+ tags:
+ - DatabaseService
+ summary: BatchGetDatabases
+ description: |-
+ Retrieves multiple databases by their names.
+ One resource per requested name, in request order. The first name that
+ does not resolve fails the whole call (AIP-231: no partial response).
+ Permissions required: bb.databases.get (on each named database's project)
+ operationId: DatabaseService_BatchGetDatabases2
+ parameters:
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ - name: names
+ in: query
+ description: The list of database names to retrieve.
+ required: true
+ schema:
+ type: array
+ items:
+ type: string
+ title: names
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.BatchGetDatabasesResponse'
+ /v1/instances/{instance}/databases:batchSync:
+ post:
+ tags:
+ - DatabaseService
+ summary: BatchSyncDatabases
+ description: |-
+ Synchronizes multiple databases in a single batch operation.
+ Permissions required: bb.databases.sync
+ operationId: DatabaseService_BatchSyncDatabases
+ parameters:
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ names:
+ type: array
+ items:
+ type: string
+ title: names
+ description: The list of database names to sync.
+ title: BatchSyncDatabasesRequest
+ required:
+ - names
+ additionalProperties: false
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.BatchSyncDatabasesResponse'
+ /v1/instances/{instance}/databases:batchUpdate:
+ post:
+ tags:
+ - DatabaseService
+ summary: BatchUpdateDatabases
+ description: |-
+ Updates multiple databases in a single batch operation.
+ Permissions required: bb.databases.update
+ operationId: DatabaseService_BatchUpdateDatabases
+ parameters:
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ requests:
+ type: array
+ items:
+ $ref: '#/components/schemas/bytebase.v1.UpdateDatabaseRequest'
+ title: requests
+ description: |-
+ The request message specifying the resources to update.
+ A maximum of 1000 databases can be modified in a batch.
+ title: BatchUpdateDatabasesRequest
+ required:
+ - requests
+ additionalProperties: false
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.BatchUpdateDatabasesResponse'
+ /v1/instances/{instance}/roles:
+ get:
+ tags:
+ - InstanceRoleService
+ summary: ListInstanceRoles
+ description: |-
+ Lists all database roles in an instance.
+ Permissions required: bb.instanceRoles.list
+ operationId: InstanceRoleService_ListInstanceRoles
+ parameters:
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ - name: pageSize
+ in: query
+ description: |-
+ Not used.
+ The maximum number of roles to return. The service may return fewer than
+ this value.
+ If unspecified, at most 10 roles will be returned.
+ The maximum value is 1000; values above 1000 will be coerced to 1000.
+ schema:
+ type: integer
+ title: page_size
+ format: int32
+ - name: pageToken
+ in: query
+ description: |-
+ Not used.
+ A page token, received from a previous `ListInstanceRoles` call.
+ Provide this to retrieve the subsequent page.
+
+ When paginating, all other parameters provided to `ListInstanceRoles` must match
+ the call that provided the page token.
+ schema:
+ type: string
+ title: page_token
+ - name: refresh
+ in: query
+ description: Refresh will refresh and return the latest data.
+ schema:
+ type: boolean
+ title: refresh
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.ListInstanceRolesResponse'
+ /v1/instances/{instance}:addDataSource:
+ post:
+ tags:
+ - InstanceService
+ summary: AddDataSource
+ description: |-
+ Adds a read-only data source to an instance.
+ Permissions required: bb.instances.update
+ operationId: InstanceService_AddDataSource
+ parameters:
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ dataSource:
+ title: data_source
+ description: |-
+ Identified by data source ID.
+ Only READ_ONLY data source can be added.
+ $ref: '#/components/schemas/bytebase.v1.DataSource'
+ validateOnly:
+ type: boolean
+ title: validate_only
+ description: Validate only also tests the data source connection.
+ title: AddDataSourceRequest
+ required:
+ - dataSource
+ additionalProperties: false
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.Instance'
+ /v1/instances/{instance}:databases:
+ post:
+ tags:
+ - InstanceService
+ summary: ListInstanceDatabase
+ description: |-
+ Lists all databases within an instance without creating them.
+ Permissions required: bb.instances.get
+ operationId: InstanceService_ListInstanceDatabase
+ parameters:
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ instance:
+ oneOf:
+ - $ref: '#/components/schemas/bytebase.v1.Instance'
+ - type: "null"
+ title: instance
+ description: The target instance. We need to set this field if the target instance is not created yet.
+ title: ListInstanceDatabaseRequest
+ required:
+ - instance
+ additionalProperties: false
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.ListInstanceDatabaseResponse'
+ /v1/instances/{instance}:removeDataSource:
+ post:
+ tags:
+ - InstanceService
+ summary: RemoveDataSource
+ description: |-
+ Removes a read-only data source from an instance.
+ Permissions required: bb.instances.update
+ operationId: InstanceService_RemoveDataSource
+ parameters:
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ dataSource:
+ title: data_source
+ description: |-
+ Identified by data source ID.
+ Only READ_ONLY data source can be removed.
+ $ref: '#/components/schemas/bytebase.v1.DataSource'
+ title: RemoveDataSourceRequest
+ required:
+ - dataSource
+ additionalProperties: false
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.Instance'
+ /v1/instances/{instance}:sync:
+ post:
+ tags:
+ - InstanceService
+ summary: SyncInstance
+ description: |-
+ Syncs database schemas and metadata from an instance.
+ Permissions required: bb.instances.sync
+ operationId: InstanceService_SyncInstance
+ parameters:
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ enableFullSync:
+ type: boolean
+ title: enable_full_sync
+ description: |-
+ When full sync is enabled, all databases in the instance will be synchronized. Otherwise, only
+ the instance metadata (such as the database list) and any newly discovered databases will be synced.
+ title: SyncInstanceRequest
+ additionalProperties: false
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.SyncInstanceResponse'
+ /v1/instances/{instance}:undelete:
+ post:
+ tags:
+ - InstanceService
+ summary: UndeleteInstance
+ description: |-
+ Restores a soft-deleted database instance.
+ Restore requests fail with FAILED_PRECONDITION while any task run targeting
+ the instance is pending, available, or running.
+ Permissions required: bb.instances.undelete
+ operationId: InstanceService_UndeleteInstance
+ parameters:
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.Instance'
+ /v1/instances/{instance}:updateDataSource:
+ patch:
+ tags:
+ - InstanceService
+ summary: UpdateDataSource
+ description: |-
+ Updates a data source configuration.
+ Permissions required: bb.instances.update
+ operationId: InstanceService_UpdateDataSource
+ parameters:
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ - name: updateMask
+ in: query
+ description: |-
+ `FieldMask` represents a set of symbolic field paths, for example:
+
+ paths: "f.a"
+ paths: "f.b.d"
+
+ Here `f` represents a field in some root message, `a` and `b`
+ fields in the message found in `f`, and `d` a field found in the
+ message in `f.b`.
+
+ Field masks are used to specify a subset of fields that should be
+ returned by a get operation or modified by an update operation.
+ Field masks also have a custom JSON encoding (see below).
+
+ # Field Masks in Projections
+
+ When used in the context of a projection, a response message or
+ sub-message is filtered by the API to only contain those fields as
+ specified in the mask. For example, if the mask in the previous
+ example is applied to a response message as follows:
+
+ f {
+ a : 22
+ b {
+ d : 1
+ x : 2
+ }
+ y : 13
+ }
+ z: 8
+
+ The result will not contain specific values for fields x,y and z
+ (their value will be set to the default, and omitted in proto text
+ output):
+
+
+ f {
+ a : 22
+ b {
+ d : 1
+ }
+ }
+
+ A repeated field is not allowed except at the last position of a
+ paths string.
+
+ If a FieldMask object is not present in a get operation, the
+ operation applies to all fields (as if a FieldMask of all fields
+ had been specified).
+
+ Note that a field mask does not necessarily apply to the
+ top-level response message. In case of a REST get operation, the
+ field mask applies directly to the response, but in case of a REST
+ list operation, the mask instead applies to each individual message
+ in the returned resource list. In case of a REST custom method,
+ other definitions may be used. Where the mask applies will be
+ clearly documented together with its declaration in the API. In
+ any case, the effect on the returned resource/resources is required
+ behavior for APIs.
+
+ # Field Masks in Update Operations
+
+ A field mask in update operations specifies which fields of the
+ targeted resource are going to be updated. The API is required
+ to only change the values of the fields as specified in the mask
+ and leave the others untouched. If a resource is passed in to
+ describe the updated values, the API ignores the values of all
+ fields not covered by the mask.
+
+ If a repeated field is specified for an update operation, new values will
+ be appended to the existing repeated field in the target resource. Note that
+ a repeated field is only allowed in the last position of a `paths` string.
+
+ If a sub-message is specified in the last position of the field mask for an
+ update operation, then new value will be merged into the existing sub-message
+ in the target resource.
+
+ For example, given the target message:
+
+ f {
+ b {
+ d: 1
+ x: 2
+ }
+ c: [1]
+ }
+
+ And an update message:
+
+ f {
+ b {
+ d: 10
+ }
+ c: [2]
+ }
+
+ then if the field mask is:
+
+ paths: ["f.b", "f.c"]
+
+ then the result will be:
+
+ f {
+ b {
+ d: 10
+ x: 2
+ }
+ c: [1, 2]
+ }
+
+ An implementation may provide options to override this default behavior for
+ repeated and message fields.
+
+ In order to reset a field's value to the default, the field must
+ be in the mask and set to the default value in the provided resource.
+ Hence, in order to reset all fields of a resource, provide a default
+ instance of the resource and set all fields in the mask, or do
+ not provide a mask as described below.
+
+ If a field mask is not present on update, the operation applies to
+ all fields (as if a field mask of all fields has been specified).
+ Note that in the presence of schema evolution, this may mean that
+ fields the client does not know and has therefore not filled into
+ the request will be reset to their default. If this is unwanted
+ behavior, a specific service may require a client to always specify
+ a field mask, producing an error if not.
+
+ As with get operations, the location of the resource which
+ describes the updated values in the request message depends on the
+ operation kind. In any case, the effect of the field mask is
+ required to be honored by the API.
+
+ ## Considerations for HTTP REST
+
+ The HTTP kind of an update operation which uses a field mask must
+ be set to PATCH instead of PUT in order to satisfy HTTP semantics
+ (PUT must only be used for full updates).
+
+ # JSON Encoding of Field Masks
+
+ In JSON, a field mask is encoded as a single string where paths are
+ separated by a comma. Fields name in each path are converted
+ to/from lower-camel naming conventions.
+
+ As an example, consider the following message declarations:
+
+ message Profile {
+ User user = 1;
+ Photo photo = 2;
+ }
+ message User {
+ string display_name = 1;
+ string address = 2;
+ }
+
+ In proto a field mask for `Profile` may look as such:
+
+ mask {
+ paths: "user.display_name"
+ paths: "photo"
+ }
+
+ In JSON, the same mask is represented as below:
+
+ {
+ mask: "user.displayName,photo"
+ }
+
+ # Field Masks and Oneof Fields
+
+ Field masks treat fields in oneofs just as regular fields. Consider the
+ following message:
+
+ message SampleMessage {
+ oneof test_oneof {
+ string name = 4;
+ SubMessage sub_message = 9;
+ }
+ }
+
+ The field mask can be:
+
+ mask {
+ paths: "name"
+ }
+
+ Or:
+
+ mask {
+ paths: "sub_message"
+ }
+
+ Note that oneof type names ("test_oneof" in this case) cannot be used in
+ paths.
+
+ ## Field Mask Verification
+
+ The implementation of any API method which has a FieldMask type field in the
+ request should verify the included field paths, and return an
+ `INVALID_ARGUMENT` error if any path is unmappable.
+ schema:
+ type: string
+ - name: validateOnly
+ in: query
+ description: Validate only also tests the data source connection.
+ schema:
+ type: boolean
+ title: validate_only
+ - name: allowMissing
+ in: query
+ description: |-
+ If set to true, and the data source is not found, a new data source will be created.
+ In this situation, `update_mask` is ignored.
+ schema:
+ type: boolean
+ title: allow_missing
+ requestBody:
+ description: Identified by data source ID.
+ content:
+ application/json:
+ schema:
+ title: data_source
+ description: Identified by data source ID.
+ $ref: '#/components/schemas/bytebase.v1.DataSource'
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.Instance'
+ /v1/instances:batchSync:
+ post:
+ tags:
+ - InstanceService
+ summary: BatchSyncInstances
+ description: |-
+ Syncs multiple instances in a single request.
+ Permissions required: bb.instances.sync
+ operationId: InstanceService_BatchSyncInstances
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.BatchSyncInstancesRequest'
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.BatchSyncInstancesResponse'
+ /v1/instances:batchUpdate:
+ post:
+ tags:
+ - InstanceService
+ summary: BatchUpdateInstances
+ description: |-
+ Updates multiple instances in a single request.
+ Permissions required: bb.instances.update
+ operationId: InstanceService_BatchUpdateInstances
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.BatchUpdateInstancesRequest'
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.BatchUpdateInstancesResponse'
+ /v1/projects:
+ get:
+ tags:
+ - ProjectService
+ summary: ListProjects
+ description: |-
+ Lists all projects in the workspace with optional filtering.
+ Permissions required: bb.projects.list
+ operationId: ProjectService_ListProjects
+ parameters:
+ - name: pageSize
+ in: query
+ description: |-
+ The maximum number of projects to return. The service may return fewer than
+ this value.
+ If unspecified, at most 10 projects will be returned.
+ The maximum value is 1000; values above 1000 will be coerced to 1000.
+ schema:
+ type: integer
+ title: page_size
+ format: int32
+ - name: pageToken
+ in: query
+ description: |-
+ A page token, received from a previous `ListProjects` call.
+ Provide this to retrieve the subsequent page.
+
+ When paginating, all other parameters provided to `ListProjects` must match
+ the call that provided the page token.
+ schema:
+ type: string
+ title: page_token
+ - name: showDeleted
+ in: query
+ description: Show deleted projects if specified.
+ schema:
+ type: boolean
+ title: show_deleted
+ - name: filter
+ in: query
+ description: |-
+ Filter the project.
+ Check filter for SearchProjectsRequest for details.
+ Supports filtering by name, resource_id, state, and labels (e.g., labels.environment == "production").
+ schema:
+ type: string
+ title: filter
+ - name: orderBy
+ in: query
+ description: |-
+ The order by of projects.
+ Support title. The default sorting order is ascending.
+ For example:
+ - order_by = "title"
+ - order_by = "title desc"
+ - order_by = "title asc"
+ schema:
+ type: string
+ title: order_by
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.ListProjectsResponse'
+ post:
+ tags:
+ - ProjectService
+ summary: CreateProject
+ description: |-
+ Creates a new project in the workspace.
+ Permissions required: bb.projects.create
+ operationId: ProjectService_CreateProject
+ parameters:
+ - name: projectId
+ in: query
+ description: |-
+ The ID to use for the project, which will become the final component of
+ the project's resource name.
+
+ This value should be 4-63 characters, and valid characters
+ are /[a-z][0-9]-/.
+ schema:
+ type: string
+ title: project_id
+ requestBody:
+ description: The project to create.
+ content:
+ application/json:
+ schema:
+ title: project
+ description: The project to create.
+ $ref: '#/components/schemas/bytebase.v1.Project'
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.Project'
+ /v1/projects/{project}:
+ get:
+ tags:
+ - ProjectService
+ summary: GetProject
+ description: |-
+ GetProject retrieves a project by name.
+ Users with "bb.projects.get" permission on the workspace or the project owner can access this method.
+ Permissions required: bb.projects.get
+ operationId: ProjectService_GetProject
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.Project'
+ delete:
+ tags:
+ - ProjectService
+ summary: DeleteProject
+ description: |-
+ Deletes (soft-delete or purge) a project.
+ Permissions required: bb.projects.delete
+ operationId: ProjectService_DeleteProject
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ - name: purge
+ in: query
+ description: |-
+ If set to true, permanently purge the soft-deleted project and all related resources.
+ This operation is irreversible. Following AIP-165, this should only be used for
+ administrative cleanup of old soft-deleted projects.
+ The project must already be soft-deleted for this to work.
+ When purge=true, all databases will be moved to the default project before deletion.
+ When purge=false (soft delete/archive), the project and its databases/issues remain unchanged.
+ schema:
+ type: boolean
+ title: purge
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/google.protobuf.Empty'
+ patch:
+ tags:
+ - ProjectService
+ summary: UpdateProject
+ description: |-
+ Updates an existing project's properties.
+ Permissions required: bb.projects.update
+ operationId: ProjectService_UpdateProject
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ - name: updateMask
+ in: query
+ description: |-
+ `FieldMask` represents a set of symbolic field paths, for example:
+
+ paths: "f.a"
+ paths: "f.b.d"
+
+ Here `f` represents a field in some root message, `a` and `b`
+ fields in the message found in `f`, and `d` a field found in the
+ message in `f.b`.
+
+ Field masks are used to specify a subset of fields that should be
+ returned by a get operation or modified by an update operation.
+ Field masks also have a custom JSON encoding (see below).
+
+ # Field Masks in Projections
+
+ When used in the context of a projection, a response message or
+ sub-message is filtered by the API to only contain those fields as
+ specified in the mask. For example, if the mask in the previous
+ example is applied to a response message as follows:
+
+ f {
+ a : 22
+ b {
+ d : 1
+ x : 2
+ }
+ y : 13
+ }
+ z: 8
+
+ The result will not contain specific values for fields x,y and z
+ (their value will be set to the default, and omitted in proto text
+ output):
+
+
+ f {
+ a : 22
+ b {
+ d : 1
+ }
+ }
+
+ A repeated field is not allowed except at the last position of a
+ paths string.
+
+ If a FieldMask object is not present in a get operation, the
+ operation applies to all fields (as if a FieldMask of all fields
+ had been specified).
+
+ Note that a field mask does not necessarily apply to the
+ top-level response message. In case of a REST get operation, the
+ field mask applies directly to the response, but in case of a REST
+ list operation, the mask instead applies to each individual message
+ in the returned resource list. In case of a REST custom method,
+ other definitions may be used. Where the mask applies will be
+ clearly documented together with its declaration in the API. In
+ any case, the effect on the returned resource/resources is required
+ behavior for APIs.
+
+ # Field Masks in Update Operations
+
+ A field mask in update operations specifies which fields of the
+ targeted resource are going to be updated. The API is required
+ to only change the values of the fields as specified in the mask
+ and leave the others untouched. If a resource is passed in to
+ describe the updated values, the API ignores the values of all
+ fields not covered by the mask.
+
+ If a repeated field is specified for an update operation, new values will
+ be appended to the existing repeated field in the target resource. Note that
+ a repeated field is only allowed in the last position of a `paths` string.
+
+ If a sub-message is specified in the last position of the field mask for an
+ update operation, then new value will be merged into the existing sub-message
+ in the target resource.
+
+ For example, given the target message:
+
+ f {
+ b {
+ d: 1
+ x: 2
+ }
+ c: [1]
+ }
+
+ And an update message:
+
+ f {
+ b {
+ d: 10
+ }
+ c: [2]
+ }
+
+ then if the field mask is:
+
+ paths: ["f.b", "f.c"]
+
+ then the result will be:
+
+ f {
+ b {
+ d: 10
+ x: 2
+ }
+ c: [1, 2]
+ }
+
+ An implementation may provide options to override this default behavior for
+ repeated and message fields.
+
+ In order to reset a field's value to the default, the field must
+ be in the mask and set to the default value in the provided resource.
+ Hence, in order to reset all fields of a resource, provide a default
+ instance of the resource and set all fields in the mask, or do
+ not provide a mask as described below.
+
+ If a field mask is not present on update, the operation applies to
+ all fields (as if a field mask of all fields has been specified).
+ Note that in the presence of schema evolution, this may mean that
+ fields the client does not know and has therefore not filled into
+ the request will be reset to their default. If this is unwanted
+ behavior, a specific service may require a client to always specify
+ a field mask, producing an error if not.
+
+ As with get operations, the location of the resource which
+ describes the updated values in the request message depends on the
+ operation kind. In any case, the effect of the field mask is
+ required to be honored by the API.
+
+ ## Considerations for HTTP REST
+
+ The HTTP kind of an update operation which uses a field mask must
+ be set to PATCH instead of PUT in order to satisfy HTTP semantics
+ (PUT must only be used for full updates).
+
+ # JSON Encoding of Field Masks
+
+ In JSON, a field mask is encoded as a single string where paths are
+ separated by a comma. Fields name in each path are converted
+ to/from lower-camel naming conventions.
+
+ As an example, consider the following message declarations:
+
+ message Profile {
+ User user = 1;
+ Photo photo = 2;
+ }
+ message User {
+ string display_name = 1;
+ string address = 2;
+ }
+
+ In proto a field mask for `Profile` may look as such:
+
+ mask {
+ paths: "user.display_name"
+ paths: "photo"
+ }
+
+ In JSON, the same mask is represented as below:
+
+ {
+ mask: "user.displayName,photo"
+ }
+
+ # Field Masks and Oneof Fields
+
+ Field masks treat fields in oneofs just as regular fields. Consider the
+ following message:
+
+ message SampleMessage {
+ oneof test_oneof {
+ string name = 4;
+ SubMessage sub_message = 9;
+ }
+ }
+
+ The field mask can be:
+
+ mask {
+ paths: "name"
+ }
+
+ Or:
+
+ mask {
+ paths: "sub_message"
+ }
+
+ Note that oneof type names ("test_oneof" in this case) cannot be used in
+ paths.
+
+ ## Field Mask Verification
+
+ The implementation of any API method which has a FieldMask type field in the
+ request should verify the included field paths, and return an
+ `INVALID_ARGUMENT` error if any path is unmappable.
+ schema:
+ type: string
+ - name: allowMissing
+ in: query
+ description: |-
+ If set to true, and the project is not found, a new project will be created.
+ In this situation, `update_mask` is ignored.
+ schema:
+ type: boolean
+ title: allow_missing
+ requestBody:
+ description: |-
+ The project to update.
+
+ The project's `name` field is used to identify the project to update.
+ Format: projects/{project}
+ content:
+ application/json:
+ schema:
+ title: project
+ description: |-
+ The project to update.
+
+ The project's `name` field is used to identify the project to update.
+ Format: projects/{project}
+ $ref: '#/components/schemas/bytebase.v1.Project'
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.Project'
+ /v1/projects/{project}/accessGrants:
+ get:
+ tags:
+ - AccessGrantService
+ summary: ListAccessGrants
+ description: Lists access grants in a project.
+ operationId: AccessGrantService_ListAccessGrants
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ - name: pageSize
+ in: query
+ description: The maximum number of access grants to return.
+ schema:
+ type: integer
+ title: page_size
+ format: int32
+ - name: pageToken
+ in: query
+ description: A page token from a previous ListAccessGrants call.
+ schema:
+ type: string
+ title: page_token
+ - name: filter
+ in: query
+ description: |-
+ Filter expression using AIP-160 syntax.
+ Supported fields:
+ - name: the fullname in "projects/{project}/accessGrants/{access_grant}" format, support "==" operator.
+ - creator: the creator name in "users/{email}" format, support "==" operator.
+ - status: the access status, support "==" and "in" operator.
+ - issue: the access issue fullname, support "==" operator.
+ - expire_time: the access expire time in "2006-01-02T15:04:05Z07:00" format, support ">=", ">", "<=" and "<" operator.
+ - create_time: the access creation time in "2006-01-02T15:04:05Z07:00" format, support ">=", ">", "<=" and "<" operator.
+ - query: the access query, support "==" and ".contains(xx)" operator
+ - target: the target database fullname, support "==" operator.
+ - unmask: whether the grant allows unmasking sensitive data, support "==" operator with a boolean literal.
+ - export: whether the grant allows exporting the query result, support "==" operator with a boolean literal.
+
+ Examples:
+ - creator == "users/[email protected]"
+ - status == "ACTIVE"
+ - status in ["ACTIVE", "PENDING"]
+ - creator == "users/[email protected]" && status == "ACTIVE"
+ - issue == "projects/x/issues/123"
+ - status == "ACTIVE" && expire_time > "2024-02-01T00:00:00Z"
+ - target == "instances/sample/databases/employee"
+ - unmask == true
+ - export == true && status == "ACTIVE"
+ schema:
+ type: string
+ title: filter
+ - name: orderBy
+ in: query
+ description: |-
+ The order by of access grants.
+ Support creator, expire_time, create_time. The default sorting order is ascending.
+ For example:
+ - order_by = "creator"
+ - order_by = "expire_time desc"
+ - order_by = "expire_time asc, create_time desc"
+ schema:
+ type: string
+ title: order_by
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.ListAccessGrantsResponse'
+ post:
+ tags:
+ - AccessGrantService
+ summary: CreateAccessGrant
+ description: Creates an access grant.
+ operationId: AccessGrantService_CreateAccessGrant
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ description: The access grant to create.
+ content:
+ application/json:
+ schema:
+ title: access_grant
+ description: The access grant to create.
+ $ref: '#/components/schemas/bytebase.v1.AccessGrant'
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.AccessGrant'
+ /v1/projects/{project}/accessGrants/{accessGrant}:
+ get:
+ tags:
+ - AccessGrantService
+ summary: GetAccessGrant
+ description: Gets an access grant by name.
+ operationId: AccessGrantService_GetAccessGrant
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ - name: accessGrant
+ in: path
+ description: The accessGrant id.
+ required: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.AccessGrant'
+ /v1/projects/{project}/accessGrants/{accessGrant}:activate:
+ post:
+ tags:
+ - AccessGrantService
+ summary: ActivateAccessGrant
+ description: Activates a pending access grant.
+ operationId: AccessGrantService_ActivateAccessGrant
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ - name: accessGrant
+ in: path
+ description: The accessGrant id.
+ required: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.AccessGrant'
+ /v1/projects/{project}/accessGrants/{accessGrant}:revoke:
+ post:
+ tags:
+ - AccessGrantService
+ summary: RevokeAccessGrant
+ description: Revokes an active access grant.
+ operationId: AccessGrantService_RevokeAccessGrant
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ - name: accessGrant
+ in: path
+ description: The accessGrant id.
+ required: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.AccessGrant'
+ /v1/projects/{project}/accessGrants:searchMy:
+ post:
+ tags:
+ - AccessGrantService
+ summary: SearchMyAccessGrants
+ description: Searches access grants created by the caller.
+ operationId: AccessGrantService_SearchMyAccessGrants
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pageSize:
+ type: integer
+ title: page_size
+ format: int32
+ description: The maximum number of access grants to return.
+ pageToken:
+ type: string
+ title: page_token
+ description: A page token from a previous SearchMyAccessGrants call.
+ filter:
+ type: string
+ title: filter
+ description: Check the filter field in the ListAccessGrantsRequest message.
+ orderBy:
+ type: string
+ title: order_by
+ description: Check the order_by field in the ListAccessGrantsRequest message.
+ title: SearchMyAccessGrantsRequest
+ additionalProperties: false
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.SearchMyAccessGrantsResponse'
+ /v1/projects/{project}/auditLogs:export:
+ post:
+ tags:
+ - AuditLogService
+ summary: ExportAuditLogs
+ description: |-
+ Exports audit logs in a specified format for external analysis.
+ Permissions required: bb.auditLogs.export
+ operationId: AuditLogService_ExportAuditLogs
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ filter:
+ type: string
+ title: filter
+ description: |-
+ The filter of the log. It should be a valid CEL expression.
+ Check the filter field in the SearchAuditLogsRequest message.
+ orderBy:
+ type: string
+ title: order_by
+ description: |-
+ The order by of the log.
+ Only support order by create_time. The default sorting order is ascending.
+ For example:
+ - order_by = "create_time asc"
+ - order_by = "create_time desc"
+ format:
+ title: format
+ description: The export format.
+ $ref: '#/components/schemas/bytebase.v1.ExportFormat'
+ pageSize:
+ type: integer
+ title: page_size
+ format: int32
+ description: |-
+ The maximum number of logs to return.
+ The service may return fewer than this value.
+ If unspecified, at most 10 log entries will be returned.
+ The maximum value is 5000; values above 5000 will be coerced to 5000.
+ pageToken:
+ type: string
+ title: page_token
+ description: |-
+ A page token, received from a previous `ExportAuditLogs` call.
+ Provide this to retrieve the subsequent page.
+ title: ExportAuditLogsRequest
additionalProperties: false
+ description: Request message for exporting audit logs.
required: true
responses:
"200":
@@ -5115,22 +7212,216 @@ paths:
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.SyncInstanceResponse'
- /v1/instances/{instance}:undelete:
+ $ref: '#/components/schemas/bytebase.v1.ExportAuditLogsResponse'
+ /v1/projects/{project}/auditLogs:search:
post:
tags:
- - InstanceService
- summary: UndeleteInstance
+ - AuditLogService
+ summary: SearchAuditLogs
description: |-
- Restores a soft-deleted database instance.
- Restore requests fail with FAILED_PRECONDITION while any task run targeting
- the instance is pending, available, or running.
- Permissions required: bb.instances.undelete
- operationId: InstanceService_UndeleteInstance
+ Searches audit logs with optional filtering and pagination.
+ Permissions required: bb.auditLogs.search
+ operationId: AuditLogService_SearchAuditLogs
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ filter:
+ type: string
+ title: filter
+ description: |-
+ The filter of the log. It should be a valid CEL expression.
+ The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
+
+ Supported filter:
+ - method: the API name, can be found in the docs. Usually "/bytebase.v1.…", for example "/bytebase.v1.UserService/CreateUser"; entries written outside the v1 API carry their own prefix, such as "/bytebase.mcp.Session/Authorize" or "/bytebase.cli.Recovery/ResetUserPassword". Support "==" operator.
+ - resource: the resource the entry is about, support "==" operator.
+ - severity: support "==" operator, check Severity enum in AuditLog message for values.
+ - user: the actor, should in "users/{email}" format, support "==" operator.
+ - create_time: support ">=" and "<=" operator.
+ - mcp: true selects the entries MCP produced, false the rest. A boolean, not a string. Support "==" operator.
+ - mcp_correlation_id: the MCP session an entry belongs to, taken from an entry's mcp_delegation.correlation_id. Support "==" operator. Entries MCP produced outside a session — a refused connection or consent — carry none and match no value here.
+
+ For example:
+ - filter = "method == '/bytebase.v1.SQLService/Query'"
+ - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR'"
+ - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR' && user == 'users/[email protected]'"
+ - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR' && create_time <= '2021-01-01T00:00:00Z' && create_time >= '2020-01-01T00:00:00Z'"
+ - filter = "mcp == true"
+ - filter = "mcp_correlation_id == '0b7f1a3c-1d2e-4f56-8a90-1b2c3d4e5f60'"
+ orderBy:
+ type: string
+ title: order_by
+ description: |-
+ The order by of the log.
+ Only support order by create_time. The default sorting order is ascending.
+ For example:
+ - order_by = "create_time asc"
+ - order_by = "create_time desc"
+ pageSize:
+ type: integer
+ title: page_size
+ format: int32
+ description: |-
+ The maximum number of logs to return.
+ The service may return fewer than this value.
+ If unspecified, at most 10 log entries will be returned.
+ The maximum value is 5000; values above 5000 will be coerced to 5000.
+ pageToken:
+ type: string
+ title: page_token
+ description: |-
+ A page token, received from a previous `SearchLogs` call.
+ Provide this to retrieve the subsequent page.
+ title: SearchAuditLogsRequest
+ additionalProperties: false
+ description: Request message for searching audit logs.
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.SearchAuditLogsResponse'
+ /v1/projects/{project}/databaseGroups:
+ get:
+ tags:
+ - DatabaseGroupService
+ summary: ListDatabaseGroups
+ description: |-
+ Lists database groups in a project.
+ Permissions required: bb.databaseGroups.list
+ operationId: DatabaseGroupService_ListDatabaseGroups
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ - name: view
+ in: query
+ description: The view to return. Defaults to DATABASE_GROUP_VIEW_BASIC.
+ schema:
+ title: view
+ $ref: '#/components/schemas/bytebase.v1.DatabaseGroupView'
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.ListDatabaseGroupsResponse'
+ post:
+ tags:
+ - DatabaseGroupService
+ summary: CreateDatabaseGroup
+ description: |-
+ Creates a new database group.
+ Permissions required: bb.databaseGroups.create
+ operationId: DatabaseGroupService_CreateDatabaseGroup
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ - name: databaseGroupId
+ in: query
+ description: |-
+ The ID to use for the database group, which will become the final component of
+ the database group's resource name.
+
+ This value should be 4-63 characters, and valid characters
+ are /[a-z][0-9]-/.
+ schema:
+ type: string
+ title: database_group_id
+ - name: validateOnly
+ in: query
+ description: If set, validate the create request and preview the full database group response, but do not actually create it.
+ schema:
+ type: boolean
+ title: validate_only
+ requestBody:
+ description: The database group to create.
+ content:
+ application/json:
+ schema:
+ title: database_group
+ description: The database group to create.
+ $ref: '#/components/schemas/bytebase.v1.DatabaseGroup'
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.DatabaseGroup'
+ /v1/projects/{project}/databaseGroups/{databaseGroup}:
+ get:
+ tags:
+ - DatabaseGroupService
+ summary: GetDatabaseGroup
+ description: |-
+ Gets a database group by name.
+ Permissions required: bb.databaseGroups.get
+ operationId: DatabaseGroupService_GetDatabaseGroup
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ - name: databaseGroup
+ in: path
+ description: The databaseGroup id.
+ required: true
+ schema:
+ type: string
+ - name: view
+ in: query
+ description: The view to return. Defaults to DATABASE_GROUP_VIEW_BASIC.
+ schema:
+ title: view
+ $ref: '#/components/schemas/bytebase.v1.DatabaseGroupView'
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.DatabaseGroup'
+ delete:
+ tags:
+ - DatabaseGroupService
+ summary: DeleteDatabaseGroup
+ description: |-
+ Deletes a database group.
+ Permissions required: bb.databaseGroups.delete
+ operationId: DatabaseGroupService_DeleteDatabaseGroup
parameters:
- - name: instance
+ - name: project
in: path
- description: The instance id.
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ - name: databaseGroup
+ in: path
+ description: The databaseGroup id.
required: true
schema:
type: string
@@ -5140,20 +7431,26 @@ paths:
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.Instance'
- /v1/instances/{instance}:updateDataSource:
+ $ref: '#/components/schemas/google.protobuf.Empty'
patch:
tags:
- - InstanceService
- summary: UpdateDataSource
+ - DatabaseGroupService
+ summary: UpdateDatabaseGroup
description: |-
- Updates a data source configuration.
- Permissions required: bb.instances.update
- operationId: InstanceService_UpdateDataSource
+ Updates a database group.
+ Permissions required: bb.databaseGroups.update
+ When allow_missing=true, also requires: bb.databaseGroups.create
+ operationId: DatabaseGroupService_UpdateDatabaseGroup
parameters:
- - name: instance
+ - name: project
in: path
- description: The instance id.
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ - name: databaseGroup
+ in: path
+ description: The databaseGroup id.
required: true
schema:
type: string
@@ -5361,95 +7658,194 @@ paths:
`INVALID_ARGUMENT` error if any path is unmappable.
schema:
type: string
- - name: validateOnly
- in: query
- description: Validate only also tests the data source connection.
- schema:
- type: boolean
- title: validate_only
- name: allowMissing
in: query
description: |-
- If set to true, and the data source is not found, a new data source will be created.
+ If set to true, and the database group is not found, a new database group will be created.
In this situation, `update_mask` is ignored.
schema:
type: boolean
title: allow_missing
requestBody:
- description: Identified by data source ID.
+ description: |-
+ The database group to update.
+
+ The database group's `name` field is used to identify the database group to update.
+ Format: projects/{project}/databaseGroups/{databaseGroup}
content:
application/json:
schema:
- title: data_source
- description: Identified by data source ID.
- $ref: '#/components/schemas/bytebase.v1.DataSource'
+ title: database_group
+ description: |-
+ The database group to update.
+
+ The database group's `name` field is used to identify the database group to update.
+ Format: projects/{project}/databaseGroups/{databaseGroup}
+ $ref: '#/components/schemas/bytebase.v1.DatabaseGroup'
responses:
"200":
description: Success
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.Instance'
- /v1/instances:batchSync:
- post:
+ $ref: '#/components/schemas/bytebase.v1.DatabaseGroup'
+ /v1/projects/{project}/databases:
+ get:
tags:
- - InstanceService
- summary: BatchSyncInstances
+ - DatabaseService
+ summary: ListDatabases
description: |-
- Syncs multiple instances in a single request.
- Permissions required: bb.instances.sync
- operationId: InstanceService_BatchSyncInstances
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.BatchSyncInstancesRequest'
- required: true
+ Lists databases in a project, instance, or workspace.
+ Permissions required: bb.projects.get (for project parent), bb.databases.list (for workspace parent), or bb.instances.get (for instance parent)
+ operationId: DatabaseService_ListDatabases
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ - name: pageSize
+ in: query
+ description: |-
+ The maximum number of databases to return. The service may return fewer
+ than this value.
+ If unspecified, at most 10 databases will be returned.
+ The maximum value is 1000; values above 1000 will be coerced to 1000.
+ schema:
+ type: integer
+ title: page_size
+ format: int32
+ - name: pageToken
+ in: query
+ description: |-
+ A page token, received from a previous `ListDatabases` call.
+ Provide this to retrieve the subsequent page.
+
+ When paginating, all other parameters provided to `ListDatabases` must
+ match the call that provided the page token.
+ schema:
+ type: string
+ title: page_token
+ - name: filter
+ in: query
+ description: |-
+ Filter is used to filter databases returned in the list.
+ The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
+
+ Supported filter:
+ - environment: the environment full name in "environments/{id}" format, support "==" operator.
+ - name: the database name, support ".contains()" operator.
+ - project: the project full name in "projects/{id}" format, support "==" operator.
+ - instance: the instance full name in "instances/{id}" or "projects/{project}/instances/{id}" format, support "==" operator.
+ - engine: the database engine, check Engine enum for values. Support "==", "in [xx]", "!(in [xx])" operator.
+ - exclude_unassigned: should be "true" or "false", will not show unassigned databases if it's true, support "==" operator.
+ - table: filter by the database table, support "==" and ".contains()" operator.
+ - labels.{key}: the database label, support "==" and "in" operators.
+
+ For example:
+ environment == "environments/{environment resource id}"
+ environment == "" (find databases which environment is not set)
+ project == "projects/{project resource id}"
+ instance == "instances/{instance resource id}"
+ instance == "projects/{project resource id}/instances/{instance resource id}"
+ name.contains("database name")
+ engine == "MYSQL"
+ engine in ["MYSQL", "POSTGRES"]
+ !(engine in ["MYSQL", "POSTGRES"])
+ exclude_unassigned == true
+ table == "sample"
+ table.contains("sam")
+ labels.environment == "production"
+ labels.region == "asia"
+ labels.region in ["asia", "europe"]
+
+ You can combine filter conditions like:
+ environment == "environments/prod" && name.contains("employee")
+ schema:
+ type: string
+ title: filter
+ - name: showDeleted
+ in: query
+ description: Show deleted database if specified.
+ schema:
+ type: boolean
+ title: show_deleted
+ - name: orderBy
+ in: query
+ description: |-
+ The order by of databases.
+ Support name, project, instance. The default sorting order is ascending.
+ For example:
+ - order_by = "name" - order by name ascending
+ - order_by = "name desc"
+ - order_by = "name desc, project asc"
+ schema:
+ type: string
+ title: order_by
responses:
"200":
description: Success
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.BatchSyncInstancesResponse'
- /v1/instances:batchUpdate:
- post:
+ $ref: '#/components/schemas/bytebase.v1.ListDatabasesResponse'
+ /v1/projects/{project}/databases:batchGet:
+ get:
tags:
- - InstanceService
- summary: BatchUpdateInstances
+ - DatabaseService
+ summary: BatchGetDatabases
description: |-
- Updates multiple instances in a single request.
- Permissions required: bb.instances.update
- operationId: InstanceService_BatchUpdateInstances
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.BatchUpdateInstancesRequest'
- required: true
+ Retrieves multiple databases by their names.
+ One resource per requested name, in request order. The first name that
+ does not resolve fails the whole call (AIP-231: no partial response).
+ Permissions required: bb.databases.get (on each named database's project)
+ operationId: DatabaseService_BatchGetDatabases
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ - name: names
+ in: query
+ description: The list of database names to retrieve.
+ required: true
+ schema:
+ type: array
+ items:
+ type: string
+ title: names
responses:
"200":
description: Success
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.BatchUpdateInstancesResponse'
- /v1/projects:
+ $ref: '#/components/schemas/bytebase.v1.BatchGetDatabasesResponse'
+ /v1/projects/{project}/instances:
get:
tags:
- - ProjectService
- summary: ListProjects
+ - InstanceService
+ summary: ListInstances
description: |-
- Lists all projects in the workspace with optional filtering.
- Permissions required: bb.projects.list
- operationId: ProjectService_ListProjects
+ Lists database instances, optionally within a project.
+ Permissions required: bb.instances.list
+ operationId: InstanceService_ListInstances2
parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
- name: pageSize
in: query
description: |-
- The maximum number of projects to return. The service may return fewer than
+ The maximum number of instances to return. The service may return fewer than
this value.
- If unspecified, at most 10 projects will be returned.
+ If unspecified, at most 10 instances will be returned.
The maximum value is 1000; values above 1000 will be coerced to 1000.
schema:
type: integer
@@ -5458,38 +7854,70 @@ paths:
- name: pageToken
in: query
description: |-
- A page token, received from a previous `ListProjects` call.
+ A page token, received from a previous `ListInstances` call.
Provide this to retrieve the subsequent page.
- When paginating, all other parameters provided to `ListProjects` must match
+ When paginating, all other parameters provided to `ListInstances` must match
the call that provided the page token.
schema:
type: string
title: page_token
- name: showDeleted
in: query
- description: Show deleted projects if specified.
+ description: Show deleted instances if specified.
schema:
type: boolean
title: show_deleted
- name: filter
in: query
description: |-
- Filter the project.
- Check filter for SearchProjectsRequest for details.
- Supports filtering by name, resource_id, state, and labels (e.g., labels.environment == "production").
+ Filter the instance.
+ The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
+
+ Supported filters:
+ - name: the instance name, support "==" and ".contains()" operator.
+ - resource_id: the instance id, support "==" and ".contains()" operator.
+ - environment: the environment full name in "environments/{id}" format, support "==" operator.
+ - state: the instance state, check State enum for values, support "==" operator.
+ - engine: the instance engine, check Engine enum for values. Support "==", "in [xx]", "!(in [xx])" operator.
+ - host: the instance host, support "==" and ".contains()" operator.
+ - port: the instance port, support "==" and ".contains()" operator.
+ - project: the project full name in "projects/{id}" format, support "==" operator.
+ - labels.{key}: the instance label, support "==" and "in" operators.
+
+ For example:
+ name == "sample instance"
+ name.contains("sample")
+ resource_id == "sample-instance"
+ resource_id.contains("sample")
+ state == "DELETED"
+ environment == "environments/test"
+ environment == "" (find instances which environment is not set)
+ engine == "MYSQL"
+ engine in ["MYSQL", "POSTGRES"]
+ !(engine in ["MYSQL", "POSTGRES"])
+ host == "127.0.0.1"
+ host.contains("127.0")
+ port == "54321"
+ port.contains("543")
+ labels.org_group == "infrastructure"
+ labels.environment in ["prod", "production"]
+ project == "projects/sample-project"
+ You can combine filter conditions like:
+ name.contains("sample") && environment == "environments/test"
+ host == "127.0.0.1" && port == "54321"
schema:
type: string
title: filter
- name: orderBy
in: query
description: |-
- The order by of projects.
- Support title. The default sorting order is ascending.
+ The order by of instances.
+ Support title, environment. The default sorting order is ascending.
For example:
- order_by = "title"
- order_by = "title desc"
- - order_by = "title asc"
+ - order_by = "title desc, environment asc"
schema:
type: string
title: order_by
@@ -5499,52 +7927,63 @@ paths:
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.ListProjectsResponse'
+ $ref: '#/components/schemas/bytebase.v1.ListInstancesResponse'
post:
tags:
- - ProjectService
- summary: CreateProject
+ - InstanceService
+ summary: CreateInstance
description: |-
- Creates a new project in the workspace.
- Permissions required: bb.projects.create
- operationId: ProjectService_CreateProject
+ Creates a new database instance.
+ Permissions required: bb.instances.create
+ operationId: InstanceService_CreateInstance2
parameters:
- - name: projectId
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ - name: instanceId
in: query
description: |-
- The ID to use for the project, which will become the final component of
- the project's resource name.
+ The ID to use for the instance, which will become the final component of
+ the instance's resource name.
This value should be 4-63 characters, and valid characters
are /[a-z][0-9]-/.
schema:
type: string
- title: project_id
+ title: instance_id
+ - name: validateOnly
+ in: query
+ description: Validate only also tests the data source connection.
+ schema:
+ type: boolean
+ title: validate_only
requestBody:
- description: The project to create.
+ description: The instance to create.
content:
application/json:
schema:
- title: project
- description: The project to create.
- $ref: '#/components/schemas/bytebase.v1.Project'
+ title: instance
+ description: The instance to create.
+ $ref: '#/components/schemas/bytebase.v1.Instance'
responses:
"200":
description: Success
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.Project'
- /v1/projects/{project}:
+ $ref: '#/components/schemas/bytebase.v1.Instance'
+ /v1/projects/{project}/instances/{instance}:
get:
tags:
- - ProjectService
- summary: GetProject
+ - InstanceService
+ summary: GetInstance
description: |-
- GetProject retrieves a project by name.
- Users with "bb.projects.get" permission on the workspace or the project owner can access this method.
- Permissions required: bb.projects.get
- operationId: ProjectService_GetProject
+ Gets a database instance by name.
+ Permissions required: bb.instances.get
+ operationId: InstanceService_GetInstance2
parameters:
- name: project
in: path
@@ -5552,21 +7991,29 @@ paths:
required: true
schema:
type: string
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
responses:
"200":
description: Success
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.Project'
+ $ref: '#/components/schemas/bytebase.v1.Instance'
delete:
tags:
- - ProjectService
- summary: DeleteProject
+ - InstanceService
+ summary: DeleteInstance
description: |-
- Deletes (soft-delete or purge) a project.
- Permissions required: bb.projects.delete
- operationId: ProjectService_DeleteProject
+ Deletes or soft-deletes a database instance.
+ Soft-delete requests fail with FAILED_PRECONDITION while any task run
+ targeting the instance is pending, available, or running.
+ Permissions required: bb.instances.delete
+ operationId: InstanceService_DeleteInstance2
parameters:
- name: project
in: path
@@ -5574,15 +8021,28 @@ paths:
required: true
schema:
type: string
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ - name: force
+ in: query
+ description: |-
+ If set to true, a workspace instance's databases are moved to the default
+ project before the instance is soft-deleted. Project instances reject this
+ option because their databases must remain in the owning project.
+ schema:
+ type: boolean
+ title: force
- name: purge
in: query
description: |-
- If set to true, permanently purge the soft-deleted project and all related resources.
+ If set to true, permanently purge the soft-deleted instance and all related resources.
This operation is irreversible. Following AIP-165, this should only be used for
- administrative cleanup of old soft-deleted projects.
- The project must already be soft-deleted for this to work.
- When purge=true, all databases will be moved to the default project before deletion.
- When purge=false (soft delete/archive), the project and its databases/issues remain unchanged.
+ administrative cleanup of old soft-deleted instances.
+ The instance must already be soft-deleted for this to work.
schema:
type: boolean
title: purge
@@ -5595,12 +8055,12 @@ paths:
$ref: '#/components/schemas/google.protobuf.Empty'
patch:
tags:
- - ProjectService
- summary: UpdateProject
+ - InstanceService
+ summary: UpdateInstance
description: |-
- Updates an existing project's properties.
- Permissions required: bb.projects.update
- operationId: ProjectService_UpdateProject
+ Updates a database instance.
+ Permissions required: bb.instances.update
+ operationId: InstanceService_UpdateInstance2
parameters:
- name: project
in: path
@@ -5608,6 +8068,12 @@ paths:
required: true
schema:
type: string
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
- name: updateMask
in: query
description: |-
@@ -5815,144 +8281,45 @@ paths:
- name: allowMissing
in: query
description: |-
- If set to true, and the project is not found, a new project will be created.
- In this situation, `update_mask` is ignored.
+ If set to true, and the instance is not found, a new instance will be created.
+ In this situation, `update_mask` is ignored. A project-nested name creates
+ the instance only under its encoded active, non-default project; it never
+ falls back to a workspace instance.
schema:
type: boolean
title: allow_missing
requestBody:
description: |-
- The project to update.
-
- The project's `name` field is used to identify the project to update.
- Format: projects/{project}
- content:
- application/json:
- schema:
- title: project
- description: |-
- The project to update.
-
- The project's `name` field is used to identify the project to update.
- Format: projects/{project}
- $ref: '#/components/schemas/bytebase.v1.Project'
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.Project'
- /v1/projects/{project}/accessGrants:
- get:
- tags:
- - AccessGrantService
- summary: ListAccessGrants
- description: Lists access grants in a project.
- operationId: AccessGrantService_ListAccessGrants
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
- schema:
- type: string
- - name: pageSize
- in: query
- description: The maximum number of access grants to return.
- schema:
- type: integer
- title: page_size
- format: int32
- - name: pageToken
- in: query
- description: A page token from a previous ListAccessGrants call.
- schema:
- type: string
- title: page_token
- - name: filter
- in: query
- description: |-
- Filter expression using AIP-160 syntax.
- Supported fields:
- - name: the fullname in "projects/{project}/accessGrants/{access_grant}" format, support "==" operator.
- - creator: the creator name in "users/{email}" format, support "==" operator.
- - status: the access status, support "==" and "in" operator.
- - issue: the access issue fullname, support "==" operator.
- - expire_time: the access expire time in "2006-01-02T15:04:05Z07:00" format, support ">=", ">", "<=" and "<" operator.
- - create_time: the access creation time in "2006-01-02T15:04:05Z07:00" format, support ">=", ">", "<=" and "<" operator.
- - query: the access query, support "==" and ".contains(xx)" operator
- - target: the target database fullname, support "==" operator.
- - unmask: whether the grant allows unmasking sensitive data, support "==" operator with a boolean literal.
- - export: whether the grant allows exporting the query result, support "==" operator with a boolean literal.
+ The instance to update.
- Examples:
- - creator == "users/[email protected]"
- - status == "ACTIVE"
- - status in ["ACTIVE", "PENDING"]
- - creator == "users/[email protected]" && status == "ACTIVE"
- - issue == "projects/x/issues/123"
- - status == "ACTIVE" && expire_time > "2024-02-01T00:00:00Z"
- - target == "instances/sample/databases/employee"
- - unmask == true
- - export == true && status == "ACTIVE"
- schema:
- type: string
- title: filter
- - name: orderBy
- in: query
- description: |-
- The order by of access grants.
- Support creator, expire_time, create_time. The default sorting order is ascending.
- For example:
- - order_by = "creator"
- - order_by = "expire_time desc"
- - order_by = "expire_time asc, create_time desc"
- schema:
- type: string
- title: order_by
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.ListAccessGrantsResponse'
- post:
- tags:
- - AccessGrantService
- summary: CreateAccessGrant
- description: Creates an access grant.
- operationId: AccessGrantService_CreateAccessGrant
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
- schema:
- type: string
- requestBody:
- description: The access grant to create.
+ The instance's `name` field is used to identify the instance to update.
+ Format: instances/{instance} or projects/{project}/instances/{instance}
content:
application/json:
schema:
- title: access_grant
- description: The access grant to create.
- $ref: '#/components/schemas/bytebase.v1.AccessGrant'
+ title: instance
+ description: |-
+ The instance to update.
+
+ The instance's `name` field is used to identify the instance to update.
+ Format: instances/{instance} or projects/{project}/instances/{instance}
+ $ref: '#/components/schemas/bytebase.v1.Instance'
responses:
"200":
description: Success
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.AccessGrant'
- /v1/projects/{project}/accessGrants/{accessGrant}:
+ $ref: '#/components/schemas/bytebase.v1.Instance'
+ /v1/projects/{project}/instances/{instance}/databases:
get:
tags:
- - AccessGrantService
- summary: GetAccessGrant
- description: Gets an access grant by name.
- operationId: AccessGrantService_GetAccessGrant
+ - DatabaseService
+ summary: ListDatabases
+ description: |-
+ Lists databases in a project, instance, or workspace.
+ Permissions required: bb.projects.get (for project parent), bb.databases.list (for workspace parent), or bb.instances.get (for instance parent)
+ operationId: DatabaseService_ListDatabases4
parameters:
- name: project
in: path
@@ -5960,80 +8327,106 @@ paths:
required: true
schema:
type: string
- - name: accessGrant
+ - name: instance
in: path
- description: The accessGrant id.
+ description: The instance id.
required: true
schema:
type: string
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.AccessGrant'
- /v1/projects/{project}/accessGrants/{accessGrant}:activate:
- post:
- tags:
- - AccessGrantService
- summary: ActivateAccessGrant
- description: Activates a pending access grant.
- operationId: AccessGrantService_ActivateAccessGrant
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
+ - name: pageSize
+ in: query
+ description: |-
+ The maximum number of databases to return. The service may return fewer
+ than this value.
+ If unspecified, at most 10 databases will be returned.
+ The maximum value is 1000; values above 1000 will be coerced to 1000.
schema:
- type: string
- - name: accessGrant
- in: path
- description: The accessGrant id.
- required: true
+ type: integer
+ title: page_size
+ format: int32
+ - name: pageToken
+ in: query
+ description: |-
+ A page token, received from a previous `ListDatabases` call.
+ Provide this to retrieve the subsequent page.
+
+ When paginating, all other parameters provided to `ListDatabases` must
+ match the call that provided the page token.
schema:
type: string
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.AccessGrant'
- /v1/projects/{project}/accessGrants/{accessGrant}:revoke:
- post:
- tags:
- - AccessGrantService
- summary: RevokeAccessGrant
- description: Revokes an active access grant.
- operationId: AccessGrantService_RevokeAccessGrant
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
+ title: page_token
+ - name: filter
+ in: query
+ description: |-
+ Filter is used to filter databases returned in the list.
+ The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
+
+ Supported filter:
+ - environment: the environment full name in "environments/{id}" format, support "==" operator.
+ - name: the database name, support ".contains()" operator.
+ - project: the project full name in "projects/{id}" format, support "==" operator.
+ - instance: the instance full name in "instances/{id}" or "projects/{project}/instances/{id}" format, support "==" operator.
+ - engine: the database engine, check Engine enum for values. Support "==", "in [xx]", "!(in [xx])" operator.
+ - exclude_unassigned: should be "true" or "false", will not show unassigned databases if it's true, support "==" operator.
+ - table: filter by the database table, support "==" and ".contains()" operator.
+ - labels.{key}: the database label, support "==" and "in" operators.
+
+ For example:
+ environment == "environments/{environment resource id}"
+ environment == "" (find databases which environment is not set)
+ project == "projects/{project resource id}"
+ instance == "instances/{instance resource id}"
+ instance == "projects/{project resource id}/instances/{instance resource id}"
+ name.contains("database name")
+ engine == "MYSQL"
+ engine in ["MYSQL", "POSTGRES"]
+ !(engine in ["MYSQL", "POSTGRES"])
+ exclude_unassigned == true
+ table == "sample"
+ table.contains("sam")
+ labels.environment == "production"
+ labels.region == "asia"
+ labels.region in ["asia", "europe"]
+
+ You can combine filter conditions like:
+ environment == "environments/prod" && name.contains("employee")
schema:
type: string
- - name: accessGrant
- in: path
- description: The accessGrant id.
- required: true
+ title: filter
+ - name: showDeleted
+ in: query
+ description: Show deleted database if specified.
+ schema:
+ type: boolean
+ title: show_deleted
+ - name: orderBy
+ in: query
+ description: |-
+ The order by of databases.
+ Support name, project, instance. The default sorting order is ascending.
+ For example:
+ - order_by = "name" - order by name ascending
+ - order_by = "name desc"
+ - order_by = "name desc, project asc"
schema:
type: string
+ title: order_by
responses:
"200":
description: Success
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.AccessGrant'
- /v1/projects/{project}/accessGrants:searchMy:
- post:
+ $ref: '#/components/schemas/bytebase.v1.ListDatabasesResponse'
+ /v1/projects/{project}/instances/{instance}/databases/{database}:
+ get:
tags:
- - AccessGrantService
- summary: SearchMyAccessGrants
- description: Searches access grants created by the caller.
- operationId: AccessGrantService_SearchMyAccessGrants
+ - DatabaseService
+ summary: GetDatabase
+ description: |-
+ Retrieves a database by name.
+ Permissions required: bb.databases.get
+ operationId: DatabaseService_GetDatabase2
parameters:
- name: project
in: path
@@ -6041,115 +8434,33 @@ paths:
required: true
schema:
type: string
- requestBody:
- content:
- application/json:
- schema:
- type: object
- properties:
- pageSize:
- type: integer
- title: page_size
- format: int32
- description: The maximum number of access grants to return.
- pageToken:
- type: string
- title: page_token
- description: A page token from a previous SearchMyAccessGrants call.
- filter:
- type: string
- title: filter
- description: Check the filter field in the ListAccessGrantsRequest message.
- orderBy:
- type: string
- title: order_by
- description: Check the order_by field in the ListAccessGrantsRequest message.
- title: SearchMyAccessGrantsRequest
- additionalProperties: false
- required: true
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.SearchMyAccessGrantsResponse'
- /v1/projects/{project}/auditLogs:export:
- post:
- tags:
- - AuditLogService
- summary: ExportAuditLogs
- description: |-
- Exports audit logs in a specified format for external analysis.
- Permissions required: bb.auditLogs.export
- operationId: AuditLogService_ExportAuditLogs
- parameters:
- - name: project
+ - name: instance
in: path
- description: The project id.
+ description: The instance id.
required: true
schema:
- type: string
- requestBody:
- content:
- application/json:
- schema:
- type: object
- properties:
- filter:
- type: string
- title: filter
- description: |-
- The filter of the log. It should be a valid CEL expression.
- Check the filter field in the SearchAuditLogsRequest message.
- orderBy:
- type: string
- title: order_by
- description: |-
- The order by of the log.
- Only support order by create_time. The default sorting order is ascending.
- For example:
- - order_by = "create_time asc"
- - order_by = "create_time desc"
- format:
- title: format
- description: The export format.
- $ref: '#/components/schemas/bytebase.v1.ExportFormat'
- pageSize:
- type: integer
- title: page_size
- format: int32
- description: |-
- The maximum number of logs to return.
- The service may return fewer than this value.
- If unspecified, at most 10 log entries will be returned.
- The maximum value is 5000; values above 5000 will be coerced to 5000.
- pageToken:
- type: string
- title: page_token
- description: |-
- A page token, received from a previous `ExportAuditLogs` call.
- Provide this to retrieve the subsequent page.
- title: ExportAuditLogsRequest
- additionalProperties: false
- description: Request message for exporting audit logs.
- required: true
+ type: string
+ - name: database
+ in: path
+ description: The database id.
+ required: true
+ schema:
+ type: string
responses:
"200":
description: Success
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.ExportAuditLogsResponse'
- /v1/projects/{project}/auditLogs:search:
- post:
+ $ref: '#/components/schemas/bytebase.v1.Database'
+ patch:
tags:
- - AuditLogService
- summary: SearchAuditLogs
+ - DatabaseService
+ summary: UpdateDatabase
description: |-
- Searches audit logs with optional filtering and pagination.
- Permissions required: bb.auditLogs.search
- operationId: AuditLogService_SearchAuditLogs
+ Updates database properties such as labels and project assignment.
+ Permissions required: bb.databases.update
+ operationId: DatabaseService_UpdateDatabase2
parameters:
- name: project
in: path
@@ -6157,79 +8468,254 @@ paths:
required: true
schema:
type: string
- requestBody:
- content:
- application/json:
- schema:
- type: object
- properties:
- filter:
- type: string
- title: filter
- description: |-
- The filter of the log. It should be a valid CEL expression.
- The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ - name: database
+ in: path
+ description: The database id.
+ required: true
+ schema:
+ type: string
+ - name: updateMask
+ in: query
+ description: |-
+ `FieldMask` represents a set of symbolic field paths, for example:
- Supported filter:
- - method: the API name, can be found in the docs. Usually "/bytebase.v1.…", for example "/bytebase.v1.UserService/CreateUser"; entries written outside the v1 API carry their own prefix, such as "/bytebase.mcp.Session/Authorize" or "/bytebase.cli.Recovery/ResetUserPassword". Support "==" operator.
- - resource: the resource the entry is about, support "==" operator.
- - severity: support "==" operator, check Severity enum in AuditLog message for values.
- - user: the actor, should in "users/{email}" format, support "==" operator.
- - create_time: support ">=" and "<=" operator.
- - mcp: true selects the entries MCP produced, false the rest. A boolean, not a string. Support "==" operator.
- - mcp_correlation_id: the MCP session an entry belongs to, taken from an entry's mcp_delegation.correlation_id. Support "==" operator. Entries MCP produced outside a session — a refused connection or consent — carry none and match no value here.
+ paths: "f.a"
+ paths: "f.b.d"
+
+ Here `f` represents a field in some root message, `a` and `b`
+ fields in the message found in `f`, and `d` a field found in the
+ message in `f.b`.
+
+ Field masks are used to specify a subset of fields that should be
+ returned by a get operation or modified by an update operation.
+ Field masks also have a custom JSON encoding (see below).
+
+ # Field Masks in Projections
+
+ When used in the context of a projection, a response message or
+ sub-message is filtered by the API to only contain those fields as
+ specified in the mask. For example, if the mask in the previous
+ example is applied to a response message as follows:
+
+ f {
+ a : 22
+ b {
+ d : 1
+ x : 2
+ }
+ y : 13
+ }
+ z: 8
+
+ The result will not contain specific values for fields x,y and z
+ (their value will be set to the default, and omitted in proto text
+ output):
+
+
+ f {
+ a : 22
+ b {
+ d : 1
+ }
+ }
+
+ A repeated field is not allowed except at the last position of a
+ paths string.
+
+ If a FieldMask object is not present in a get operation, the
+ operation applies to all fields (as if a FieldMask of all fields
+ had been specified).
+
+ Note that a field mask does not necessarily apply to the
+ top-level response message. In case of a REST get operation, the
+ field mask applies directly to the response, but in case of a REST
+ list operation, the mask instead applies to each individual message
+ in the returned resource list. In case of a REST custom method,
+ other definitions may be used. Where the mask applies will be
+ clearly documented together with its declaration in the API. In
+ any case, the effect on the returned resource/resources is required
+ behavior for APIs.
+
+ # Field Masks in Update Operations
+
+ A field mask in update operations specifies which fields of the
+ targeted resource are going to be updated. The API is required
+ to only change the values of the fields as specified in the mask
+ and leave the others untouched. If a resource is passed in to
+ describe the updated values, the API ignores the values of all
+ fields not covered by the mask.
+
+ If a repeated field is specified for an update operation, new values will
+ be appended to the existing repeated field in the target resource. Note that
+ a repeated field is only allowed in the last position of a `paths` string.
+
+ If a sub-message is specified in the last position of the field mask for an
+ update operation, then new value will be merged into the existing sub-message
+ in the target resource.
+
+ For example, given the target message:
+
+ f {
+ b {
+ d: 1
+ x: 2
+ }
+ c: [1]
+ }
+
+ And an update message:
+
+ f {
+ b {
+ d: 10
+ }
+ c: [2]
+ }
+
+ then if the field mask is:
+
+ paths: ["f.b", "f.c"]
+
+ then the result will be:
+
+ f {
+ b {
+ d: 10
+ x: 2
+ }
+ c: [1, 2]
+ }
+
+ An implementation may provide options to override this default behavior for
+ repeated and message fields.
+
+ In order to reset a field's value to the default, the field must
+ be in the mask and set to the default value in the provided resource.
+ Hence, in order to reset all fields of a resource, provide a default
+ instance of the resource and set all fields in the mask, or do
+ not provide a mask as described below.
+
+ If a field mask is not present on update, the operation applies to
+ all fields (as if a field mask of all fields has been specified).
+ Note that in the presence of schema evolution, this may mean that
+ fields the client does not know and has therefore not filled into
+ the request will be reset to their default. If this is unwanted
+ behavior, a specific service may require a client to always specify
+ a field mask, producing an error if not.
+
+ As with get operations, the location of the resource which
+ describes the updated values in the request message depends on the
+ operation kind. In any case, the effect of the field mask is
+ required to be honored by the API.
+
+ ## Considerations for HTTP REST
+
+ The HTTP kind of an update operation which uses a field mask must
+ be set to PATCH instead of PUT in order to satisfy HTTP semantics
+ (PUT must only be used for full updates).
+
+ # JSON Encoding of Field Masks
+
+ In JSON, a field mask is encoded as a single string where paths are
+ separated by a comma. Fields name in each path are converted
+ to/from lower-camel naming conventions.
+
+ As an example, consider the following message declarations:
+
+ message Profile {
+ User user = 1;
+ Photo photo = 2;
+ }
+ message User {
+ string display_name = 1;
+ string address = 2;
+ }
+
+ In proto a field mask for `Profile` may look as such:
+
+ mask {
+ paths: "user.display_name"
+ paths: "photo"
+ }
+
+ In JSON, the same mask is represented as below:
+
+ {
+ mask: "user.displayName,photo"
+ }
+
+ # Field Masks and Oneof Fields
+
+ Field masks treat fields in oneofs just as regular fields. Consider the
+ following message:
+
+ message SampleMessage {
+ oneof test_oneof {
+ string name = 4;
+ SubMessage sub_message = 9;
+ }
+ }
+
+ The field mask can be:
+
+ mask {
+ paths: "name"
+ }
+
+ Or:
+
+ mask {
+ paths: "sub_message"
+ }
+
+ Note that oneof type names ("test_oneof" in this case) cannot be used in
+ paths.
+
+ ## Field Mask Verification
+
+ The implementation of any API method which has a FieldMask type field in the
+ request should verify the included field paths, and return an
+ `INVALID_ARGUMENT` error if any path is unmappable.
+ schema:
+ type: string
+ requestBody:
+ description: |-
+ The database to update.
- For example:
- - filter = "method == '/bytebase.v1.SQLService/Query'"
- - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR'"
- - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR' && user == 'users/[email protected]'"
- - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR' && create_time <= '2021-01-01T00:00:00Z' && create_time >= '2020-01-01T00:00:00Z'"
- - filter = "mcp == true"
- - filter = "mcp_correlation_id == '0b7f1a3c-1d2e-4f56-8a90-1b2c3d4e5f60'"
- orderBy:
- type: string
- title: order_by
- description: |-
- The order by of the log.
- Only support order by create_time. The default sorting order is ascending.
- For example:
- - order_by = "create_time asc"
- - order_by = "create_time desc"
- pageSize:
- type: integer
- title: page_size
- format: int32
- description: |-
- The maximum number of logs to return.
- The service may return fewer than this value.
- If unspecified, at most 10 log entries will be returned.
- The maximum value is 5000; values above 5000 will be coerced to 5000.
- pageToken:
- type: string
- title: page_token
- description: |-
- A page token, received from a previous `SearchLogs` call.
- Provide this to retrieve the subsequent page.
- title: SearchAuditLogsRequest
- additionalProperties: false
- description: Request message for searching audit logs.
- required: true
+ The database's `name` field is used to identify the database to update.
+ Format: instances/{instance}/databases/{database} or projects/{project}/instances/{instance}/databases/{database}
+ content:
+ application/json:
+ schema:
+ title: database
+ description: |-
+ The database to update.
+
+ The database's `name` field is used to identify the database to update.
+ Format: instances/{instance}/databases/{database} or projects/{project}/instances/{instance}/databases/{database}
+ $ref: '#/components/schemas/bytebase.v1.Database'
responses:
"200":
description: Success
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.SearchAuditLogsResponse'
- /v1/projects/{project}/databaseGroups:
+ $ref: '#/components/schemas/bytebase.v1.Database'
+ /v1/projects/{project}/instances/{instance}/databases/{database}/catalog:
get:
tags:
- - DatabaseGroupService
- summary: ListDatabaseGroups
+ - DatabaseCatalogService
+ summary: GetDatabaseCatalog
description: |-
- Lists database groups in a project.
- Permissions required: bb.databaseGroups.list
- operationId: DatabaseGroupService_ListDatabaseGroups
+ Gets the catalog metadata for a database.
+ Permissions required: bb.databaseCatalogs.get
+ operationId: DatabaseCatalogService_GetDatabaseCatalog2
parameters:
- name: project
in: path
@@ -6237,27 +8723,33 @@ paths:
required: true
schema:
type: string
- - name: view
- in: query
- description: The view to return. Defaults to DATABASE_GROUP_VIEW_BASIC.
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
schema:
- title: view
- $ref: '#/components/schemas/bytebase.v1.DatabaseGroupView'
+ type: string
+ - name: database
+ in: path
+ description: The database id.
+ required: true
+ schema:
+ type: string
responses:
"200":
description: Success
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.ListDatabaseGroupsResponse'
- post:
+ $ref: '#/components/schemas/bytebase.v1.DatabaseCatalog'
+ patch:
tags:
- - DatabaseGroupService
- summary: CreateDatabaseGroup
+ - DatabaseCatalogService
+ summary: UpdateDatabaseCatalog
description: |-
- Creates a new database group.
- Permissions required: bb.databaseGroups.create
- operationId: DatabaseGroupService_CreateDatabaseGroup
+ Updates catalog metadata such as classifications and labels.
+ Permissions required: bb.databaseCatalogs.update
+ operationId: DatabaseCatalogService_UpdateDatabaseCatalog2
parameters:
- name: project
in: path
@@ -6265,47 +8757,54 @@ paths:
required: true
schema:
type: string
- - name: databaseGroupId
- in: query
- description: |-
- The ID to use for the database group, which will become the final component of
- the database group's resource name.
-
- This value should be 4-63 characters, and valid characters
- are /[a-z][0-9]-/.
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
schema:
type: string
- title: database_group_id
- - name: validateOnly
- in: query
- description: If set, validate the create request and preview the full database group response, but do not actually create it.
+ - name: database
+ in: path
+ description: The database id.
+ required: true
schema:
- type: boolean
- title: validate_only
+ type: string
requestBody:
- description: The database group to create.
+ description: |-
+ The database catalog to update, identified by its `name` field.
+ Format: instances/{instance}/databases/{database}/catalog or projects/{project}/instances/{instance}/databases/{database}/catalog
+
+ Replaces the whole catalog: send the complete value, since anything omitted
+ is erased. There is no `update_mask` because `schemas` is a repeated field,
+ and AIP-161 forbids addressing one element of one.
content:
application/json:
schema:
- title: database_group
- description: The database group to create.
- $ref: '#/components/schemas/bytebase.v1.DatabaseGroup'
+ title: catalog
+ description: |-
+ The database catalog to update, identified by its `name` field.
+ Format: instances/{instance}/databases/{database}/catalog or projects/{project}/instances/{instance}/databases/{database}/catalog
+
+ Replaces the whole catalog: send the complete value, since anything omitted
+ is erased. There is no `update_mask` because `schemas` is a repeated field,
+ and AIP-161 forbids addressing one element of one.
+ $ref: '#/components/schemas/bytebase.v1.DatabaseCatalog'
responses:
"200":
description: Success
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.DatabaseGroup'
- /v1/projects/{project}/databaseGroups/{databaseGroup}:
+ $ref: '#/components/schemas/bytebase.v1.DatabaseCatalog'
+ /v1/projects/{project}/instances/{instance}/databases/{database}/changelogs:
get:
tags:
- - DatabaseGroupService
- summary: GetDatabaseGroup
+ - ChangelogService
+ summary: ListChangelogs
description: |-
- Gets a database group by name.
- Permissions required: bb.databaseGroups.get
- operationId: DatabaseGroupService_GetDatabaseGroup
+ Lists migration history for a database.
+ Permissions required: bb.changelogs.list
+ operationId: ChangelogService_ListChangelogs2
parameters:
- name: project
in: path
@@ -6313,33 +8812,78 @@ paths:
required: true
schema:
type: string
- - name: databaseGroup
+ - name: instance
in: path
- description: The databaseGroup id.
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ - name: database
+ in: path
+ description: The database id.
required: true
schema:
type: string
+ - name: pageSize
+ in: query
+ description: |-
+ The maximum number of changelogs to return. The service may return fewer
+ than this value. If unspecified, at most 10 changelogs will be returned.
+ The maximum value is 1000; values above 1000 will be coerced to 1000.
+ schema:
+ type: integer
+ title: page_size
+ format: int32
+ - name: pageToken
+ in: query
+ description: |-
+ A page token, received from the previous call.
+ Provide this to retrieve the subsequent page.
+
+ When paginating, all other parameters provided must match
+ the call that provided the page token.
+ schema:
+ type: string
+ title: page_token
- name: view
in: query
- description: The view to return. Defaults to DATABASE_GROUP_VIEW_BASIC.
schema:
title: view
- $ref: '#/components/schemas/bytebase.v1.DatabaseGroupView'
+ $ref: '#/components/schemas/bytebase.v1.ChangelogView'
+ - name: filter
+ in: query
+ description: |-
+ Filter is used to filter changelogs returned in the list.
+ The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
+
+ Supported filter:
+ - status: the changelog status, support "==" operation. check Changelog.Status for available values.
+ - has_schema_snapshot: filters to changelogs with a schema snapshot; only "has_schema_snapshot == true" is supported.
+ - create_time: the changelog create time in RFC 3339 format, supports ">=", "<=", or "<" operator.
+
+ Example:
+ status == "DONE"
+ status == "FAILED"
+ has_schema_snapshot == true && create_time < "2024-01-02T00:00:00Z"
+ schema:
+ type: string
+ title: filter
responses:
"200":
description: Success
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.DatabaseGroup'
- delete:
+ $ref: '#/components/schemas/bytebase.v1.ListChangelogsResponse'
+ /v1/projects/{project}/instances/{instance}/databases/{database}/changelogs/{changelog}:
+ get:
tags:
- - DatabaseGroupService
- summary: DeleteDatabaseGroup
+ - ChangelogService
+ summary: GetChangelog
description: |-
- Deletes a database group.
- Permissions required: bb.databaseGroups.delete
- operationId: DatabaseGroupService_DeleteDatabaseGroup
+ Retrieves a specific changelog entry.
+ Permissions required: bb.changelogs.get
+ operationId: ChangelogService_GetChangelog2
parameters:
- name: project
in: path
@@ -6347,28 +8891,45 @@ paths:
required: true
schema:
type: string
- - name: databaseGroup
+ - name: instance
in: path
- description: The databaseGroup id.
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ - name: database
+ in: path
+ description: The database id.
+ required: true
+ schema:
+ type: string
+ - name: changelog
+ in: path
+ description: The changelog id.
required: true
schema:
type: string
+ - name: view
+ in: query
+ schema:
+ title: view
+ $ref: '#/components/schemas/bytebase.v1.ChangelogView'
responses:
"200":
description: Success
content:
application/json:
schema:
- $ref: '#/components/schemas/google.protobuf.Empty'
- patch:
+ $ref: '#/components/schemas/bytebase.v1.Changelog'
+ /v1/projects/{project}/instances/{instance}/databases/{database}/changelogs/{changelog}:diffSchema:
+ post:
tags:
- - DatabaseGroupService
- summary: UpdateDatabaseGroup
+ - DatabaseService
+ summary: DiffSchema
description: |-
- Updates a database group.
- Permissions required: bb.databaseGroups.update
- When allow_missing=true, also requires: bb.databaseGroups.create
- operationId: DatabaseGroupService_UpdateDatabaseGroup
+ Compares and generates migration statements between two schemas.
+ Permissions required: bb.databases.get
+ operationId: DatabaseService_DiffSchema4
parameters:
- name: project
in: path
@@ -6376,256 +8937,78 @@ paths:
required: true
schema:
type: string
- - name: databaseGroup
+ - name: instance
in: path
- description: The databaseGroup id.
+ description: The instance id.
required: true
schema:
type: string
- - name: updateMask
- in: query
- description: |-
- `FieldMask` represents a set of symbolic field paths, for example:
-
- paths: "f.a"
- paths: "f.b.d"
-
- Here `f` represents a field in some root message, `a` and `b`
- fields in the message found in `f`, and `d` a field found in the
- message in `f.b`.
-
- Field masks are used to specify a subset of fields that should be
- returned by a get operation or modified by an update operation.
- Field masks also have a custom JSON encoding (see below).
-
- # Field Masks in Projections
-
- When used in the context of a projection, a response message or
- sub-message is filtered by the API to only contain those fields as
- specified in the mask. For example, if the mask in the previous
- example is applied to a response message as follows:
-
- f {
- a : 22
- b {
- d : 1
- x : 2
- }
- y : 13
- }
- z: 8
-
- The result will not contain specific values for fields x,y and z
- (their value will be set to the default, and omitted in proto text
- output):
-
-
- f {
- a : 22
- b {
- d : 1
- }
- }
-
- A repeated field is not allowed except at the last position of a
- paths string.
-
- If a FieldMask object is not present in a get operation, the
- operation applies to all fields (as if a FieldMask of all fields
- had been specified).
-
- Note that a field mask does not necessarily apply to the
- top-level response message. In case of a REST get operation, the
- field mask applies directly to the response, but in case of a REST
- list operation, the mask instead applies to each individual message
- in the returned resource list. In case of a REST custom method,
- other definitions may be used. Where the mask applies will be
- clearly documented together with its declaration in the API. In
- any case, the effect on the returned resource/resources is required
- behavior for APIs.
-
- # Field Masks in Update Operations
-
- A field mask in update operations specifies which fields of the
- targeted resource are going to be updated. The API is required
- to only change the values of the fields as specified in the mask
- and leave the others untouched. If a resource is passed in to
- describe the updated values, the API ignores the values of all
- fields not covered by the mask.
-
- If a repeated field is specified for an update operation, new values will
- be appended to the existing repeated field in the target resource. Note that
- a repeated field is only allowed in the last position of a `paths` string.
-
- If a sub-message is specified in the last position of the field mask for an
- update operation, then new value will be merged into the existing sub-message
- in the target resource.
-
- For example, given the target message:
-
- f {
- b {
- d: 1
- x: 2
- }
- c: [1]
- }
-
- And an update message:
-
- f {
- b {
- d: 10
- }
- c: [2]
- }
-
- then if the field mask is:
-
- paths: ["f.b", "f.c"]
-
- then the result will be:
-
- f {
- b {
- d: 10
- x: 2
- }
- c: [1, 2]
- }
-
- An implementation may provide options to override this default behavior for
- repeated and message fields.
-
- In order to reset a field's value to the default, the field must
- be in the mask and set to the default value in the provided resource.
- Hence, in order to reset all fields of a resource, provide a default
- instance of the resource and set all fields in the mask, or do
- not provide a mask as described below.
-
- If a field mask is not present on update, the operation applies to
- all fields (as if a field mask of all fields has been specified).
- Note that in the presence of schema evolution, this may mean that
- fields the client does not know and has therefore not filled into
- the request will be reset to their default. If this is unwanted
- behavior, a specific service may require a client to always specify
- a field mask, producing an error if not.
-
- As with get operations, the location of the resource which
- describes the updated values in the request message depends on the
- operation kind. In any case, the effect of the field mask is
- required to be honored by the API.
-
- ## Considerations for HTTP REST
-
- The HTTP kind of an update operation which uses a field mask must
- be set to PATCH instead of PUT in order to satisfy HTTP semantics
- (PUT must only be used for full updates).
-
- # JSON Encoding of Field Masks
-
- In JSON, a field mask is encoded as a single string where paths are
- separated by a comma. Fields name in each path are converted
- to/from lower-camel naming conventions.
-
- As an example, consider the following message declarations:
-
- message Profile {
- User user = 1;
- Photo photo = 2;
- }
- message User {
- string display_name = 1;
- string address = 2;
- }
-
- In proto a field mask for `Profile` may look as such:
-
- mask {
- paths: "user.display_name"
- paths: "photo"
- }
-
- In JSON, the same mask is represented as below:
-
- {
- mask: "user.displayName,photo"
- }
-
- # Field Masks and Oneof Fields
-
- Field masks treat fields in oneofs just as regular fields. Consider the
- following message:
-
- message SampleMessage {
- oneof test_oneof {
- string name = 4;
- SubMessage sub_message = 9;
- }
- }
-
- The field mask can be:
-
- mask {
- paths: "name"
- }
-
- Or:
-
- mask {
- paths: "sub_message"
- }
-
- Note that oneof type names ("test_oneof" in this case) cannot be used in
- paths.
-
- ## Field Mask Verification
-
- The implementation of any API method which has a FieldMask type field in the
- request should verify the included field paths, and return an
- `INVALID_ARGUMENT` error if any path is unmappable.
+ - name: database
+ in: path
+ description: The database id.
+ required: true
schema:
type: string
- - name: allowMissing
- in: query
- description: |-
- If set to true, and the database group is not found, a new database group will be created.
- In this situation, `update_mask` is ignored.
+ - name: changelog
+ in: path
+ description: The changelog id.
+ required: true
schema:
- type: boolean
- title: allow_missing
+ type: string
requestBody:
- description: |-
- The database group to update.
-
- The database group's `name` field is used to identify the database group to update.
- Format: projects/{project}/databaseGroups/{databaseGroup}
content:
application/json:
schema:
- title: database_group
- description: |-
- The database group to update.
-
- The database group's `name` field is used to identify the database group to update.
- Format: projects/{project}/databaseGroups/{databaseGroup}
- $ref: '#/components/schemas/bytebase.v1.DatabaseGroup'
+ type: object
+ allOf:
+ - {}
+ - oneOf:
+ - type: object
+ properties:
+ changelog:
+ type: string
+ title: changelog
+ description: |-
+ The resource name of the changelog
+ Format:
+ instances/{instance}/databases/{database}/changelogs/{changelog} or projects/{project}/instances/{instance}/databases/{database}/changelogs/{changelog}
+ title: changelog
+ required:
+ - changelog
+ - type: object
+ properties:
+ schema:
+ type: string
+ title: schema
+ description: The target schema.
+ title: schema
+ required:
+ - schema
+ - not:
+ anyOf:
+ - required:
+ - changelog
+ - required:
+ - schema
+ unevaluatedProperties: false
+ title: DiffSchemaRequest
+ required: true
responses:
"200":
description: Success
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.DatabaseGroup'
- /v1/projects/{project}/databases:
+ $ref: '#/components/schemas/bytebase.v1.DiffSchemaResponse'
+ /v1/projects/{project}/instances/{instance}/databases/{database}/metadata:
get:
tags:
- DatabaseService
- summary: ListDatabases
+ summary: GetDatabaseMetadata
description: |-
- Lists databases in a project, instance, or workspace.
- Permissions required: bb.projects.get (for project parent), bb.databases.list (for workspace parent), or bb.instances.get (for instance parent)
- operationId: DatabaseService_ListDatabases
+ Retrieves database metadata including tables, columns, and indexes.
+ Permissions required: bb.databases.getSchema
+ operationId: DatabaseService_GetDatabaseMetadata2
parameters:
- name: project
in: path
@@ -6633,28 +9016,18 @@ paths:
required: true
schema:
type: string
- - name: pageSize
- in: query
- description: |-
- The maximum number of databases to return. The service may return fewer
- than this value.
- If unspecified, at most 10 databases will be returned.
- The maximum value is 1000; values above 1000 will be coerced to 1000.
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
schema:
- type: integer
- title: page_size
- format: int32
- - name: pageToken
- in: query
- description: |-
- A page token, received from a previous `ListDatabases` call.
- Provide this to retrieve the subsequent page.
-
- When paginating, all other parameters provided to `ListDatabases` must
- match the call that provided the page token.
+ type: string
+ - name: database
+ in: path
+ description: The database id.
+ required: true
schema:
type: string
- title: page_token
- name: filter
in: query
description: |-
@@ -6662,73 +9035,46 @@ paths:
The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
Supported filter:
- - environment: the environment full name in "environments/{id}" format, support "==" operator.
- - name: the database name, support ".contains()" operator.
- - project: the project full name in "projects/{id}" format, support "==" operator.
- - instance: the instance full name in "instances/{id}" or "projects/{project}/instances/{id}" format, support "==" operator.
- - engine: the database engine, check Engine enum for values. Support "==", "in [xx]", "!(in [xx])" operator.
- - exclude_unassigned: should be "true" or "false", will not show unassigned databases if it's true, support "==" operator.
- - table: filter by the database table, support "==" and ".contains()" operator.
- - labels.{key}: the database label, support "==" and "in" operators.
+ - schema: the schema name, support "==" operator.
+ - table: the table name, support "==" and ".contains()" operator.
For example:
- environment == "environments/{environment resource id}"
- environment == "" (find databases which environment is not set)
- project == "projects/{project resource id}"
- instance == "instances/{instance resource id}"
- instance == "projects/{project resource id}/instances/{instance resource id}"
- name.contains("database name")
- engine == "MYSQL"
- engine in ["MYSQL", "POSTGRES"]
- !(engine in ["MYSQL", "POSTGRES"])
- exclude_unassigned == true
- table == "sample"
- table.contains("sam")
- labels.environment == "production"
- labels.region == "asia"
- labels.region in ["asia", "europe"]
-
- You can combine filter conditions like:
- environment == "environments/prod" && name.contains("employee")
+ schema == "schema-a"
+ table == "table-a"
+ table.contains("table-a")
+ schema == "schema-a" && table.contains("sample")
+ The filter is used to search for tables containing "sample" in the schema "schemas/schema-a".
+ The column masking level will only be returned when a table filter is used.
schema:
type: string
title: filter
- - name: showDeleted
- in: query
- description: Show deleted database if specified.
- schema:
- type: boolean
- title: show_deleted
- - name: orderBy
+ - name: limit
in: query
description: |-
- The order by of databases.
- Support name, project, instance. The default sorting order is ascending.
- For example:
- - order_by = "name" - order by name ascending
- - order_by = "name desc"
- - order_by = "name desc, project asc"
+ Limit the response size of returned table metadata per schema.
+ For example, if the database has 3 schemas, and each schema has 100 tables,
+ if limit is 20, then only 20 tables will be returned for each schema, total 60 tables.
+ Default 0, means no limit.
schema:
- type: string
- title: order_by
+ type: integer
+ title: limit
+ format: int32
responses:
"200":
description: Success
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.ListDatabasesResponse'
- /v1/projects/{project}/databases:batchGet:
+ $ref: '#/components/schemas/bytebase.v1.DatabaseMetadata'
+ /v1/projects/{project}/instances/{instance}/databases/{database}/revisions:
get:
tags:
- - DatabaseService
- summary: BatchGetDatabases
+ - RevisionService
+ summary: ListRevisions
description: |-
- Retrieves multiple databases by their names.
- One resource per requested name, in request order. The first name that
- does not resolve fails the whole call (AIP-231: no partial response).
- Permissions required: bb.databases.get (on each named database's project)
- operationId: DatabaseService_BatchGetDatabases
+ Lists schema revisions for a database.
+ Permissions required: bb.revisions.list
+ operationId: RevisionService_ListRevisions2
parameters:
- name: project
in: path
@@ -6736,45 +9082,24 @@ paths:
required: true
schema:
type: string
- - name: names
- in: query
- description: The list of database names to retrieve.
+ - name: instance
+ in: path
+ description: The instance id.
required: true
schema:
- type: array
- items:
- type: string
- title: names
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.BatchGetDatabasesResponse'
- /v1/projects/{project}/instances:
- get:
- tags:
- - InstanceService
- summary: ListInstances
- description: |-
- Lists database instances, optionally within a project.
- Permissions required: bb.instances.list
- operationId: InstanceService_ListInstances2
- parameters:
- - name: project
+ type: string
+ - name: database
in: path
- description: The project id.
+ description: The database id.
required: true
schema:
type: string
- name: pageSize
in: query
description: |-
- The maximum number of instances to return. The service may return fewer than
- this value.
- If unspecified, at most 10 instances will be returned.
- The maximum value is 1000; values above 1000 will be coerced to 1000.
+ The maximum number of revisions to return. The service may return fewer
+ than this value. If unspecified, at most 10 revisions will be returned. The
+ maximum value is 1000; values above 1000 will be coerced to 1000.
schema:
type: integer
title: page_size
@@ -6782,88 +9107,117 @@ paths:
- name: pageToken
in: query
description: |-
- A page token, received from a previous `ListInstances` call.
+ A page token, received from a previous `ListRevisions` call.
Provide this to retrieve the subsequent page.
- When paginating, all other parameters provided to `ListInstances` must match
- the call that provided the page token.
+ When paginating, all other parameters provided to `ListRevisions` must
+ match the call that provided the page token.
schema:
type: string
title: page_token
- name: showDeleted
in: query
- description: Show deleted instances if specified.
+ description: Whether to include deleted revisions in the results.
schema:
type: boolean
title: show_deleted
- - name: filter
- in: query
- description: |-
- Filter the instance.
- The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
-
- Supported filters:
- - name: the instance name, support "==" and ".contains()" operator.
- - resource_id: the instance id, support "==" and ".contains()" operator.
- - environment: the environment full name in "environments/{id}" format, support "==" operator.
- - state: the instance state, check State enum for values, support "==" operator.
- - engine: the instance engine, check Engine enum for values. Support "==", "in [xx]", "!(in [xx])" operator.
- - host: the instance host, support "==" and ".contains()" operator.
- - port: the instance port, support "==" and ".contains()" operator.
- - project: the project full name in "projects/{id}" format, support "==" operator.
- - labels.{key}: the instance label, support "==" and "in" operators.
-
- For example:
- name == "sample instance"
- name.contains("sample")
- resource_id == "sample-instance"
- resource_id.contains("sample")
- state == "DELETED"
- environment == "environments/test"
- environment == "" (find instances which environment is not set)
- engine == "MYSQL"
- engine in ["MYSQL", "POSTGRES"]
- !(engine in ["MYSQL", "POSTGRES"])
- host == "127.0.0.1"
- host.contains("127.0")
- port == "54321"
- port.contains("543")
- labels.org_group == "infrastructure"
- labels.environment in ["prod", "production"]
- project == "projects/sample-project"
- You can combine filter conditions like:
- name.contains("sample") && environment == "environments/test"
- host == "127.0.0.1" && port == "54321"
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.ListRevisionsResponse'
+ /v1/projects/{project}/instances/{instance}/databases/{database}/revisions/{revision}:
+ get:
+ tags:
+ - RevisionService
+ summary: GetRevision
+ description: |-
+ Retrieves a schema revision by name.
+ Permissions required: bb.revisions.get
+ operationId: RevisionService_GetRevision2
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ - name: database
+ in: path
+ description: The database id.
+ required: true
+ schema:
+ type: string
+ - name: revision
+ in: path
+ description: The revision id.
+ required: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.Revision'
+ delete:
+ tags:
+ - RevisionService
+ summary: DeleteRevision
+ description: |-
+ Deletes a schema revision.
+ Permissions required: bb.revisions.delete
+ operationId: RevisionService_DeleteRevision2
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
schema:
type: string
- title: filter
- - name: orderBy
- in: query
- description: |-
- The order by of instances.
- Support title, environment. The default sorting order is ascending.
- For example:
- - order_by = "title"
- - order_by = "title desc"
- - order_by = "title desc, environment asc"
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
+ schema:
+ type: string
+ - name: database
+ in: path
+ description: The database id.
+ required: true
+ schema:
+ type: string
+ - name: revision
+ in: path
+ description: The revision id.
+ required: true
schema:
type: string
- title: order_by
responses:
"200":
description: Success
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.ListInstancesResponse'
+ $ref: '#/components/schemas/google.protobuf.Empty'
+ /v1/projects/{project}/instances/{instance}/databases/{database}/revisions:batchCreate:
post:
tags:
- - InstanceService
- summary: CreateInstance
+ - RevisionService
+ summary: BatchCreateRevisions
description: |-
- Creates a new database instance.
- Permissions required: bb.instances.create
- operationId: InstanceService_CreateInstance2
+ Creates multiple schema revisions in a single operation.
+ Permissions required: bb.revisions.create
+ operationId: RevisionService_BatchCreateRevisions2
parameters:
- name: project
in: path
@@ -6871,47 +9225,53 @@ paths:
required: true
schema:
type: string
- - name: instanceId
- in: query
- description: |-
- The ID to use for the instance, which will become the final component of
- the instance's resource name.
-
- This value should be 4-63 characters, and valid characters
- are /[a-z][0-9]-/.
+ - name: instance
+ in: path
+ description: The instance id.
+ required: true
schema:
type: string
- title: instance_id
- - name: validateOnly
- in: query
- description: Validate only also tests the data source connection.
+ - name: database
+ in: path
+ description: The database id.
+ required: true
schema:
- type: boolean
- title: validate_only
+ type: string
requestBody:
- description: The instance to create.
content:
application/json:
schema:
- title: instance
- description: The instance to create.
- $ref: '#/components/schemas/bytebase.v1.Instance'
+ type: object
+ properties:
+ requests:
+ type: array
+ items:
+ $ref: '#/components/schemas/bytebase.v1.CreateRevisionRequest'
+ title: requests
+ description: |-
+ The request message specifying the revisions to create.
+ A maximum of 100 revisions can be created in a batch.
+ title: BatchCreateRevisionsRequest
+ required:
+ - requests
+ additionalProperties: false
+ required: true
responses:
"200":
description: Success
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.Instance'
- /v1/projects/{project}/instances/{instance}:
+ $ref: '#/components/schemas/bytebase.v1.BatchCreateRevisionsResponse'
+ /v1/projects/{project}/instances/{instance}/databases/{database}/schema:
get:
tags:
- - InstanceService
- summary: GetInstance
+ - DatabaseService
+ summary: GetDatabaseSchema
description: |-
- Gets a database instance by name.
- Permissions required: bb.instances.get
- operationId: InstanceService_GetInstance2
+ Retrieves database schema as DDL statements.
+ Permissions required: bb.databases.getSchema
+ operationId: DatabaseService_GetDatabaseSchema2
parameters:
- name: project
in: path
@@ -6925,23 +9285,28 @@ paths:
required: true
schema:
type: string
+ - name: database
+ in: path
+ description: The database id.
+ required: true
+ schema:
+ type: string
responses:
"200":
description: Success
content:
application/json:
schema:
- $ref: '#/components/schemas/bytebase.v1.Instance'
- delete:
+ $ref: '#/components/schemas/bytebase.v1.DatabaseSchema'
+ /v1/projects/{project}/instances/{instance}/databases/{database}/schemaString:
+ get:
tags:
- - InstanceService
- summary: DeleteInstance
+ - DatabaseService
+ summary: GetSchemaString
description: |-
- Deletes or soft-deletes a database instance.
- Soft-delete requests fail with FAILED_PRECONDITION while any task run
- targeting the instance is pending, available, or running.
- Permissions required: bb.instances.delete
- operationId: InstanceService_DeleteInstance2
+ Generates schema DDL for a database object.
+ Permissions required: bb.databases.getSchema
+ operationId: DatabaseService_GetSchemaString2
parameters:
- name: project
in: path
@@ -6955,1364 +9320,1340 @@ paths:
required: true
schema:
type: string
- - name: force
+ - name: database
+ in: path
+ description: The database id.
+ required: true
+ schema:
+ type: string
+ - name: type
+ in: query
+ schema:
+ title: type
+ $ref: '#/components/schemas/bytebase.v1.GetSchemaStringRequest.ObjectType'
+ - name: schema
+ in: query
+ description: It's empty for DATABASE.
+ schema:
+ type: string
+ title: schema
+ - name: object
+ in: query
+ description: It's empty for DATABASE and SCHEMA.
+ schema:
+ type: string
+ title: object
+ - name: metadata.name
in: query
description: |-
- If set to true, a workspace instance's databases are moved to the default
- project before the instance is soft-deleted. Project instances reject this
- option because their databases must remain in the owning project.
+ The database metadata name.
+
+ Format: instances/{instance}/databases/{database}/metadata or projects/{project}/instances/{instance}/databases/{database}/metadata
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.name
+ in: query
+ description: |-
+ The name is the schema name.
+ It is an empty string for databases without such concept such as MySQL.
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.tables.name
+ in: query
+ description: The name is the name of a table.
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.tables.columns.name
+ in: query
+ description: The name is the name of a column.
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.tables.columns.position
+ in: query
+ description: The position is the position in columns.
+ schema:
+ type: integer
+ title: position
+ format: int32
+ - name: metadata.schemas.tables.columns.hasDefault
+ in: query
schema:
type: boolean
- title: force
- - name: purge
+ title: has_default
+ - name: metadata.schemas.tables.columns.default
+ in: query
+ description: The default value of column.
+ schema:
+ type: string
+ title: default
+ - name: metadata.schemas.tables.columns.defaultOnNull
in: query
description: |-
- If set to true, permanently purge the soft-deleted instance and all related resources.
- This operation is irreversible. Following AIP-165, this should only be used for
- administrative cleanup of old soft-deleted instances.
- The instance must already be soft-deleted for this to work.
+ Oracle specific metadata.
+ The default_on_null is the default on null of a column.
schema:
type: boolean
- title: purge
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/google.protobuf.Empty'
- patch:
- tags:
- - InstanceService
- summary: UpdateInstance
- description: |-
- Updates a database instance.
- Permissions required: bb.instances.update
- operationId: InstanceService_UpdateInstance2
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
+ title: default_on_null
+ - name: metadata.schemas.tables.columns.onUpdate
+ in: query
+ description: |-
+ The on_update is the on update action of a column.
+ For MySQL like databases, it's only supported for TIMESTAMP columns with
+ CURRENT_TIMESTAMP as on update value.
+ schema:
+ type: string
+ title: on_update
+ - name: metadata.schemas.tables.columns.nullable
+ in: query
+ description: The nullable is the nullable of a column.
+ schema:
+ type: boolean
+ title: nullable
+ - name: metadata.schemas.tables.columns.type
+ in: query
+ description: The type is the type of a column.
+ schema:
+ type: string
+ title: type
+ - name: metadata.schemas.tables.columns.characterSet
+ in: query
+ description: The character_set is the character_set of a column.
+ schema:
+ type: string
+ title: character_set
+ - name: metadata.schemas.tables.columns.collation
+ in: query
+ description: The collation is the collation of a column.
schema:
type: string
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: collation
+ - name: metadata.schemas.tables.columns.comment
+ in: query
+ description: The comment is the comment of a column.
schema:
type: string
- - name: updateMask
+ title: comment
+ - name: metadata.schemas.tables.columns.generation.type
+ in: query
+ schema:
+ title: type
+ $ref: '#/components/schemas/bytebase.v1.GenerationMetadata.Type'
+ - name: metadata.schemas.tables.columns.generation.expression
+ in: query
+ schema:
+ type: string
+ title: expression
+ - name: metadata.schemas.tables.columns.isIdentity
+ in: query
+ schema:
+ type: boolean
+ title: is_identity
+ - name: metadata.schemas.tables.columns.identityGeneration
+ in: query
+ description: The identity_generation is for identity columns, PG only.
+ schema:
+ title: identity_generation
+ $ref: '#/components/schemas/bytebase.v1.ColumnMetadata.IdentityGeneration'
+ - name: metadata.schemas.tables.columns.identitySeed
+ in: query
+ description: The identity_seed is for identity columns, MSSQL only.
+ schema:
+ type:
+ - integer
+ - string
+ title: identity_seed
+ format: int64
+ - name: metadata.schemas.tables.columns.identityIncrement
+ in: query
+ description: The identity_increment is for identity columns, MSSQL only.
+ schema:
+ type:
+ - integer
+ - string
+ title: identity_increment
+ format: int64
+ - name: metadata.schemas.tables.columns.defaultConstraintName
in: query
description: |-
- `FieldMask` represents a set of symbolic field paths, for example:
-
- paths: "f.a"
- paths: "f.b.d"
-
- Here `f` represents a field in some root message, `a` and `b`
- fields in the message found in `f`, and `d` a field found in the
- message in `f.b`.
-
- Field masks are used to specify a subset of fields that should be
- returned by a get operation or modified by an update operation.
- Field masks also have a custom JSON encoding (see below).
-
- # Field Masks in Projections
-
- When used in the context of a projection, a response message or
- sub-message is filtered by the API to only contain those fields as
- specified in the mask. For example, if the mask in the previous
- example is applied to a response message as follows:
-
- f {
- a : 22
- b {
- d : 1
- x : 2
- }
- y : 13
- }
- z: 8
-
- The result will not contain specific values for fields x,y and z
- (their value will be set to the default, and omitted in proto text
- output):
-
-
- f {
- a : 22
- b {
- d : 1
- }
- }
-
- A repeated field is not allowed except at the last position of a
- paths string.
-
- If a FieldMask object is not present in a get operation, the
- operation applies to all fields (as if a FieldMask of all fields
- had been specified).
-
- Note that a field mask does not necessarily apply to the
- top-level response message. In case of a REST get operation, the
- field mask applies directly to the response, but in case of a REST
- list operation, the mask instead applies to each individual message
- in the returned resource list. In case of a REST custom method,
- other definitions may be used. Where the mask applies will be
- clearly documented together with its declaration in the API. In
- any case, the effect on the returned resource/resources is required
- behavior for APIs.
-
- # Field Masks in Update Operations
-
- A field mask in update operations specifies which fields of the
- targeted resource are going to be updated. The API is required
- to only change the values of the fields as specified in the mask
- and leave the others untouched. If a resource is passed in to
- describe the updated values, the API ignores the values of all
- fields not covered by the mask.
-
- If a repeated field is specified for an update operation, new values will
- be appended to the existing repeated field in the target resource. Note that
- a repeated field is only allowed in the last position of a `paths` string.
-
- If a sub-message is specified in the last position of the field mask for an
- update operation, then new value will be merged into the existing sub-message
- in the target resource.
-
- For example, given the target message:
-
- f {
- b {
- d: 1
- x: 2
- }
- c: [1]
- }
-
- And an update message:
-
- f {
- b {
- d: 10
- }
- c: [2]
- }
-
- then if the field mask is:
-
- paths: ["f.b", "f.c"]
-
- then the result will be:
-
- f {
- b {
- d: 10
- x: 2
- }
- c: [1, 2]
- }
-
- An implementation may provide options to override this default behavior for
- repeated and message fields.
-
- In order to reset a field's value to the default, the field must
- be in the mask and set to the default value in the provided resource.
- Hence, in order to reset all fields of a resource, provide a default
- instance of the resource and set all fields in the mask, or do
- not provide a mask as described below.
-
- If a field mask is not present on update, the operation applies to
- all fields (as if a field mask of all fields has been specified).
- Note that in the presence of schema evolution, this may mean that
- fields the client does not know and has therefore not filled into
- the request will be reset to their default. If this is unwanted
- behavior, a specific service may require a client to always specify
- a field mask, producing an error if not.
-
- As with get operations, the location of the resource which
- describes the updated values in the request message depends on the
- operation kind. In any case, the effect of the field mask is
- required to be honored by the API.
-
- ## Considerations for HTTP REST
-
- The HTTP kind of an update operation which uses a field mask must
- be set to PATCH instead of PUT in order to satisfy HTTP semantics
- (PUT must only be used for full updates).
-
- # JSON Encoding of Field Masks
-
- In JSON, a field mask is encoded as a single string where paths are
- separated by a comma. Fields name in each path are converted
- to/from lower-camel naming conventions.
-
- As an example, consider the following message declarations:
-
- message Profile {
- User user = 1;
- Photo photo = 2;
- }
- message User {
- string display_name = 1;
- string address = 2;
- }
-
- In proto a field mask for `Profile` may look as such:
-
- mask {
- paths: "user.display_name"
- paths: "photo"
- }
-
- In JSON, the same mask is represented as below:
-
- {
- mask: "user.displayName,photo"
- }
-
- # Field Masks and Oneof Fields
-
- Field masks treat fields in oneofs just as regular fields. Consider the
- following message:
-
- message SampleMessage {
- oneof test_oneof {
- string name = 4;
- SubMessage sub_message = 9;
- }
- }
-
- The field mask can be:
-
- mask {
- paths: "name"
- }
-
- Or:
+ The default_constraint_name is the name of the default constraint, MSSQL only.
+ In MSSQL, default values are implemented as named constraints. When modifying or
+ dropping a column's default value, you must reference the constraint by name.
+ This field stores the actual constraint name from the database.
- mask {
- paths: "sub_message"
- }
+ Example: A column definition like:
+ CREATE TABLE employees (
+ status NVARCHAR(20) DEFAULT 'active'
+ )
- Note that oneof type names ("test_oneof" in this case) cannot be used in
- paths.
+ Will create a constraint with an auto-generated name like 'DF__employees__statu__3B75D760'
+ or a user-defined name if specified:
+ ALTER TABLE employees ADD CONSTRAINT DF_employees_status DEFAULT 'active' FOR status
- ## Field Mask Verification
+ To modify the default, you must first drop the existing constraint by name:
+ ALTER TABLE employees DROP CONSTRAINT DF__employees__statu__3B75D760
+ ALTER TABLE employees ADD CONSTRAINT DF_employees_status DEFAULT 'inactive' FOR status
- The implementation of any API method which has a FieldMask type field in the
- request should verify the included field paths, and return an
- `INVALID_ARGUMENT` error if any path is unmappable.
+ This field is populated when syncing from the database. When empty (e.g., when parsing
+ from SQL files), the system cannot automatically drop the constraint.
schema:
type: string
- - name: allowMissing
+ title: default_constraint_name
+ - name: metadata.schemas.tables.columns.srid
in: query
description: |-
- If set to true, and the instance is not found, a new instance will be created.
- In this situation, `update_mask` is ignored. A project-nested name creates
- the instance only under its encoded active, non-default project; it never
- falls back to a workspace instance.
+ The spatial reference system identifier of a spatial column, MySQL 8.0 only.
+ Unset means the column declares no SRID; presence carries the explicit SRID,
+ including the valid SRID 0. SRS_IDs are unsigned 32-bit (custom SRSs may exceed
+ int32).
+ schema:
+ type: integer
+ title: srid
+ - name: metadata.schemas.tables.columns.isInvisible
+ in: query
+ description: Whether the column is invisible (hidden from SELECT *), MySQL 8.0.23+ only.
schema:
type: boolean
- title: allow_missing
- requestBody:
- description: |-
- The instance to update.
-
- The instance's `name` field is used to identify the instance to update.
- Format: instances/{instance} or projects/{project}/instances/{instance}
- content:
- application/json:
- schema:
- title: instance
- description: |-
- The instance to update.
-
- The instance's `name` field is used to identify the instance to update.
- Format: instances/{instance} or projects/{project}/instances/{instance}
- $ref: '#/components/schemas/bytebase.v1.Instance'
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.Instance'
- /v1/projects/{project}/instances/{instance}/databases:
- get:
- tags:
- - DatabaseService
- summary: ListDatabases
- description: |-
- Lists databases in a project, instance, or workspace.
- Permissions required: bb.projects.get (for project parent), bb.databases.list (for workspace parent), or bb.instances.get (for instance parent)
- operationId: DatabaseService_ListDatabases4
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
+ title: is_invisible
+ - name: metadata.schemas.tables.indexes.name
+ in: query
+ description: The name is the name of an index.
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.tables.indexes.expressions
+ in: query
+ description: |-
+ The expressions are the ordered columns or expressions of an index.
+ This could refer to a column or an expression.
+ schema:
+ type: array
+ items:
+ type: string
+ title: expressions
+ - name: metadata.schemas.tables.indexes.keyLength
+ in: query
+ description: |-
+ The key_lengths are the ordered key lengths of an index.
+ If the key length is not specified, it's -1.
+ schema:
+ type: array
+ items:
+ type:
+ - integer
+ - string
+ format: int64
+ title: key_length
+ - name: metadata.schemas.tables.indexes.descending
+ in: query
+ description: The descending is the ordered descending of an index.
+ schema:
+ type: array
+ items:
+ type: boolean
+ title: descending
+ - name: metadata.schemas.tables.indexes.type
+ in: query
+ description: The type is the type of an index.
+ schema:
+ type: string
+ title: type
+ - name: metadata.schemas.tables.indexes.unique
+ in: query
+ description: The unique is whether the index is unique.
+ schema:
+ type: boolean
+ title: unique
+ - name: metadata.schemas.tables.indexes.primary
+ in: query
+ description: The primary is whether the index is a primary key index.
+ schema:
+ type: boolean
+ title: primary
+ - name: metadata.schemas.tables.indexes.visible
+ in: query
+ description: The visible is whether the index is visible.
+ schema:
+ type: boolean
+ title: visible
+ - name: metadata.schemas.tables.indexes.comment
+ in: query
+ description: The comment is the comment of an index.
+ schema:
+ type: string
+ title: comment
+ - name: metadata.schemas.tables.indexes.definition
+ in: query
+ description: The definition of an index.
+ schema:
+ type: string
+ title: definition
+ - name: metadata.schemas.tables.indexes.parentIndexSchema
+ in: query
+ description: The schema name of the parent index.
+ schema:
+ type: string
+ title: parent_index_schema
+ - name: metadata.schemas.tables.indexes.parentIndexName
+ in: query
+ description: The index name of the parent index.
+ schema:
+ type: string
+ title: parent_index_name
+ - name: metadata.schemas.tables.indexes.granularity
+ in: query
+ description: The number of granules in the block. It's a ClickHouse specific field.
+ schema:
+ type:
+ - integer
+ - string
+ title: granularity
+ format: int64
+ - name: metadata.schemas.tables.indexes.isConstraint
+ in: query
+ description: |-
+ It's a PostgreSQL specific field.
+ The unique constraint and unique index are not the same thing in PostgreSQL.
+ schema:
+ type: boolean
+ title: is_constraint
+ - name: metadata.schemas.tables.indexes.spatialConfig.method
+ in: query
+ description: Spatial indexing method (e.g., "SPATIAL", "R-TREE", "GIST")
+ schema:
+ type: string
+ title: method
+ - name: metadata.schemas.tables.indexes.spatialConfig.tessellation.scheme
+ in: query
+ description: Tessellation scheme (e.g., "GEOMETRY_GRID", "GEOGRAPHY_GRID", "GEOMETRY_AUTO_GRID")
+ schema:
+ type: string
+ title: scheme
+ - name: metadata.schemas.tables.indexes.spatialConfig.tessellation.gridLevels.level
+ in: query
+ description: Grid level number (1-4 for SQL Server)
+ schema:
+ type: integer
+ title: level
+ format: int32
+ - name: metadata.schemas.tables.indexes.spatialConfig.tessellation.gridLevels.density
+ in: query
+ description: Grid density (LOW, MEDIUM, HIGH)
+ schema:
+ type: string
+ title: density
+ - name: metadata.schemas.tables.indexes.spatialConfig.tessellation.cellsPerObject
+ in: query
+ description: Number of cells per object (1-8192 for SQL Server)
+ schema:
+ type: integer
+ title: cells_per_object
+ format: int32
+ - name: metadata.schemas.tables.indexes.spatialConfig.tessellation.boundingBox.xmin
+ in: query
+ description: Minimum X coordinate
+ schema:
+ type: number
+ title: xmin
+ format: double
+ - name: metadata.schemas.tables.indexes.spatialConfig.tessellation.boundingBox.ymin
+ in: query
+ description: Minimum Y coordinate
+ schema:
+ type: number
+ title: ymin
+ format: double
+ - name: metadata.schemas.tables.indexes.spatialConfig.tessellation.boundingBox.xmax
+ in: query
+ description: Maximum X coordinate
+ schema:
+ type: number
+ title: xmax
+ format: double
+ - name: metadata.schemas.tables.indexes.spatialConfig.tessellation.boundingBox.ymax
+ in: query
+ description: Maximum Y coordinate
+ schema:
+ type: number
+ title: ymax
+ format: double
+ - name: metadata.schemas.tables.indexes.spatialConfig.storage.fillfactor
+ in: query
+ description: Fill factor percentage (1-100)
+ schema:
+ type: integer
+ title: fillfactor
+ format: int32
+ - name: metadata.schemas.tables.indexes.spatialConfig.storage.buffering
+ in: query
+ description: Buffering mode for PostgreSQL (auto, on, off)
+ schema:
+ type: string
+ title: buffering
+ - name: metadata.schemas.tables.indexes.spatialConfig.storage.tablespace
+ in: query
+ description: Tablespace configuration for Oracle
+ schema:
+ type: string
+ title: tablespace
+ - name: metadata.schemas.tables.indexes.spatialConfig.storage.workTablespace
+ in: query
+ schema:
+ type: string
+ title: work_tablespace
+ - name: metadata.schemas.tables.indexes.spatialConfig.storage.sdoLevel
+ in: query
+ schema:
+ type: integer
+ title: sdo_level
+ format: int32
+ - name: metadata.schemas.tables.indexes.spatialConfig.storage.commitInterval
+ in: query
+ schema:
+ type: integer
+ title: commit_interval
+ format: int32
+ - name: metadata.schemas.tables.indexes.spatialConfig.storage.padIndex
+ in: query
+ description: SQL Server specific parameters
+ schema:
+ type: boolean
+ title: pad_index
+ - name: metadata.schemas.tables.indexes.spatialConfig.storage.sortInTempdb
+ in: query
+ description: ON, OFF
schema:
type: string
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: sort_in_tempdb
+ - name: metadata.schemas.tables.indexes.spatialConfig.storage.dropExisting
+ in: query
+ schema:
+ type: boolean
+ title: drop_existing
+ - name: metadata.schemas.tables.indexes.spatialConfig.storage.online
+ in: query
+ schema:
+ type: boolean
+ title: online
+ - name: metadata.schemas.tables.indexes.spatialConfig.storage.allowRowLocks
+ in: query
+ schema:
+ type: boolean
+ title: allow_row_locks
+ - name: metadata.schemas.tables.indexes.spatialConfig.storage.allowPageLocks
+ in: query
+ schema:
+ type: boolean
+ title: allow_page_locks
+ - name: metadata.schemas.tables.indexes.spatialConfig.storage.maxdop
+ in: query
+ schema:
+ type: integer
+ title: maxdop
+ format: int32
+ - name: metadata.schemas.tables.indexes.spatialConfig.storage.dataCompression
+ in: query
+ description: NONE, ROW, PAGE
schema:
type: string
- - name: pageSize
+ title: data_compression
+ - name: metadata.schemas.tables.indexes.spatialConfig.dimensional.dimensions
in: query
- description: |-
- The maximum number of databases to return. The service may return fewer
- than this value.
- If unspecified, at most 10 databases will be returned.
- The maximum value is 1000; values above 1000 will be coerced to 1000.
+ description: Number of dimensions (2-4, default 2)
schema:
type: integer
- title: page_size
+ title: dimensions
format: int32
- - name: pageToken
+ - name: metadata.schemas.tables.indexes.spatialConfig.dimensional.dataType
in: query
- description: |-
- A page token, received from a previous `ListDatabases` call.
- Provide this to retrieve the subsequent page.
-
- When paginating, all other parameters provided to `ListDatabases` must
- match the call that provided the page token.
+ description: Spatial data type (GEOMETRY, GEOGRAPHY, POINT, POLYGON, etc.)
schema:
type: string
- title: page_token
- - name: filter
+ title: data_type
+ - name: metadata.schemas.tables.indexes.spatialConfig.dimensional.srid
in: query
- description: |-
- Filter is used to filter databases returned in the list.
- The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
-
- Supported filter:
- - environment: the environment full name in "environments/{id}" format, support "==" operator.
- - name: the database name, support ".contains()" operator.
- - project: the project full name in "projects/{id}" format, support "==" operator.
- - instance: the instance full name in "instances/{id}" or "projects/{project}/instances/{id}" format, support "==" operator.
- - engine: the database engine, check Engine enum for values. Support "==", "in [xx]", "!(in [xx])" operator.
- - exclude_unassigned: should be "true" or "false", will not show unassigned databases if it's true, support "==" operator.
- - table: filter by the database table, support "==" and ".contains()" operator.
- - labels.{key}: the database label, support "==" and "in" operators.
-
- For example:
- environment == "environments/{environment resource id}"
- environment == "" (find databases which environment is not set)
- project == "projects/{project resource id}"
- instance == "instances/{instance resource id}"
- instance == "projects/{project resource id}/instances/{instance resource id}"
- name.contains("database name")
- engine == "MYSQL"
- engine in ["MYSQL", "POSTGRES"]
- !(engine in ["MYSQL", "POSTGRES"])
- exclude_unassigned == true
- table == "sample"
- table.contains("sam")
- labels.environment == "production"
- labels.region == "asia"
- labels.region in ["asia", "europe"]
-
- You can combine filter conditions like:
- environment == "environments/prod" && name.contains("employee")
+ description: Spatial reference system identifier (SRID)
+ schema:
+ type: integer
+ title: srid
+ format: int32
+ - name: metadata.schemas.tables.indexes.spatialConfig.dimensional.constraints.dimension
+ in: query
+ description: Dimension name/type (X, Y, Z, M, etc.)
schema:
type: string
- title: filter
- - name: showDeleted
+ title: dimension
+ - name: metadata.schemas.tables.indexes.spatialConfig.dimensional.constraints.minValue
in: query
- description: Show deleted database if specified.
+ description: Minimum value for this dimension
schema:
- type: boolean
- title: show_deleted
- - name: orderBy
+ type: number
+ title: min_value
+ format: double
+ - name: metadata.schemas.tables.indexes.spatialConfig.dimensional.constraints.maxValue
+ in: query
+ description: Maximum value for this dimension
+ schema:
+ type: number
+ title: max_value
+ format: double
+ - name: metadata.schemas.tables.indexes.spatialConfig.dimensional.constraints.tolerance
+ in: query
+ description: Tolerance for this dimension
+ schema:
+ type: number
+ title: tolerance
+ format: double
+ - name: metadata.schemas.tables.indexes.opclassNames
in: query
description: |-
- The order by of databases.
- Support name, project, instance. The default sorting order is ascending.
- For example:
- - order_by = "name" - order by name ascending
- - order_by = "name desc"
- - order_by = "name desc, project asc"
+ https://www.postgresql.org/docs/current/catalog-pg-opclass.html
+ Name of the operator class for each column. (PostgreSQL specific).
schema:
- type: string
- title: order_by
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.ListDatabasesResponse'
- /v1/projects/{project}/instances/{instance}/databases/{database}:
- get:
- tags:
- - DatabaseService
- summary: GetDatabase
- description: |-
- Retrieves a database by name.
- Permissions required: bb.databases.get
- operationId: DatabaseService_GetDatabase2
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
+ type: array
+ items:
+ type: string
+ title: opclass_names
+ - name: metadata.schemas.tables.indexes.opclassDefaults
+ in: query
+ description: True if the operator class is the default. (PostgreSQL specific).
+ schema:
+ type: array
+ items:
+ type: boolean
+ title: opclass_defaults
+ - name: metadata.schemas.tables.engine
+ in: query
+ description: The engine is the engine of a table.
schema:
type: string
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: engine
+ - name: metadata.schemas.tables.collation
+ in: query
+ description: The collation is the collation of a table.
schema:
type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ title: collation
+ - name: metadata.schemas.tables.charset
+ in: query
+ description: The character set of table.
schema:
type: string
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.Database'
- patch:
- tags:
- - DatabaseService
- summary: UpdateDatabase
- description: |-
- Updates database properties such as labels and project assignment.
- Permissions required: bb.databases.update
- operationId: DatabaseService_UpdateDatabase2
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
+ title: charset
+ - name: metadata.schemas.tables.rowCount
+ in: query
+ description: The row_count is the estimated number of rows of a table.
+ schema:
+ type:
+ - integer
+ - string
+ title: row_count
+ format: int64
+ - name: metadata.schemas.tables.dataSize
+ in: query
+ description: The data_size is the estimated data size of a table.
+ schema:
+ type:
+ - integer
+ - string
+ title: data_size
+ format: int64
+ - name: metadata.schemas.tables.indexSize
+ in: query
+ description: The index_size is the estimated index size of a table.
+ schema:
+ type:
+ - integer
+ - string
+ title: index_size
+ format: int64
+ - name: metadata.schemas.tables.dataFree
+ in: query
+ description: The data_free is the estimated free data size of a table.
+ schema:
+ type:
+ - integer
+ - string
+ title: data_free
+ format: int64
+ - name: metadata.schemas.tables.createOptions
+ in: query
+ description: The create_options is the create option of a table.
schema:
type: string
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: create_options
+ - name: metadata.schemas.tables.comment
+ in: query
+ description: The comment is the comment of a table.
schema:
type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ title: comment
+ - name: metadata.schemas.tables.foreignKeys.name
+ in: query
+ description: The name is the name of a foreign key.
schema:
type: string
- - name: updateMask
+ title: name
+ - name: metadata.schemas.tables.foreignKeys.columns
+ in: query
+ description: The columns are the ordered referencing columns of a foreign key.
+ schema:
+ type: array
+ items:
+ type: string
+ title: columns
+ - name: metadata.schemas.tables.foreignKeys.referencedSchema
in: query
description: |-
- `FieldMask` represents a set of symbolic field paths, for example:
-
- paths: "f.a"
- paths: "f.b.d"
-
- Here `f` represents a field in some root message, `a` and `b`
- fields in the message found in `f`, and `d` a field found in the
- message in `f.b`.
-
- Field masks are used to specify a subset of fields that should be
- returned by a get operation or modified by an update operation.
- Field masks also have a custom JSON encoding (see below).
-
- # Field Masks in Projections
-
- When used in the context of a projection, a response message or
- sub-message is filtered by the API to only contain those fields as
- specified in the mask. For example, if the mask in the previous
- example is applied to a response message as follows:
-
- f {
- a : 22
- b {
- d : 1
- x : 2
- }
- y : 13
- }
- z: 8
-
- The result will not contain specific values for fields x,y and z
- (their value will be set to the default, and omitted in proto text
- output):
-
-
- f {
- a : 22
- b {
- d : 1
- }
- }
-
- A repeated field is not allowed except at the last position of a
- paths string.
-
- If a FieldMask object is not present in a get operation, the
- operation applies to all fields (as if a FieldMask of all fields
- had been specified).
-
- Note that a field mask does not necessarily apply to the
- top-level response message. In case of a REST get operation, the
- field mask applies directly to the response, but in case of a REST
- list operation, the mask instead applies to each individual message
- in the returned resource list. In case of a REST custom method,
- other definitions may be used. Where the mask applies will be
- clearly documented together with its declaration in the API. In
- any case, the effect on the returned resource/resources is required
- behavior for APIs.
-
- # Field Masks in Update Operations
-
- A field mask in update operations specifies which fields of the
- targeted resource are going to be updated. The API is required
- to only change the values of the fields as specified in the mask
- and leave the others untouched. If a resource is passed in to
- describe the updated values, the API ignores the values of all
- fields not covered by the mask.
-
- If a repeated field is specified for an update operation, new values will
- be appended to the existing repeated field in the target resource. Note that
- a repeated field is only allowed in the last position of a `paths` string.
-
- If a sub-message is specified in the last position of the field mask for an
- update operation, then new value will be merged into the existing sub-message
- in the target resource.
-
- For example, given the target message:
-
- f {
- b {
- d: 1
- x: 2
- }
- c: [1]
- }
-
- And an update message:
-
- f {
- b {
- d: 10
- }
- c: [2]
- }
-
- then if the field mask is:
-
- paths: ["f.b", "f.c"]
-
- then the result will be:
-
- f {
- b {
- d: 10
- x: 2
- }
- c: [1, 2]
- }
-
- An implementation may provide options to override this default behavior for
- repeated and message fields.
-
- In order to reset a field's value to the default, the field must
- be in the mask and set to the default value in the provided resource.
- Hence, in order to reset all fields of a resource, provide a default
- instance of the resource and set all fields in the mask, or do
- not provide a mask as described below.
-
- If a field mask is not present on update, the operation applies to
- all fields (as if a field mask of all fields has been specified).
- Note that in the presence of schema evolution, this may mean that
- fields the client does not know and has therefore not filled into
- the request will be reset to their default. If this is unwanted
- behavior, a specific service may require a client to always specify
- a field mask, producing an error if not.
-
- As with get operations, the location of the resource which
- describes the updated values in the request message depends on the
- operation kind. In any case, the effect of the field mask is
- required to be honored by the API.
-
- ## Considerations for HTTP REST
-
- The HTTP kind of an update operation which uses a field mask must
- be set to PATCH instead of PUT in order to satisfy HTTP semantics
- (PUT must only be used for full updates).
-
- # JSON Encoding of Field Masks
-
- In JSON, a field mask is encoded as a single string where paths are
- separated by a comma. Fields name in each path are converted
- to/from lower-camel naming conventions.
-
- As an example, consider the following message declarations:
-
- message Profile {
- User user = 1;
- Photo photo = 2;
- }
- message User {
- string display_name = 1;
- string address = 2;
- }
-
- In proto a field mask for `Profile` may look as such:
-
- mask {
- paths: "user.display_name"
- paths: "photo"
- }
-
- In JSON, the same mask is represented as below:
-
- {
- mask: "user.displayName,photo"
- }
-
- # Field Masks and Oneof Fields
-
- Field masks treat fields in oneofs just as regular fields. Consider the
- following message:
-
- message SampleMessage {
- oneof test_oneof {
- string name = 4;
- SubMessage sub_message = 9;
- }
- }
-
- The field mask can be:
-
- mask {
- paths: "name"
- }
-
- Or:
-
- mask {
- paths: "sub_message"
- }
-
- Note that oneof type names ("test_oneof" in this case) cannot be used in
- paths.
-
- ## Field Mask Verification
-
- The implementation of any API method which has a FieldMask type field in the
- request should verify the included field paths, and return an
- `INVALID_ARGUMENT` error if any path is unmappable.
+ 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.
+ schema:
+ type: string
+ title: referenced_schema
+ - name: metadata.schemas.tables.foreignKeys.referencedTable
+ in: query
+ description: The referenced_table is the referenced table name of a foreign key.
+ schema:
+ type: string
+ title: referenced_table
+ - name: metadata.schemas.tables.foreignKeys.referencedColumns
+ in: query
+ description: The referenced_columns are the ordered referenced columns of a foreign key.
+ schema:
+ type: array
+ items:
+ type: string
+ title: referenced_columns
+ - name: metadata.schemas.tables.foreignKeys.onDelete
+ in: query
+ description: The on_delete is the on delete action of a foreign key.
+ schema:
+ type: string
+ title: on_delete
+ - name: metadata.schemas.tables.foreignKeys.onUpdate
+ in: query
+ description: The on_update is the on update action of a foreign key.
schema:
type: string
- requestBody:
- description: |-
- The database to update.
-
- The database's `name` field is used to identify the database to update.
- Format: instances/{instance}/databases/{database} or projects/{project}/instances/{instance}/databases/{database}
- content:
- application/json:
- schema:
- title: database
- description: |-
- The database to update.
-
- The database's `name` field is used to identify the database to update.
- Format: instances/{instance}/databases/{database} or projects/{project}/instances/{instance}/databases/{database}
- $ref: '#/components/schemas/bytebase.v1.Database'
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.Database'
- /v1/projects/{project}/instances/{instance}/databases/{database}/catalog:
- get:
- tags:
- - DatabaseCatalogService
- summary: GetDatabaseCatalog
- description: |-
- Gets the catalog metadata for a database.
- Permissions required: bb.databaseCatalogs.get
- operationId: DatabaseCatalogService_GetDatabaseCatalog2
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
+ title: on_update
+ - name: metadata.schemas.tables.foreignKeys.matchType
+ in: query
+ description: |-
+ The match_type is the match type of a foreign key.
+ The match_type is the PostgreSQL specific field.
+ It's empty string for other databases.
schema:
type: string
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: match_type
+ - name: metadata.schemas.tables.partitions.name
+ in: query
+ description: The name is the name of a table partition.
schema:
type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ title: name
+ - name: metadata.schemas.tables.partitions.type
+ in: query
+ description: The type of a table partition.
+ schema:
+ title: type
+ $ref: '#/components/schemas/bytebase.v1.TablePartitionMetadata.Type'
+ - name: metadata.schemas.tables.partitions.expression
+ in: query
+ description: |-
+ 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)} }.
schema:
type: string
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.DatabaseCatalog'
- patch:
- tags:
- - DatabaseCatalogService
- summary: UpdateDatabaseCatalog
- description: |-
- Updates catalog metadata such as classifications and labels.
- Permissions required: bb.databaseCatalogs.update
- operationId: DatabaseCatalogService_UpdateDatabaseCatalog2
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
+ title: expression
+ - name: metadata.schemas.tables.partitions.value
+ in: query
+ description: |-
+ 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'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's VALUES IN clause, which is a list of comma-separated integer
+ values.
+ - For others, it's an empty string.
schema:
type: string
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: value
+ - name: metadata.schemas.tables.partitions.useDefault
+ in: query
+ description: |-
+ The use_default is whether the users use the default partition, it stores
+ the different value for different database engines. For MySQL, it's [INT]
+ type, 0 means not use default partition, otherwise, it's equals to number
+ in syntax [SUB]PARTITION {number}.
schema:
type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ title: use_default
+ - name: metadata.schemas.tables.partitions.indexes.name
+ in: query
+ description: The name is the name of an index.
schema:
type: string
- requestBody:
- description: |-
- The database catalog to update, identified by its `name` field.
- Format: instances/{instance}/databases/{database}/catalog or projects/{project}/instances/{instance}/databases/{database}/catalog
-
- Replaces the whole catalog: send the complete value, since anything omitted
- is erased. There is no `update_mask` because `schemas` is a repeated field,
- and AIP-161 forbids addressing one element of one.
- content:
- application/json:
- schema:
- title: catalog
- description: |-
- The database catalog to update, identified by its `name` field.
- Format: instances/{instance}/databases/{database}/catalog or projects/{project}/instances/{instance}/databases/{database}/catalog
-
- Replaces the whole catalog: send the complete value, since anything omitted
- is erased. There is no `update_mask` because `schemas` is a repeated field,
- and AIP-161 forbids addressing one element of one.
- $ref: '#/components/schemas/bytebase.v1.DatabaseCatalog'
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.DatabaseCatalog'
- /v1/projects/{project}/instances/{instance}/databases/{database}/changelogs:
- get:
- tags:
- - ChangelogService
- summary: ListChangelogs
- description: |-
- Lists migration history for a database.
- Permissions required: bb.changelogs.list
- operationId: ChangelogService_ListChangelogs2
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
+ title: name
+ - name: metadata.schemas.tables.partitions.indexes.expressions
+ in: query
+ description: |-
+ The expressions are the ordered columns or expressions of an index.
+ This could refer to a column or an expression.
+ schema:
+ type: array
+ items:
+ type: string
+ title: expressions
+ - name: metadata.schemas.tables.partitions.indexes.keyLength
+ in: query
+ description: |-
+ The key_lengths are the ordered key lengths of an index.
+ If the key length is not specified, it's -1.
+ schema:
+ type: array
+ items:
+ type:
+ - integer
+ - string
+ format: int64
+ title: key_length
+ - name: metadata.schemas.tables.partitions.indexes.descending
+ in: query
+ description: The descending is the ordered descending of an index.
+ schema:
+ type: array
+ items:
+ type: boolean
+ title: descending
+ - name: metadata.schemas.tables.partitions.indexes.type
+ in: query
+ description: The type is the type of an index.
+ schema:
+ type: string
+ title: type
+ - name: metadata.schemas.tables.partitions.indexes.unique
+ in: query
+ description: The unique is whether the index is unique.
+ schema:
+ type: boolean
+ title: unique
+ - name: metadata.schemas.tables.partitions.indexes.primary
+ in: query
+ description: The primary is whether the index is a primary key index.
+ schema:
+ type: boolean
+ title: primary
+ - name: metadata.schemas.tables.partitions.indexes.visible
+ in: query
+ description: The visible is whether the index is visible.
+ schema:
+ type: boolean
+ title: visible
+ - name: metadata.schemas.tables.partitions.indexes.comment
+ in: query
+ description: The comment is the comment of an index.
+ schema:
+ type: string
+ title: comment
+ - name: metadata.schemas.tables.partitions.indexes.definition
+ in: query
+ description: The definition of an index.
+ schema:
+ type: string
+ title: definition
+ - name: metadata.schemas.tables.partitions.indexes.parentIndexSchema
+ in: query
+ description: The schema name of the parent index.
+ schema:
+ type: string
+ title: parent_index_schema
+ - name: metadata.schemas.tables.partitions.indexes.parentIndexName
+ in: query
+ description: The index name of the parent index.
+ schema:
+ type: string
+ title: parent_index_name
+ - name: metadata.schemas.tables.partitions.indexes.granularity
+ in: query
+ description: The number of granules in the block. It's a ClickHouse specific field.
+ schema:
+ type:
+ - integer
+ - string
+ title: granularity
+ format: int64
+ - name: metadata.schemas.tables.partitions.indexes.isConstraint
+ in: query
+ description: |-
+ It's a PostgreSQL specific field.
+ The unique constraint and unique index are not the same thing in PostgreSQL.
+ schema:
+ type: boolean
+ title: is_constraint
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.method
+ in: query
+ description: Spatial indexing method (e.g., "SPATIAL", "R-TREE", "GIST")
schema:
type: string
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: method
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.tessellation.scheme
+ in: query
+ description: Tessellation scheme (e.g., "GEOMETRY_GRID", "GEOGRAPHY_GRID", "GEOMETRY_AUTO_GRID")
schema:
type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ title: scheme
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.tessellation.gridLevels.level
+ in: query
+ description: Grid level number (1-4 for SQL Server)
+ schema:
+ type: integer
+ title: level
+ format: int32
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.tessellation.gridLevels.density
+ in: query
+ description: Grid density (LOW, MEDIUM, HIGH)
schema:
type: string
- - name: pageSize
+ title: density
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.tessellation.cellsPerObject
in: query
- description: |-
- The maximum number of changelogs to return. The service may return fewer
- than this value. If unspecified, at most 10 changelogs will be returned.
- The maximum value is 1000; values above 1000 will be coerced to 1000.
+ description: Number of cells per object (1-8192 for SQL Server)
schema:
type: integer
- title: page_size
+ title: cells_per_object
format: int32
- - name: pageToken
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.tessellation.boundingBox.xmin
in: query
- description: |-
- A page token, received from the previous call.
- Provide this to retrieve the subsequent page.
-
- When paginating, all other parameters provided must match
- the call that provided the page token.
+ description: Minimum X coordinate
schema:
- type: string
- title: page_token
- - name: view
+ type: number
+ title: xmin
+ format: double
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.tessellation.boundingBox.ymin
in: query
+ description: Minimum Y coordinate
schema:
- title: view
- $ref: '#/components/schemas/bytebase.v1.ChangelogView'
- - name: filter
+ type: number
+ title: ymin
+ format: double
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.tessellation.boundingBox.xmax
in: query
- description: |-
- Filter is used to filter changelogs returned in the list.
- The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
-
- Supported filter:
- - status: the changelog status, support "==" operation. check Changelog.Status for available values.
- - has_schema_snapshot: filters to changelogs with a schema snapshot; only "has_schema_snapshot == true" is supported.
- - create_time: the changelog create time in RFC 3339 format, supports ">=", "<=", or "<" operator.
-
- Example:
- status == "DONE"
- status == "FAILED"
- has_schema_snapshot == true && create_time < "2024-01-02T00:00:00Z"
+ description: Maximum X coordinate
schema:
- type: string
- title: filter
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.ListChangelogsResponse'
- /v1/projects/{project}/instances/{instance}/databases/{database}/changelogs/{changelog}:
- get:
- tags:
- - ChangelogService
- summary: GetChangelog
- description: |-
- Retrieves a specific changelog entry.
- Permissions required: bb.changelogs.get
- operationId: ChangelogService_GetChangelog2
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
+ type: number
+ title: xmax
+ format: double
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.tessellation.boundingBox.ymax
+ in: query
+ description: Maximum Y coordinate
schema:
- type: string
- - name: instance
- in: path
- description: The instance id.
- required: true
+ type: number
+ title: ymax
+ format: double
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.fillfactor
+ in: query
+ description: Fill factor percentage (1-100)
+ schema:
+ type: integer
+ title: fillfactor
+ format: int32
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.buffering
+ in: query
+ description: Buffering mode for PostgreSQL (auto, on, off)
schema:
type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ title: buffering
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.tablespace
+ in: query
+ description: Tablespace configuration for Oracle
schema:
type: string
- - name: changelog
- in: path
- description: The changelog id.
- required: true
+ title: tablespace
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.workTablespace
+ in: query
schema:
type: string
- - name: view
+ title: work_tablespace
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.sdoLevel
in: query
schema:
- title: view
- $ref: '#/components/schemas/bytebase.v1.ChangelogView'
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.Changelog'
- /v1/projects/{project}/instances/{instance}/databases/{database}/changelogs/{changelog}:diffSchema:
- post:
- tags:
- - DatabaseService
- summary: DiffSchema
- description: |-
- Compares and generates migration statements between two schemas.
- Permissions required: bb.databases.get
- operationId: DatabaseService_DiffSchema4
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
+ type: integer
+ title: sdo_level
+ format: int32
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.commitInterval
+ in: query
schema:
- type: string
- - name: instance
- in: path
- description: The instance id.
- required: true
+ type: integer
+ title: commit_interval
+ format: int32
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.padIndex
+ in: query
+ description: SQL Server specific parameters
schema:
- type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ type: boolean
+ title: pad_index
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.sortInTempdb
+ in: query
+ description: ON, OFF
schema:
type: string
- - name: changelog
- in: path
- description: The changelog id.
- required: true
+ title: sort_in_tempdb
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.dropExisting
+ in: query
+ schema:
+ type: boolean
+ title: drop_existing
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.online
+ in: query
+ schema:
+ type: boolean
+ title: online
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.allowRowLocks
+ in: query
+ schema:
+ type: boolean
+ title: allow_row_locks
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.allowPageLocks
+ in: query
+ schema:
+ type: boolean
+ title: allow_page_locks
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.maxdop
+ in: query
+ schema:
+ type: integer
+ title: maxdop
+ format: int32
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.storage.dataCompression
+ in: query
+ description: NONE, ROW, PAGE
schema:
type: string
- requestBody:
- content:
- application/json:
- schema:
- type: object
- allOf:
- - {}
- - oneOf:
- - type: object
- properties:
- changelog:
- type: string
- title: changelog
- description: |-
- The resource name of the changelog
- Format:
- instances/{instance}/databases/{database}/changelogs/{changelog} or projects/{project}/instances/{instance}/databases/{database}/changelogs/{changelog}
- title: changelog
- required:
- - changelog
- - type: object
- properties:
- schema:
- type: string
- title: schema
- description: The target schema.
- title: schema
- required:
- - schema
- title: DiffSchemaRequest
- additionalProperties: false
- required: true
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.DiffSchemaResponse'
- /v1/projects/{project}/instances/{instance}/databases/{database}/metadata:
- get:
- tags:
- - DatabaseService
- summary: GetDatabaseMetadata
- description: |-
- Retrieves database metadata including tables, columns, and indexes.
- Permissions required: bb.databases.getSchema
- operationId: DatabaseService_GetDatabaseMetadata2
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
+ title: data_compression
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.dimensional.dimensions
+ in: query
+ description: Number of dimensions (2-4, default 2)
+ schema:
+ type: integer
+ title: dimensions
+ format: int32
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.dimensional.dataType
+ in: query
+ description: Spatial data type (GEOMETRY, GEOGRAPHY, POINT, POLYGON, etc.)
schema:
type: string
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: data_type
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.dimensional.srid
+ in: query
+ description: Spatial reference system identifier (SRID)
schema:
- type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ type: integer
+ title: srid
+ format: int32
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.dimensional.constraints.dimension
+ in: query
+ description: Dimension name/type (X, Y, Z, M, etc.)
schema:
type: string
- - name: filter
+ title: dimension
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.dimensional.constraints.minValue
+ in: query
+ description: Minimum value for this dimension
+ schema:
+ type: number
+ title: min_value
+ format: double
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.dimensional.constraints.maxValue
+ in: query
+ description: Maximum value for this dimension
+ schema:
+ type: number
+ title: max_value
+ format: double
+ - name: metadata.schemas.tables.partitions.indexes.spatialConfig.dimensional.constraints.tolerance
+ in: query
+ description: Tolerance for this dimension
+ schema:
+ type: number
+ title: tolerance
+ format: double
+ - name: metadata.schemas.tables.partitions.indexes.opclassNames
in: query
description: |-
- Filter is used to filter databases returned in the list.
- The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
-
- Supported filter:
- - schema: the schema name, support "==" operator.
- - table: the table name, support "==" and ".contains()" operator.
-
- For example:
- schema == "schema-a"
- table == "table-a"
- table.contains("table-a")
- schema == "schema-a" && table.contains("sample")
- The filter is used to search for tables containing "sample" in the schema "schemas/schema-a".
- The column masking level will only be returned when a table filter is used.
+ https://www.postgresql.org/docs/current/catalog-pg-opclass.html
+ Name of the operator class for each column. (PostgreSQL specific).
+ schema:
+ type: array
+ items:
+ type: string
+ title: opclass_names
+ - name: metadata.schemas.tables.partitions.indexes.opclassDefaults
+ in: query
+ description: True if the operator class is the default. (PostgreSQL specific).
+ schema:
+ type: array
+ items:
+ type: boolean
+ title: opclass_defaults
+ - name: metadata.schemas.tables.partitions.checkConstraints.name
+ in: query
+ description: The name is the name of a check constraint.
schema:
type: string
- title: filter
- - name: limit
+ title: name
+ - name: metadata.schemas.tables.partitions.checkConstraints.expression
in: query
- description: |-
- Limit the response size of returned table metadata per schema.
- For example, if the database has 3 schemas, and each schema has 100 tables,
- if limit is 20, then only 20 tables will be returned for each schema, total 60 tables.
- Default 0, means no limit.
+ description: The expression is the expression of a check constraint.
schema:
- type: integer
- title: limit
- format: int32
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.DatabaseMetadata'
- /v1/projects/{project}/instances/{instance}/databases/{database}/revisions:
- get:
- tags:
- - RevisionService
- summary: ListRevisions
- description: |-
- Lists schema revisions for a database.
- Permissions required: bb.revisions.list
- operationId: RevisionService_ListRevisions2
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
+ type: string
+ title: expression
+ - name: metadata.schemas.tables.checkConstraints.name
+ in: query
+ description: The name is the name of a check constraint.
schema:
type: string
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: name
+ - name: metadata.schemas.tables.checkConstraints.expression
+ in: query
+ description: The expression is the expression of a check constraint.
schema:
type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ title: expression
+ - name: metadata.schemas.tables.owner
+ in: query
+ description: The owner of the table.
schema:
type: string
- - name: pageSize
+ title: owner
+ - name: metadata.schemas.tables.sortingKeys
in: query
description: |-
- The maximum number of revisions to return. The service may return fewer
- than this value. If unspecified, at most 10 revisions will be returned. The
- maximum value is 1000; values above 1000 will be coerced to 1000.
+ 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
schema:
- type: integer
- title: page_size
- format: int32
- - name: pageToken
+ type: array
+ items:
+ type: string
+ title: sorting_keys
+ - name: metadata.schemas.tables.triggers.name
+ in: query
+ description: The name is the name of the trigger.
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.tables.triggers.event
in: query
description: |-
- A page token, received from a previous `ListRevisions` call.
- Provide this to retrieve the subsequent page.
-
- When paginating, all other parameters provided to `ListRevisions` must
- match the call that provided the page token.
+ The event is the event of the trigger, such as INSERT, UPDATE, DELETE,
+ TRUNCATE.
schema:
type: string
- title: page_token
- - name: showDeleted
+ title: event
+ - name: metadata.schemas.tables.triggers.timing
in: query
- description: Whether to include deleted revisions in the results.
+ description: The timing is the timing of the trigger, such as BEFORE, AFTER.
schema:
- type: boolean
- title: show_deleted
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.ListRevisionsResponse'
- /v1/projects/{project}/instances/{instance}/databases/{database}/revisions/{revision}:
- get:
- tags:
- - RevisionService
- summary: GetRevision
- description: |-
- Retrieves a schema revision by name.
- Permissions required: bb.revisions.get
- operationId: RevisionService_GetRevision2
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
+ type: string
+ title: timing
+ - name: metadata.schemas.tables.triggers.body
+ in: query
+ description: The body is the body of the trigger.
schema:
type: string
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: body
+ - name: metadata.schemas.tables.triggers.sqlMode
+ in: query
+ description: The SQL mode setting for the trigger.
schema:
type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ title: sql_mode
+ - name: metadata.schemas.tables.triggers.characterSetClient
+ in: query
+ description: The character set used by the client creating the trigger.
schema:
type: string
- - name: revision
- in: path
- description: The revision id.
- required: true
+ title: character_set_client
+ - name: metadata.schemas.tables.triggers.collationConnection
+ in: query
+ description: The collation used for the connection when creating the trigger.
schema:
type: string
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.Revision'
- delete:
- tags:
- - RevisionService
- summary: DeleteRevision
- description: |-
- Deletes a schema revision.
- Permissions required: bb.revisions.delete
- operationId: RevisionService_DeleteRevision2
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
+ title: collation_connection
+ - name: metadata.schemas.tables.triggers.comment
+ in: query
+ description: The comment describing the trigger.
+ schema:
+ type: string
+ title: comment
+ - name: metadata.schemas.tables.triggers.skipDump
+ in: query
+ description: Whether to skip this trigger during schema dump operations.
+ schema:
+ type: boolean
+ title: skip_dump
+ - name: metadata.schemas.tables.skipDump
+ in: query
+ description: Whether to skip this table during schema dump operations.
+ schema:
+ type: boolean
+ title: skip_dump
+ - name: metadata.schemas.tables.shardingInfo
+ in: query
+ description: https://docs.pingcap.com/tidb/stable/information-schema-tables/
+ schema:
+ type: string
+ title: sharding_info
+ - name: metadata.schemas.tables.primaryKeyType
+ in: query
+ description: |-
+ https://docs.pingcap.com/tidb/stable/clustered-indexes/#clustered-indexes
+ CLUSTERED or NONCLUSTERED.
schema:
type: string
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: primary_key_type
+ - name: metadata.schemas.externalTables.name
+ in: query
+ description: The name is the name of a external table.
schema:
type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ title: name
+ - name: metadata.schemas.externalTables.externalServerName
+ in: query
+ description: The external_server_name is the name of the external server.
schema:
type: string
- - name: revision
- in: path
- description: The revision id.
- required: true
+ title: external_server_name
+ - name: metadata.schemas.externalTables.externalDatabaseName
+ in: query
+ description: The external_database_name is the name of the external database.
schema:
type: string
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/google.protobuf.Empty'
- /v1/projects/{project}/instances/{instance}/databases/{database}/revisions:batchCreate:
- post:
- tags:
- - RevisionService
- summary: BatchCreateRevisions
- description: |-
- Creates multiple schema revisions in a single operation.
- Permissions required: bb.revisions.create
- operationId: RevisionService_BatchCreateRevisions2
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
+ title: external_database_name
+ - name: metadata.schemas.externalTables.columns.name
+ in: query
+ description: The name is the name of a column.
schema:
type: string
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: name
+ - name: metadata.schemas.externalTables.columns.position
+ in: query
+ description: The position is the position in columns.
+ schema:
+ type: integer
+ title: position
+ format: int32
+ - name: metadata.schemas.externalTables.columns.hasDefault
+ in: query
+ schema:
+ type: boolean
+ title: has_default
+ - name: metadata.schemas.externalTables.columns.default
+ in: query
+ description: The default value of column.
schema:
type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ title: default
+ - name: metadata.schemas.externalTables.columns.defaultOnNull
+ in: query
+ description: |-
+ Oracle specific metadata.
+ The default_on_null is the default on null of a column.
+ schema:
+ type: boolean
+ title: default_on_null
+ - name: metadata.schemas.externalTables.columns.onUpdate
+ in: query
+ description: |-
+ The on_update is the on update action of a column.
+ For MySQL like databases, it's only supported for TIMESTAMP columns with
+ CURRENT_TIMESTAMP as on update value.
schema:
type: string
- requestBody:
- content:
- application/json:
- schema:
- type: object
- properties:
- requests:
- type: array
- items:
- $ref: '#/components/schemas/bytebase.v1.CreateRevisionRequest'
- title: requests
- description: |-
- The request message specifying the revisions to create.
- A maximum of 100 revisions can be created in a batch.
- title: BatchCreateRevisionsRequest
- required:
- - requests
- additionalProperties: false
- required: true
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.BatchCreateRevisionsResponse'
- /v1/projects/{project}/instances/{instance}/databases/{database}/schema:
- get:
- tags:
- - DatabaseService
- summary: GetDatabaseSchema
- description: |-
- Retrieves database schema as DDL statements.
- Permissions required: bb.databases.getSchema
- operationId: DatabaseService_GetDatabaseSchema2
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
+ title: on_update
+ - name: metadata.schemas.externalTables.columns.nullable
+ in: query
+ description: The nullable is the nullable of a column.
+ schema:
+ type: boolean
+ title: nullable
+ - name: metadata.schemas.externalTables.columns.type
+ in: query
+ description: The type is the type of a column.
schema:
type: string
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: type
+ - name: metadata.schemas.externalTables.columns.characterSet
+ in: query
+ description: The character_set is the character_set of a column.
schema:
type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ title: character_set
+ - name: metadata.schemas.externalTables.columns.collation
+ in: query
+ description: The collation is the collation of a column.
schema:
type: string
- responses:
- "200":
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/bytebase.v1.DatabaseSchema'
- /v1/projects/{project}/instances/{instance}/databases/{database}/schemaString:
- get:
- tags:
- - DatabaseService
- summary: GetSchemaString
- description: |-
- Generates schema DDL for a database object.
- Permissions required: bb.databases.getSchema
- operationId: DatabaseService_GetSchemaString2
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
+ title: collation
+ - name: metadata.schemas.externalTables.columns.comment
+ in: query
+ description: The comment is the comment of a column.
schema:
type: string
- - name: instance
- in: path
- description: The instance id.
- required: true
+ title: comment
+ - name: metadata.schemas.externalTables.columns.generation.type
+ in: query
+ schema:
+ title: type
+ $ref: '#/components/schemas/bytebase.v1.GenerationMetadata.Type'
+ - name: metadata.schemas.externalTables.columns.generation.expression
+ in: query
schema:
type: string
- - name: database
- in: path
- description: The database id.
- required: true
+ title: expression
+ - name: metadata.schemas.externalTables.columns.isIdentity
+ in: query
+ schema:
+ type: boolean
+ title: is_identity
+ - name: metadata.schemas.externalTables.columns.identityGeneration
+ in: query
+ description: The identity_generation is for identity columns, PG only.
+ schema:
+ title: identity_generation
+ $ref: '#/components/schemas/bytebase.v1.ColumnMetadata.IdentityGeneration'
+ - name: metadata.schemas.externalTables.columns.identitySeed
+ in: query
+ description: The identity_seed is for identity columns, MSSQL only.
+ schema:
+ type:
+ - integer
+ - string
+ title: identity_seed
+ format: int64
+ - name: metadata.schemas.externalTables.columns.identityIncrement
+ in: query
+ description: The identity_increment is for identity columns, MSSQL only.
+ schema:
+ type:
+ - integer
+ - string
+ title: identity_increment
+ format: int64
+ - name: metadata.schemas.externalTables.columns.defaultConstraintName
+ in: query
+ description: |-
+ The default_constraint_name is the name of the default constraint, MSSQL only.
+ In MSSQL, default values are implemented as named constraints. When modifying or
+ dropping a column's default value, you must reference the constraint by name.
+ This field stores the actual constraint name from the database.
+
+ Example: A column definition like:
+ CREATE TABLE employees (
+ status NVARCHAR(20) DEFAULT 'active'
+ )
+
+ Will create a constraint with an auto-generated name like 'DF__employees__statu__3B75D760'
+ or a user-defined name if specified:
+ ALTER TABLE employees ADD CONSTRAINT DF_employees_status DEFAULT 'active' FOR status
+
+ To modify the default, you must first drop the existing constraint by name:
+ ALTER TABLE employees DROP CONSTRAINT DF__employees__statu__3B75D760
+ ALTER TABLE employees ADD CONSTRAINT DF_employees_status DEFAULT 'inactive' FOR status
+
+ This field is populated when syncing from the database. When empty (e.g., when parsing
+ from SQL files), the system cannot automatically drop the constraint.
schema:
type: string
- - name: type
+ title: default_constraint_name
+ - name: metadata.schemas.externalTables.columns.srid
+ in: query
+ description: |-
+ The spatial reference system identifier of a spatial column, MySQL 8.0 only.
+ Unset means the column declares no SRID; presence carries the explicit SRID,
+ including the valid SRID 0. SRS_IDs are unsigned 32-bit (custom SRSs may exceed
+ int32).
+ schema:
+ type: integer
+ title: srid
+ - name: metadata.schemas.externalTables.columns.isInvisible
in: query
+ description: Whether the column is invisible (hidden from SELECT *), MySQL 8.0.23+ only.
schema:
- title: type
- $ref: '#/components/schemas/bytebase.v1.GetSchemaStringRequest.ObjectType'
- - name: schema
+ type: boolean
+ title: is_invisible
+ - name: metadata.schemas.views.name
+ in: query
+ description: The name is the name of a view.
+ schema:
+ type: string
+ title: name
+ - name: metadata.schemas.views.definition
in: query
- description: It's empty for DATABASE.
+ description: The definition is the definition of a view.
schema:
type: string
- title: schema
- - name: object
+ title: definition
+ - name: metadata.schemas.views.comment
in: query
- description: It's empty for DATABASE and SCHEMA.
+ description: The comment is the comment of a view.
schema:
type: string
- title: object
- - name: metadata.name
+ title: comment
+ - name: metadata.schemas.views.dependencyColumns.schema
in: query
- description: |-
- The database metadata name.
-
- Format: instances/{instance}/databases/{database}/metadata or projects/{project}/instances/{instance}/databases/{database}/metadata
+ description: The schema is the schema of a reference column.
schema:
type: string
- title: name
- - name: metadata.schemas.name
+ title: schema
+ - name: metadata.schemas.views.dependencyColumns.table
in: query
- description: |-
- The name is the schema name.
- It is an empty string for databases without such concept such as MySQL.
+ description: The table is the table of a reference column.
schema:
type: string
- title: name
- - name: metadata.schemas.tables.name
+ title: table
+ - name: metadata.schemas.views.dependencyColumns.column
in: query
- description: The name is the name of a table.
+ description: The column is the name of a reference column.
schema:
type: string
- title: name
- - name: metadata.schemas.tables.columns.name
+ title: column
+ - name: metadata.schemas.views.columns.name
in: query
description: The name is the name of a column.
schema:
type: string
title: name
- - name: metadata.schemas.tables.columns.position
+ - name: metadata.schemas.views.columns.position
in: query
description: The position is the position in columns.
schema:
type: integer
title: position
format: int32
- - name: metadata.schemas.tables.columns.hasDefault
+ - name: metadata.schemas.views.columns.hasDefault
in: query
schema:
type: boolean
title: has_default
- - name: metadata.schemas.tables.columns.default
+ - name: metadata.schemas.views.columns.default
in: query
description: The default value of column.
schema:
type: string
title: default
- - name: metadata.schemas.tables.columns.defaultOnNull
+ - name: metadata.schemas.views.columns.defaultOnNull
in: query
description: |-
Oracle specific metadata.
@@ -8320,7 +10661,7 @@ paths:
schema:
type: boolean
title: default_on_null
- - name: metadata.schemas.tables.columns.onUpdate
+ - name: metadata.schemas.views.columns.onUpdate
in: query
description: |-
The on_update is the on update action of a column.
@@ -8329,58 +10670,58 @@ paths:
schema:
type: string
title: on_update
- - name: metadata.schemas.tables.columns.nullable
+ - name: metadata.schemas.views.columns.nullable
in: query
description: The nullable is the nullable of a column.
schema:
type: boolean
title: nullable
- - name: metadata.schemas.tables.columns.type
+ - name: metadata.schemas.views.columns.type
in: query
description: The type is the type of a column.
schema:
type: string
title: type
- - name: metadata.schemas.tables.columns.characterSet
+ - name: metadata.schemas.views.columns.characterSet
in: query
description: The character_set is the character_set of a column.
schema:
type: string
title: character_set
- - name: metadata.schemas.tables.columns.collation
+ - name: metadata.schemas.views.columns.collation
in: query
description: The collation is the collation of a column.
schema:
type: string
title: collation
- - name: metadata.schemas.tables.columns.comment
+ - name: metadata.schemas.views.columns.comment
in: query
description: The comment is the comment of a column.
schema:
type: string
title: comment
- - name: metadata.schemas.tables.columns.generation.type
+ - name: metadata.schemas.views.columns.generation.type
in: query
schema:
title: type
$ref: '#/components/schemas/bytebase.v1.GenerationMetadata.Type'
- - name: metadata.schemas.tables.columns.generation.expression
+ - name: metadata.schemas.views.columns.generation.expression
in: query
schema:
type: string
title: expression
- - name: metadata.schemas.tables.columns.isIdentity
+ - name: metadata.schemas.views.columns.isIdentity
in: query
schema:
type: boolean
title: is_identity
- - name: metadata.schemas.tables.columns.identityGeneration
+ - name: metadata.schemas.views.columns.identityGeneration
in: query
description: The identity_generation is for identity columns, PG only.
schema:
title: identity_generation
$ref: '#/components/schemas/bytebase.v1.ColumnMetadata.IdentityGeneration'
- - name: metadata.schemas.tables.columns.identitySeed
+ - name: metadata.schemas.views.columns.identitySeed
in: query
description: The identity_seed is for identity columns, MSSQL only.
schema:
@@ -8389,7 +10730,7 @@ paths:
- string
title: identity_seed
format: int64
- - name: metadata.schemas.tables.columns.identityIncrement
+ - name: metadata.schemas.views.columns.identityIncrement
in: query
description: The identity_increment is for identity columns, MSSQL only.
schema:
@@ -8398,7 +10739,7 @@ paths:
- string
title: identity_increment
format: int64
- - name: metadata.schemas.tables.columns.defaultConstraintName
+ - name: metadata.schemas.views.columns.defaultConstraintName
in: query
description: |-
The default_constraint_name is the name of the default constraint, MSSQL only.
@@ -8424,7 +10765,7 @@ paths:
schema:
type: string
title: default_constraint_name
- - name: metadata.schemas.tables.columns.srid
+ - name: metadata.schemas.views.columns.srid
in: query
description: |-
The spatial reference system identifier of a spatial column, MySQL 8.0 only.
@@ -8434,529 +10775,343 @@ paths:
schema:
type: integer
title: srid
- - name: metadata.schemas.tables.columns.isInvisible
+ - name: metadata.schemas.views.columns.isInvisible
in: query
description: Whether the column is invisible (hidden from SELECT *), MySQL 8.0.23+ only.
schema:
type: boolean
title: is_invisible
- - name: metadata.schemas.tables.indexes.name
+ - name: metadata.schemas.views.triggers.name
in: query
- description: The name is the name of an index.
+ description: The name is the name of the trigger.
schema:
type: string
title: name
- - name: metadata.schemas.tables.indexes.expressions
- in: query
- description: |-
- The expressions are the ordered columns or expressions of an index.
- This could refer to a column or an expression.
- schema:
- type: array
- items:
- type: string
- title: expressions
- - name: metadata.schemas.tables.indexes.keyLength
+ - name: metadata.schemas.views.triggers.event
in: query
description: |-
- The key_lengths are the ordered key lengths of an index.
- If the key length is not specified, it's -1.
- schema:
- type: array
- items:
- type:
- - integer
- - string
- format: int64
- title: key_length
- - name: metadata.schemas.tables.indexes.descending
- in: query
- description: The descending is the ordered descending of an index.
- schema:
- type: array
- items:
- type: boolean
- title: descending
- - name: metadata.schemas.tables.indexes.type
- in: query
- description: The type is the type of an index.
- schema:
- type: string
- title: type
- - name: metadata.schemas.tables.indexes.unique
- in: query
- description: The unique is whether the index is unique.
- schema:
- type: boolean
- title: unique
- - name: metadata.schemas.tables.indexes.primary
- in: query
- description: The primary is whether the index is a primary key index.
- schema:
- type: boolean
- title: primary
- - name: metadata.schemas.tables.indexes.visible
- in: query
- description: The visible is whether the index is visible.
- schema:
- type: boolean
- title: visible
- - name: metadata.schemas.tables.indexes.comment
- in: query
- description: The comment is the comment of an index.
+ The event is the event of the trigger, such as INSERT, UPDATE, DELETE,
+ TRUNCATE.
schema:
type: string
- title: comment
- - name: metadata.schemas.tables.indexes.definition
+ title: event
+ - name: metadata.schemas.views.triggers.timing
in: query
- description: The definition of an index.
+ description: The timing is the timing of the trigger, such as BEFORE, AFTER.
schema:
type: string
- title: definition
- - name: metadata.schemas.tables.indexes.parentIndexSchema
+ title: timing
+ - name: metadata.schemas.views.triggers.body
in: query
- description: The schema name of the parent index.
+ description: The body is the body of the trigger.
schema:
type: string
- title: parent_index_schema
- - name: metadata.schemas.tables.indexes.parentIndexName
+ title: body
+ - name: metadata.schemas.views.triggers.sqlMode
in: query
- description: The index name of the parent index.
+ description: The SQL mode setting for the trigger.
schema:
type: string
- title: parent_index_name
- - name: metadata.schemas.tables.indexes.granularity
- in: query
- description: The number of granules in the block. It's a ClickHouse specific field.
- schema:
- type:
- - integer
- - string
- title: granularity
- format: int64
- - name: metadata.schemas.tables.indexes.isConstraint
- in: query
- description: |-
- It's a PostgreSQL specific field.
- The unique constraint and unique index are not the same thing in PostgreSQL.
- schema:
- type: boolean
- title: is_constraint
- - name: metadata.schemas.tables.indexes.spatialConfig.method
+ title: sql_mode
+ - name: metadata.schemas.views.triggers.characterSetClient
in: query
- description: Spatial indexing method (e.g., "SPATIAL", "R-TREE", "GIST")
+ description: The character set used by the client creating the trigger.
schema:
type: string
- title: method
- - name: metadata.schemas.tables.indexes.spatialConfig.tessellation.scheme
+ title: character_set_client
+ - name: metadata.schemas.views.triggers.collationConnection
in: query
- description: Tessellation scheme (e.g., "GEOMETRY_GRID", "GEOGRAPHY_GRID", "GEOMETRY_AUTO_GRID")
+ description: The collation used for the connection when creating the trigger.
schema:
type: string
- title: scheme
- - name: metadata.schemas.tables.indexes.spatialConfig.tessellation.gridLevels.level
- in: query
- description: Grid level number (1-4 for SQL Server)
- schema:
- type: integer
- title: level
- format: int32
- - name: metadata.schemas.tables.indexes.spatialConfig.tessellation.gridLevels.density
+ title: collation_connection
+ - name: metadata.schemas.views.triggers.comment
in: query
- description: Grid density (LOW, MEDIUM, HIGH)
+ description: The comment describing the trigger.
schema:
type: string
- title: density
- - name: metadata.schemas.tables.indexes.spatialConfig.tessellation.cellsPerObject
- in: query
- description: Number of cells per object (1-8192 for SQL Server)
- schema:
- type: integer
- title: cells_per_object
- format: int32
- - name: metadata.schemas.tables.indexes.spatialConfig.tessellation.boundingBox.xmin
- in: query
- description: Minimum X coordinate
- schema:
- type: number
- title: xmin
- format: double
- - name: metadata.schemas.tables.indexes.spatialConfig.tessellation.boundingBox.ymin
- in: query
- description: Minimum Y coordinate
- schema:
- type: number
- title: ymin
- format: double
- - name: metadata.schemas.tables.indexes.spatialConfig.tessellation.boundingBox.xmax
- in: query
- description: Maximum X coordinate
- schema:
- type: number
- title: xmax
- format: double
- - name: metadata.schemas.tables.indexes.spatialConfig.tessellation.boundingBox.ymax
+ title: comment
+ - name: metadata.schemas.views.triggers.skipDump
in: query
- description: Maximum Y coordinate
+ description: Whether to skip this trigger during schema dump operations.
schema:
- type: number
- title: ymax
- format: double
- - name: metadata.schemas.tables.indexes.spatialConfig.storage.fillfactor
+ type: boolean
+ title: skip_dump
+ - name: metadata.schemas.views.skipDump
in: query
- description: Fill factor percentage (1-100)
schema:
- type: integer
- title: fillfactor
- format: int32
- - name: metadata.schemas.tables.indexes.spatialConfig.storage.buffering
+ type: boolean
+ title: skip_dump
+ - name: metadata.schemas.functions.name
in: query
- description: Buffering mode for PostgreSQL (auto, on, off)
+ description: The name is the name of a function.
schema:
type: string
- title: buffering
- - name: metadata.schemas.tables.indexes.spatialConfig.storage.tablespace
+ title: name
+ - name: metadata.schemas.functions.definition
in: query
- description: Tablespace configuration for Oracle
+ description: The definition is the definition of a function.
schema:
type: string
- title: tablespace
- - name: metadata.schemas.tables.indexes.spatialConfig.storage.workTablespace
+ title: definition
+ - name: metadata.schemas.functions.signature
in: query
+ description: |-
+ The signature is the name with the number and type of input arguments the
+ function takes.
schema:
type: string
- title: work_tablespace
- - name: metadata.schemas.tables.indexes.spatialConfig.storage.sdoLevel
- in: query
- schema:
- type: integer
- title: sdo_level
- format: int32
- - name: metadata.schemas.tables.indexes.spatialConfig.storage.commitInterval
- in: query
- schema:
- type: integer
- title: commit_interval
- format: int32
- - name: metadata.schemas.tables.indexes.spatialConfig.storage.padIndex
- in: query
- description: SQL Server specific parameters
- schema:
- type: boolean
- title: pad_index
- - name: metadata.schemas.tables.indexes.spatialConfig.storage.sortInTempdb
+ title: signature
+ - name: metadata.schemas.functions.characterSetClient
in: query
- description: ON, OFF
+ description: MySQL specific metadata.
schema:
type: string
- title: sort_in_tempdb
- - name: metadata.schemas.tables.indexes.spatialConfig.storage.dropExisting
+ title: character_set_client
+ - name: metadata.schemas.functions.collationConnection
in: query
schema:
- type: boolean
- title: drop_existing
- - name: metadata.schemas.tables.indexes.spatialConfig.storage.online
+ type: string
+ title: collation_connection
+ - name: metadata.schemas.functions.databaseCollation
in: query
schema:
- type: boolean
- title: online
- - name: metadata.schemas.tables.indexes.spatialConfig.storage.allowRowLocks
+ type: string
+ title: database_collation
+ - name: metadata.schemas.functions.sqlMode
in: query
schema:
- type: boolean
- title: allow_row_locks
- - name: metadata.schemas.tables.indexes.spatialConfig.storage.allowPageLocks
+ type: string
+ title: sql_mode
+ - name: metadata.schemas.functions.comment
in: query
schema:
- type: boolean
- title: allow_page_locks
- - name: metadata.schemas.tables.indexes.spatialConfig.storage.maxdop
+ type: string
+ title: comment
+ - name: metadata.schemas.functions.dependencyTables.schema
in: query
+ description: The schema is the schema of a reference table.
schema:
- type: integer
- title: maxdop
- format: int32
- - name: metadata.schemas.tables.indexes.spatialConfig.storage.dataCompression
+ type: string
+ title: schema
+ - name: metadata.schemas.functions.dependencyTables.table
in: query
- description: NONE, ROW, PAGE
+ description: The table is the name of a reference table.
schema:
type: string
- title: data_compression
- - name: metadata.schemas.tables.indexes.spatialConfig.dimensional.dimensions
+ title: table
+ - name: metadata.schemas.functions.skipDump
in: query
- description: Number of dimensions (2-4, default 2)
schema:
- type: integer
- title: dimensions
- format: int32
- - name: metadata.schemas.tables.indexes.spatialConfig.dimensional.dataType
+ type: boolean
+ title: skip_dump
+ - name: metadata.schemas.procedures.name
in: query
- description: Spatial data type (GEOMETRY, GEOGRAPHY, POINT, POLYGON, etc.)
+ description: The name is the name of a procedure.
schema:
type: string
- title: data_type
- - name: metadata.schemas.tables.indexes.spatialConfig.dimensional.srid
+ title: name
+ - name: metadata.schemas.procedures.definition
in: query
- description: Spatial reference system identifier (SRID)
+ description: The definition is the definition of a procedure.
schema:
- type: integer
- title: srid
- format: int32
- - name: metadata.schemas.tables.indexes.spatialConfig.dimensional.constraints.dimension
+ type: string
+ title: definition
+ - name: metadata.schemas.procedures.signature
in: query
- description: Dimension name/type (X, Y, Z, M, etc.)
+ description: |-
+ The signature is the name with the number and type of input arguments the
+ procedure takes.
schema:
type: string
- title: dimension
- - name: metadata.schemas.tables.indexes.spatialConfig.dimensional.constraints.minValue
+ title: signature
+ - name: metadata.schemas.procedures.characterSetClient
in: query
- description: Minimum value for this dimension
+ description: MySQL specific metadata.
schema:
- type: number
- title: min_value
- format: double
- - name: metadata.schemas.tables.indexes.spatialConfig.dimensional.constraints.maxValue
+ type: string
+ title: character_set_client
+ - name: metadata.schemas.procedures.collationConnection
in: query
- description: Maximum value for this dimension
schema:
- type: number
- title: max_value
- format: double
- - name: metadata.schemas.tables.indexes.spatialConfig.dimensional.constraints.tolerance
+ type: string
+ title: collation_connection
+ - name: metadata.schemas.procedures.databaseCollation
in: query
- description: Tolerance for this dimension
schema:
- type: number
- title: tolerance
- format: double
- - name: metadata.schemas.tables.indexes.opclassNames
+ type: string
+ title: database_collation
+ - name: metadata.schemas.procedures.sqlMode
in: query
- description: |-
- https://www.postgresql.org/docs/current/catalog-pg-opclass.html
- Name of the operator class for each column. (PostgreSQL specific).
schema:
- type: array
- items:
- type: string
- title: opclass_names
- - name: metadata.schemas.tables.indexes.opclassDefaults
+ type: string
+ title: sql_mode
+ - name: metadata.schemas.procedures.comment
in: query
- description: True if the operator class is the default. (PostgreSQL specific).
+ description: The comment is the comment of a procedure.
schema:
- type: array
- items:
- type: boolean
- title: opclass_defaults
- - name: metadata.schemas.tables.engine
+ type: string
+ title: comment
+ - name: metadata.schemas.procedures.skipDump
in: query
- description: The engine is the engine of a table.
schema:
- type: string
- title: engine
- - name: metadata.schemas.tables.collation
+ type: boolean
+ title: skip_dump
+ - name: metadata.schemas.streams.name
in: query
- description: The collation is the collation of a table.
+ description: The name is the name of a stream.
schema:
type: string
- title: collation
- - name: metadata.schemas.tables.charset
+ title: name
+ - name: metadata.schemas.streams.tableName
in: query
- description: The character set of table.
+ description: The table_name is the name of the table/view that the stream is created on.
schema:
type: string
- title: charset
- - name: metadata.schemas.tables.rowCount
+ title: table_name
+ - name: metadata.schemas.streams.owner
in: query
- description: The row_count is the estimated number of rows of a table.
+ description: The owner of the stream.
schema:
- type:
- - integer
- - string
- title: row_count
- format: int64
- - name: metadata.schemas.tables.dataSize
+ type: string
+ title: owner
+ - name: metadata.schemas.streams.comment
in: query
- description: The data_size is the estimated data size of a table.
+ description: The comment of the stream.
schema:
- type:
- - integer
- - string
- title: data_size
- format: int64
- - name: metadata.schemas.tables.indexSize
+ type: string
+ title: comment
+ - name: metadata.schemas.streams.type
in: query
- description: The index_size is the estimated index size of a table.
+ description: The type of the stream.
schema:
- type:
- - integer
- - string
- title: index_size
- format: int64
- - name: metadata.schemas.tables.dataFree
+ title: type
+ $ref: '#/components/schemas/bytebase.v1.StreamMetadata.Type'
+ - name: metadata.schemas.streams.stale
in: query
- description: The data_free is the estimated free data size of a table.
+ description: Indicates whether the stream was last read before the `stale_after` time.
schema:
- type:
- - integer
- - string
- title: data_free
- format: int64
- - name: metadata.schemas.tables.createOptions
+ type: boolean
+ title: stale
+ - name: metadata.schemas.streams.mode
in: query
- description: The create_options is the create option of a table.
+ description: The mode of the stream.
schema:
- type: string
- title: create_options
- - name: metadata.schemas.tables.comment
+ title: mode
+ $ref: '#/components/schemas/bytebase.v1.StreamMetadata.Mode'
+ - name: metadata.schemas.streams.definition
in: query
- description: The comment is the comment of a table.
+ description: The definition of the stream.
schema:
type: string
- title: comment
- - name: metadata.schemas.tables.foreignKeys.name
+ title: definition
+ - name: metadata.schemas.tasks.name
in: query
- description: The name is the name of a foreign key.
+ description: The name is the name of a task.
schema:
type: string
title: name
- - name: metadata.schemas.tables.foreignKeys.columns
- in: query
- description: The columns are the ordered referencing columns of a foreign key.
- schema:
- type: array
- items:
- type: string
- title: columns
- - name: metadata.schemas.tables.foreignKeys.referencedSchema
+ - name: metadata.schemas.tasks.id
in: query
description: |-
- 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.
+ The id is the snowflake-generated id of a task.
+ Example: 01ad32a0-1bb6-5e93-0000-000000000001
schema:
type: string
- title: referenced_schema
- - name: metadata.schemas.tables.foreignKeys.referencedTable
+ title: id
+ - name: metadata.schemas.tasks.owner
in: query
- description: The referenced_table is the referenced table name of a foreign key.
+ description: The owner of the task.
schema:
type: string
- title: referenced_table
- - name: metadata.schemas.tables.foreignKeys.referencedColumns
- in: query
- description: The referenced_columns are the ordered referenced columns of a foreign key.
- schema:
- type: array
- items:
- type: string
- title: referenced_columns
- - name: metadata.schemas.tables.foreignKeys.onDelete
+ title: owner
+ - name: metadata.schemas.tasks.comment
in: query
- description: The on_delete is the on delete action of a foreign key.
+ description: The comment of the task.
schema:
type: string
- title: on_delete
- - name: metadata.schemas.tables.foreignKeys.onUpdate
+ title: comment
+ - name: metadata.schemas.tasks.warehouse
in: query
- description: The on_update is the on update action of a foreign key.
+ description: The warehouse of the task.
schema:
type: string
- title: on_update
- - name: metadata.schemas.tables.foreignKeys.matchType
+ title: warehouse
+ - name: metadata.schemas.tasks.schedule
in: query
- description: |-
- The match_type is the match type of a foreign key.
- The match_type is the PostgreSQL specific field.
- It's empty string for other databases.
+ description: The schedule interval of the task.
schema:
type: string
- title: match_type
- - name: metadata.schemas.tables.partitions.name
+ title: schedule
+ - name: metadata.schemas.tasks.predecessors
+ in: query
+ description: The predecessor tasks of the task.
+ schema:
+ type: array
+ items:
+ type: string
+ title: predecessors
+ - name: metadata.schemas.tasks.state
in: query
- description: The name is the name of a table partition.
+ description: The state of the task.
schema:
- type: string
- title: name
- - name: metadata.schemas.tables.partitions.type
+ title: state
+ $ref: '#/components/schemas/bytebase.v1.TaskMetadata.State'
+ - name: metadata.schemas.tasks.condition
in: query
- description: The type of a table partition.
+ description: The condition of the task.
schema:
- title: type
- $ref: '#/components/schemas/bytebase.v1.TablePartitionMetadata.Type'
- - name: metadata.schemas.tables.partitions.expression
+ type: string
+ title: condition
+ - name: metadata.schemas.tasks.definition
in: query
- description: |-
- 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)} }.
+ description: The definition of the task.
schema:
type: string
- title: expression
- - name: metadata.schemas.tables.partitions.value
+ title: definition
+ - name: metadata.schemas.materializedViews.name
in: query
- description: |-
- 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'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's VALUES IN clause, which is a list of comma-separated integer
- values.
- - For others, it's an empty string.
+ description: The name is the name of a materialized view.
schema:
type: string
- title: value
- - name: metadata.schemas.tables.partitions.useDefault
+ title: name
+ - name: metadata.schemas.materializedViews.definition
in: query
- description: |-
- The use_default is whether the users use the default partition, it stores
- the different value for different database engines. For MySQL, it's [INT]
- type, 0 means not use default partition, otherwise, it's equals to number
- in syntax [SUB]PARTITION {number}.
+ description: The definition is the definition of a materialized view.
schema:
type: string
- title: use_default
- - name: metadata.schemas.tables.partitions.subpartitions.checkConstraints.name
+ title: definition
+ - name: metadata.schemas.materializedViews.comment
in: query
- description: The name is the name of a check constraint.
+ description: The comment is the comment of a materialized view.
schema:
type: string
- title: name
- - name: metadata.schemas.tables.partitions.subpartitions.checkConstraints.expression
+ title: comment
+ - name: metadata.schemas.materializedViews.dependencyColumns.schema
in: query
- description: The expression is the expression of a check constraint.
+ description: The schema is the schema of a reference column.
schema:
type: string
- title: expression
- - name: metadata.schemas.tables.owner
+ title: schema
+ - name: metadata.schemas.materializedViews.dependencyColumns.table
in: query
- description: The owner of the table.
+ description: The table is the table of a reference column.
schema:
type: string
- title: owner
- - name: metadata.schemas.tables.sortingKeys
+ title: table
+ - name: metadata.schemas.materializedViews.dependencyColumns.column
in: query
- description: |-
- 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
+ description: The column is the name of a reference column.
schema:
- type: array
- items:
- type: string
- title: sorting_keys
- - name: metadata.schemas.tables.triggers.name
+ type: string
+ title: column
+ - name: metadata.schemas.materializedViews.triggers.name
in: query
description: The name is the name of the trigger.
schema:
type: string
title: name
- - name: metadata.schemas.tables.triggers.event
+ - name: metadata.schemas.materializedViews.triggers.event
in: query
description: |-
The event is the event of the trigger, such as INSERT, UPDATE, DELETE,
@@ -8964,372 +11119,355 @@ paths:
schema:
type: string
title: event
- - name: metadata.schemas.tables.triggers.timing
+ - name: metadata.schemas.materializedViews.triggers.timing
in: query
description: The timing is the timing of the trigger, such as BEFORE, AFTER.
schema:
type: string
title: timing
- - name: metadata.schemas.tables.triggers.body
+ - name: metadata.schemas.materializedViews.triggers.body
in: query
description: The body is the body of the trigger.
schema:
type: string
title: body
- - name: metadata.schemas.tables.triggers.sqlMode
+ - name: metadata.schemas.materializedViews.triggers.sqlMode
in: query
description: The SQL mode setting for the trigger.
schema:
type: string
title: sql_mode
- - name: metadata.schemas.tables.triggers.characterSetClient
+ - name: metadata.schemas.materializedViews.triggers.characterSetClient
in: query
description: The character set used by the client creating the trigger.
schema:
type: string
title: character_set_client
- - name: metadata.schemas.tables.triggers.collationConnection
+ - name: metadata.schemas.materializedViews.triggers.collationConnection
in: query
description: The collation used for the connection when creating the trigger.
schema:
type: string
title: collation_connection
- - name: metadata.schemas.tables.triggers.comment
+ - name: metadata.schemas.materializedViews.triggers.comment
in: query
description: The comment describing the trigger.
schema:
type: string
title: comment
- - name: metadata.schemas.tables.triggers.skipDump
+ - name: metadata.schemas.materializedViews.triggers.skipDump
in: query
description: Whether to skip this trigger during schema dump operations.
schema:
type: boolean
title: skip_dump
- - name: metadata.schemas.tables.skipDump
- in: query
- description: Whether to skip this table during schema dump operations.
- schema:
- type: boolean
- title: skip_dump
- - name: metadata.schemas.tables.shardingInfo
- in: query
- description: https://docs.pingcap.com/tidb/stable/information-schema-tables/
- schema:
- type: string
- title: sharding_info
- - name: metadata.schemas.tables.primaryKeyType
- in: query
- description: |-
- https://docs.pingcap.com/tidb/stable/clustered-indexes/#clustered-indexes
- CLUSTERED or NONCLUSTERED.
- schema:
- type: string
- title: primary_key_type
- - name: metadata.schemas.externalTables.name
+ - name: metadata.schemas.materializedViews.indexes.name
in: query
- description: The name is the name of a external table.
+ description: The name is the name of an index.
schema:
type: string
title: name
- - name: metadata.schemas.externalTables.externalServerName
- in: query
- description: The external_server_name is the name of the external server.
- schema:
- type: string
- title: external_server_name
- - name: metadata.schemas.externalTables.externalDatabaseName
- in: query
- description: The external_database_name is the name of the external database.
- schema:
- type: string
- title: external_database_name
- - name: metadata.schemas.views.name
+ - name: metadata.schemas.materializedViews.indexes.expressions
in: query
- description: The name is the name of a view.
+ description: |-
+ The expressions are the ordered columns or expressions of an index.
+ This could refer to a column or an expression.
schema:
- type: string
- title: name
- - name: metadata.schemas.views.definition
+ type: array
+ items:
+ type: string
+ title: expressions
+ - name: metadata.schemas.materializedViews.indexes.keyLength
in: query
- description: The definition is the definition of a view.
+ description: |-
+ The key_lengths are the ordered key lengths of an index.
+ If the key length is not specified, it's -1.
schema:
- type: string
- title: definition
- - name: metadata.schemas.views.comment
+ type: array
+ items:
+ type:
+ - integer
+ - string
+ format: int64
+ title: key_length
+ - name: metadata.schemas.materializedViews.indexes.descending
in: query
- description: The comment is the comment of a view.
+ description: The descending is the ordered descending of an index.
schema:
- type: string
- title: comment
- - name: metadata.schemas.views.dependencyColumns.schema
+ type: array
+ items:
+ type: boolean
+ title: descending
+ - name: metadata.schemas.materializedViews.indexes.type
in: query
- description: The schema is the schema of a reference column.
+ description: The type is the type of an index.
schema:
type: string
- title: schema
- - name: metadata.schemas.views.dependencyColumns.table
+ title: type
+ - name: metadata.schemas.materializedViews.indexes.unique
in: query
- description: The table is the table of a reference column.
+ description: The unique is whether the index is unique.
schema:
- type: string
- title: table
- - name: metadata.schemas.views.dependencyColumns.column
+ type: boolean
+ title: unique
+ - name: metadata.schemas.materializedViews.indexes.primary
in: query
- description: The column is the name of a reference column.
+ description: The primary is whether the index is a primary key index.
schema:
- type: string
- title: column
- - name: metadata.schemas.views.skipDump
+ type: boolean
+ title: primary
+ - name: metadata.schemas.materializedViews.indexes.visible
in: query
+ description: The visible is whether the index is visible.
schema:
type: boolean
- title: skip_dump
- - name: metadata.schemas.functions.name
+ title: visible
+ - name: metadata.schemas.materializedViews.indexes.comment
in: query
- description: The name is the name of a function.
+ description: The comment is the comment of an index.
schema:
type: string
- title: name
- - name: metadata.schemas.functions.definition
+ title: comment
+ - name: metadata.schemas.materializedViews.indexes.definition
in: query
- description: The definition is the definition of a function.
+ description: The definition of an index.
schema:
type: string
title: definition
- - name: metadata.schemas.functions.signature
- in: query
- description: |-
- The signature is the name with the number and type of input arguments the
- function takes.
- schema:
- type: string
- title: signature
- - name: metadata.schemas.functions.characterSetClient
- in: query
- description: MySQL specific metadata.
- schema:
- type: string
- title: character_set_client
- - name: metadata.schemas.functions.collationConnection
- in: query
- schema:
- type: string
- title: collation_connection
- - name: metadata.schemas.functions.databaseCollation
- in: query
- schema:
- type: string
- title: database_collation
- - name: metadata.schemas.functions.sqlMode
- in: query
- schema:
- type: string
- title: sql_mode
- - name: metadata.schemas.functions.comment
+ - name: metadata.schemas.materializedViews.indexes.parentIndexSchema
in: query
+ description: The schema name of the parent index.
schema:
type: string
- title: comment
- - name: metadata.schemas.functions.dependencyTables.schema
+ title: parent_index_schema
+ - name: metadata.schemas.materializedViews.indexes.parentIndexName
in: query
- description: The schema is the schema of a reference table.
+ description: The index name of the parent index.
schema:
type: string
- title: schema
- - name: metadata.schemas.functions.dependencyTables.table
+ title: parent_index_name
+ - name: metadata.schemas.materializedViews.indexes.granularity
in: query
- description: The table is the name of a reference table.
+ description: The number of granules in the block. It's a ClickHouse specific field.
schema:
- type: string
- title: table
- - name: metadata.schemas.functions.skipDump
+ type:
+ - integer
+ - string
+ title: granularity
+ format: int64
+ - name: metadata.schemas.materializedViews.indexes.isConstraint
in: query
+ description: |-
+ It's a PostgreSQL specific field.
+ The unique constraint and unique index are not the same thing in PostgreSQL.
schema:
type: boolean
- title: skip_dump
- - name: metadata.schemas.procedures.name
+ title: is_constraint
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.method
in: query
- description: The name is the name of a procedure.
+ description: Spatial indexing method (e.g., "SPATIAL", "R-TREE", "GIST")
schema:
type: string
- title: name
- - name: metadata.schemas.procedures.definition
+ title: method
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.tessellation.scheme
in: query
- description: The definition is the definition of a procedure.
+ description: Tessellation scheme (e.g., "GEOMETRY_GRID", "GEOGRAPHY_GRID", "GEOMETRY_AUTO_GRID")
schema:
type: string
- title: definition
- - name: metadata.schemas.procedures.signature
+ title: scheme
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.tessellation.gridLevels.level
in: query
- description: |-
- The signature is the name with the number and type of input arguments the
- procedure takes.
+ description: Grid level number (1-4 for SQL Server)
schema:
- type: string
- title: signature
- - name: metadata.schemas.procedures.characterSetClient
+ type: integer
+ title: level
+ format: int32
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.tessellation.gridLevels.density
in: query
- description: MySQL specific metadata.
+ description: Grid density (LOW, MEDIUM, HIGH)
schema:
type: string
- title: character_set_client
- - name: metadata.schemas.procedures.collationConnection
+ title: density
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.tessellation.cellsPerObject
in: query
+ description: Number of cells per object (1-8192 for SQL Server)
schema:
- type: string
- title: collation_connection
- - name: metadata.schemas.procedures.databaseCollation
+ type: integer
+ title: cells_per_object
+ format: int32
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.tessellation.boundingBox.xmin
in: query
+ description: Minimum X coordinate
schema:
- type: string
- title: database_collation
- - name: metadata.schemas.procedures.sqlMode
+ type: number
+ title: xmin
+ format: double
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.tessellation.boundingBox.ymin
in: query
+ description: Minimum Y coordinate
schema:
- type: string
- title: sql_mode
- - name: metadata.schemas.procedures.comment
+ type: number
+ title: ymin
+ format: double
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.tessellation.boundingBox.xmax
in: query
- description: The comment is the comment of a procedure.
+ description: Maximum X coordinate
schema:
- type: string
- title: comment
- - name: metadata.schemas.procedures.skipDump
+ type: number
+ title: xmax
+ format: double
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.tessellation.boundingBox.ymax
in: query
+ description: Maximum Y coordinate
schema:
- type: boolean
- title: skip_dump
- - name: metadata.schemas.streams.name
+ type: number
+ title: ymax
+ format: double
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.fillfactor
in: query
- description: The name is the name of a stream.
+ description: Fill factor percentage (1-100)
schema:
- type: string
- title: name
- - name: metadata.schemas.streams.tableName
+ type: integer
+ title: fillfactor
+ format: int32
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.buffering
in: query
- description: The table_name is the name of the table/view that the stream is created on.
+ description: Buffering mode for PostgreSQL (auto, on, off)
schema:
type: string
- title: table_name
- - name: metadata.schemas.streams.owner
+ title: buffering
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.tablespace
in: query
- description: The owner of the stream.
+ description: Tablespace configuration for Oracle
schema:
type: string
- title: owner
- - name: metadata.schemas.streams.comment
+ title: tablespace
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.workTablespace
in: query
- description: The comment of the stream.
schema:
type: string
- title: comment
- - name: metadata.schemas.streams.type
+ title: work_tablespace
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.sdoLevel
in: query
- description: The type of the stream.
schema:
- title: type
- $ref: '#/components/schemas/bytebase.v1.StreamMetadata.Type'
- - name: metadata.schemas.streams.stale
+ type: integer
+ title: sdo_level
+ format: int32
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.commitInterval
in: query
- description: Indicates whether the stream was last read before the `stale_after` time.
schema:
- type: boolean
- title: stale
- - name: metadata.schemas.streams.mode
+ type: integer
+ title: commit_interval
+ format: int32
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.padIndex
in: query
- description: The mode of the stream.
+ description: SQL Server specific parameters
schema:
- title: mode
- $ref: '#/components/schemas/bytebase.v1.StreamMetadata.Mode'
- - name: metadata.schemas.streams.definition
+ type: boolean
+ title: pad_index
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.sortInTempdb
in: query
- description: The definition of the stream.
+ description: ON, OFF
schema:
type: string
- title: definition
- - name: metadata.schemas.tasks.name
+ title: sort_in_tempdb
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.dropExisting
in: query
- description: The name is the name of a task.
schema:
- type: string
- title: name
- - name: metadata.schemas.tasks.id
+ type: boolean
+ title: drop_existing
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.online
in: query
- description: |-
- The id is the snowflake-generated id of a task.
- Example: 01ad32a0-1bb6-5e93-0000-000000000001
schema:
- type: string
- title: id
- - name: metadata.schemas.tasks.owner
+ type: boolean
+ title: online
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.allowRowLocks
in: query
- description: The owner of the task.
schema:
- type: string
- title: owner
- - name: metadata.schemas.tasks.comment
+ type: boolean
+ title: allow_row_locks
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.allowPageLocks
in: query
- description: The comment of the task.
schema:
- type: string
- title: comment
- - name: metadata.schemas.tasks.warehouse
+ type: boolean
+ title: allow_page_locks
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.maxdop
in: query
- description: The warehouse of the task.
schema:
- type: string
- title: warehouse
- - name: metadata.schemas.tasks.schedule
+ type: integer
+ title: maxdop
+ format: int32
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.storage.dataCompression
in: query
- description: The schedule interval of the task.
+ description: NONE, ROW, PAGE
schema:
type: string
- title: schedule
- - name: metadata.schemas.tasks.predecessors
+ title: data_compression
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.dimensional.dimensions
in: query
- description: The predecessor tasks of the task.
+ description: Number of dimensions (2-4, default 2)
schema:
- type: array
- items:
- type: string
- title: predecessors
- - name: metadata.schemas.tasks.state
+ type: integer
+ title: dimensions
+ format: int32
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.dimensional.dataType
in: query
- description: The state of the task.
+ description: Spatial data type (GEOMETRY, GEOGRAPHY, POINT, POLYGON, etc.)
schema:
- title: state
- $ref: '#/components/schemas/bytebase.v1.TaskMetadata.State'
- - name: metadata.schemas.tasks.condition
+ type: string
+ title: data_type
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.dimensional.srid
in: query
- description: The condition of the task.
+ description: Spatial reference system identifier (SRID)
schema:
- type: string
- title: condition
- - name: metadata.schemas.tasks.definition
+ type: integer
+ title: srid
+ format: int32
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.dimensional.constraints.dimension
in: query
- description: The definition of the task.
+ description: Dimension name/type (X, Y, Z, M, etc.)
schema:
type: string
- title: definition
- - name: metadata.schemas.materializedViews.name
+ title: dimension
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.dimensional.constraints.minValue
in: query
- description: The name is the name of a materialized view.
+ description: Minimum value for this dimension
schema:
- type: string
- title: name
- - name: metadata.schemas.materializedViews.definition
+ type: number
+ title: min_value
+ format: double
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.dimensional.constraints.maxValue
in: query
- description: The definition is the definition of a materialized view.
+ description: Maximum value for this dimension
schema:
- type: string
- title: definition
- - name: metadata.schemas.materializedViews.comment
+ type: number
+ title: max_value
+ format: double
+ - name: metadata.schemas.materializedViews.indexes.spatialConfig.dimensional.constraints.tolerance
in: query
- description: The comment is the comment of a materialized view.
+ description: Tolerance for this dimension
schema:
- type: string
- title: comment
+ type: number
+ title: tolerance
+ format: double
+ - name: metadata.schemas.materializedViews.indexes.opclassNames
+ in: query
+ description: |-
+ https://www.postgresql.org/docs/current/catalog-pg-opclass.html
+ Name of the operator class for each column. (PostgreSQL specific).
+ schema:
+ type: array
+ items:
+ type: string
+ title: opclass_names
+ - name: metadata.schemas.materializedViews.indexes.opclassDefaults
+ in: query
+ description: True if the operator class is the default. (PostgreSQL specific).
+ schema:
+ type: array
+ items:
+ type: boolean
+ title: opclass_defaults
- name: metadata.schemas.materializedViews.skipDump
in: query
schema:
@@ -9761,8 +11899,14 @@ paths:
title: schema
required:
- schema
+ - not:
+ anyOf:
+ - required:
+ - changelog
+ - required:
+ - schema
+ unevaluatedProperties: false
title: DiffSchemaRequest
- additionalProperties: false
required: true
responses:
"200":
@@ -16932,6 +19076,26 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/bytebase.v1.PurchaseResponse'
+ /v1/subscription:startTrial:
+ post:
+ tags:
+ - SubscriptionService
+ summary: StartTrial
+ description: StartTrial starts a free trial for an eligible SaaS workspace.
+ operationId: SubscriptionService_StartTrial
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.StartTrialRequest'
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.Subscription'
/v1/subscription:updatePurchase:
post:
tags:
@@ -19399,11 +21563,17 @@ components:
title: ttl
required:
- ttl
+ - not:
+ anyOf:
+ - required:
+ - expireTime
+ - required:
+ - ttl
+ unevaluatedProperties: false
title: AccessGrant
required:
- creator
- targets
- additionalProperties: false
bytebase.v1.AccessGrant.Status:
type: string
title: Status
@@ -19722,8 +21892,18 @@ components:
title: range_mask
required:
- rangeMask
+ - not:
+ anyOf:
+ - required:
+ - fullMask
+ - required:
+ - innerOuterMask
+ - required:
+ - md5Mask
+ - required:
+ - rangeMask
+ unevaluatedProperties: false
title: Algorithm
- additionalProperties: false
bytebase.v1.Algorithm.FullMask:
type: object
properties:
@@ -19933,8 +22113,22 @@ components:
title: wecom
required:
- wecom
+ - not:
+ anyOf:
+ - required:
+ - dingtalk
+ - required:
+ - feishu
+ - required:
+ - lark
+ - required:
+ - slack
+ - required:
+ - teams
+ - required:
+ - wecom
+ unevaluatedProperties: false
title: IMSetting
- additionalProperties: false
bytebase.v1.AppIMSetting.Lark:
type: object
properties:
@@ -21779,8 +23973,18 @@ components:
title: recovery_code
required:
- recoveryCode
+ - not:
+ anyOf:
+ - required:
+ - currentPassword
+ - required:
+ - emailCode
+ - required:
+ - otpCode
+ - required:
+ - recoveryCode
+ unevaluatedProperties: false
title: CredentialProof
- additionalProperties: false
description: |-
One proof that the caller currently controls a credential on the account.
Exactly one field must be set; enforced in the handler.
@@ -22126,8 +24330,16 @@ components:
title: gcp_credential
required:
- gcpCredential
+ - not:
+ anyOf:
+ - required:
+ - awsCredential
+ - required:
+ - azureCredential
+ - required:
+ - gcpCredential
+ unevaluatedProperties: false
title: DataSource
- additionalProperties: false
bytebase.v1.DataSource.AWSCredential:
type: object
properties:
@@ -22310,8 +24522,14 @@ components:
title: token
required:
- token
+ - not:
+ anyOf:
+ - required:
+ - appRole
+ - required:
+ - token
+ unevaluatedProperties: false
title: DataSourceExternalSecret
- additionalProperties: false
bytebase.v1.DataSourceExternalSecret.AppRoleAuthOption:
type: object
properties:
@@ -22947,10 +25165,16 @@ components:
title: schema
required:
- schema
+ - not:
+ anyOf:
+ - required:
+ - changelog
+ - required:
+ - schema
+ unevaluatedProperties: false
title: DiffSchemaRequest
required:
- name
- additionalProperties: false
bytebase.v1.DiffSchemaResponse:
type: object
properties:
@@ -23052,8 +25276,12 @@ components:
title: smtp
required:
- smtp
+ - not:
+ anyOf:
+ - required:
+ - smtp
+ unevaluatedProperties: false
title: EmailSetting
- additionalProperties: false
bytebase.v1.EmailSetting.SMTPConfig:
type: object
properties:
@@ -24380,8 +26608,16 @@ components:
title: oidc_config
required:
- oidcConfig
+ - not:
+ anyOf:
+ - required:
+ - ldapConfig
+ - required:
+ - oauth2Config
+ - required:
+ - oidcConfig
+ unevaluatedProperties: false
title: IdentityProviderConfig
- additionalProperties: false
bytebase.v1.IdentityProviderContext:
type: object
oneOf:
@@ -24403,8 +26639,14 @@ components:
title: oidc_context
required:
- oidcContext
+ - not:
+ anyOf:
+ - required:
+ - oauth2Context
+ - required:
+ - oidcContext
+ unevaluatedProperties: false
title: IdentityProviderContext
- additionalProperties: false
description: Context for identity provider authentication.
bytebase.v1.IdentityProviderType:
type: string
@@ -24906,8 +27148,18 @@ components:
title: review_submission
required:
- reviewSubmission
+ - not:
+ anyOf:
+ - required:
+ - approval
+ - required:
+ - issueUpdate
+ - required:
+ - planUpdate
+ - required:
+ - reviewSubmission
+ unevaluatedProperties: false
title: IssueComment
- additionalProperties: false
description: A comment on an issue.
bytebase.v1.IssueComment.Approval:
type: object
@@ -27313,8 +29565,14 @@ components:
title: struct_kind
required:
- structKind
+ - not:
+ anyOf:
+ - required:
+ - arrayKind
+ - required:
+ - structKind
+ unevaluatedProperties: false
title: ObjectSchema
- additionalProperties: false
description: Schema definition for object-type columns.
bytebase.v1.ObjectSchema.ArrayKind:
type: object
@@ -27665,8 +29923,14 @@ components:
title: create_database_config
required:
- createDatabaseConfig
+ - not:
+ anyOf:
+ - required:
+ - changeDatabaseConfig
+ - required:
+ - createDatabaseConfig
+ unevaluatedProperties: false
title: Spec
- additionalProperties: false
bytebase.v1.Plan.TaskStatusCount:
type: object
properties:
@@ -27749,8 +30013,14 @@ components:
title: sql_summary_report
required:
- sqlSummaryReport
+ - not:
+ anyOf:
+ - required:
+ - sqlReviewReport
+ - required:
+ - sqlSummaryReport
+ unevaluatedProperties: false
title: Result
- additionalProperties: false
bytebase.v1.PlanCheckRun.Result.SqlReviewReport:
type: object
properties:
@@ -27990,8 +30260,20 @@ components:
title: tag_policy
required:
- tagPolicy
+ - not:
+ anyOf:
+ - required:
+ - maskingExemptionPolicy
+ - required:
+ - maskingRulePolicy
+ - required:
+ - queryDataPolicy
+ - required:
+ - rolloutPolicy
+ - required:
+ - tagPolicy
+ unevaluatedProperties: false
title: Policy
- additionalProperties: false
bytebase.v1.PolicyDelta:
type: object
properties:
@@ -28628,8 +30910,18 @@ components:
title: syntax_error
required:
- syntaxError
+ - not:
+ anyOf:
+ - required:
+ - commandError
+ - required:
+ - permissionDenied
+ - required:
+ - postgresError
+ - required:
+ - syntaxError
+ unevaluatedProperties: false
title: QueryResult
- additionalProperties: false
bytebase.v1.QueryResult.CommandError:
type: object
properties:
@@ -29547,8 +31839,36 @@ components:
title: value_value
required:
- valueValue
+ - not:
+ anyOf:
+ - required:
+ - boolValue
+ - required:
+ - bytesValue
+ - required:
+ - doubleValue
+ - required:
+ - floatValue
+ - required:
+ - int32Value
+ - required:
+ - int64Value
+ - required:
+ - nullValue
+ - required:
+ - stringValue
+ - required:
+ - timestampTzValue
+ - required:
+ - timestampValue
+ - required:
+ - uint32Value
+ - required:
+ - uint64Value
+ - required:
+ - valueValue
+ unevaluatedProperties: false
title: RowValue
- additionalProperties: false
bytebase.v1.RowValue.Timestamp:
type: object
properties:
@@ -29638,8 +31958,12 @@ components:
title: krb_config
required:
- krbConfig
+ - not:
+ anyOf:
+ - required:
+ - krbConfig
+ unevaluatedProperties: false
title: SASLConfig
- additionalProperties: false
bytebase.v1.SQLEditorThemeSetting:
type: object
properties:
@@ -29737,8 +32061,22 @@ components:
title: string_payload
required:
- stringPayload
+ - not:
+ anyOf:
+ - required:
+ - commentConventionPayload
+ - required:
+ - namingCasePayload
+ - required:
+ - namingPayload
+ - required:
+ - numberPayload
+ - required:
+ - stringArrayPayload
+ - required:
+ - stringPayload
+ unevaluatedProperties: false
title: SQLReviewRule
- additionalProperties: false
description: SQL review rule configuration. Check the SQL_REVIEW_RULES_DOCUMENTATION.md for details.
bytebase.v1.SQLReviewRule.CommentConventionRulePayload:
type: object
@@ -30967,8 +33305,28 @@ components:
title: workspace_profile
required:
- workspaceProfile
+ - not:
+ anyOf:
+ - required:
+ - ai
+ - required:
+ - appIm
+ - required:
+ - dataClassification
+ - required:
+ - email
+ - required:
+ - environment
+ - required:
+ - mcp
+ - required:
+ - semanticType
+ - required:
+ - workspaceApproval
+ - required:
+ - workspaceProfile
+ unevaluatedProperties: false
title: SettingValue
- additionalProperties: false
description: The data in setting value.
bytebase.v1.Sheet:
type: object
@@ -31119,6 +33477,10 @@ components:
$ref: '#/components/schemas/google.protobuf.Timestamp'
title: StartMFAEnrollmentResponse
additionalProperties: false
+ bytebase.v1.StartTrialRequest:
+ type: object
+ title: StartTrialRequest
+ additionalProperties: false
bytebase.v1.State:
type: string
title: State
@@ -31489,8 +33851,14 @@ components:
title: object_schema
required:
- objectSchema
+ - not:
+ anyOf:
+ - required:
+ - columns
+ - required:
+ - objectSchema
+ unevaluatedProperties: false
title: TableCatalog
- additionalProperties: false
description: Table metadata within a schema.
bytebase.v1.TableCatalog.Columns:
type: object
@@ -31799,8 +34167,14 @@ components:
title: database_update
required:
- databaseUpdate
+ - not:
+ anyOf:
+ - required:
+ - databaseCreate
+ - required:
+ - databaseUpdate
+ unevaluatedProperties: false
title: Task
- additionalProperties: false
bytebase.v1.Task.DatabaseCreate:
type: object
properties:
@@ -31832,8 +34206,14 @@ components:
title: sheet
required:
- sheet
+ - not:
+ anyOf:
+ - required:
+ - release
+ - required:
+ - sheet
+ unevaluatedProperties: false
title: DatabaseUpdate
- additionalProperties: false
description: Payload for updating a database schema.
bytebase.v1.Task.Status:
type: string
@@ -31994,8 +34374,12 @@ components:
title: parallel_tasks_limit
required:
- parallelTasksLimit
+ - not:
+ anyOf:
+ - required:
+ - parallelTasksLimit
+ unevaluatedProperties: false
title: WaitingCause
- additionalProperties: false
description: Information about why a task run is waiting.
bytebase.v1.TaskRun.Status:
type: string
@@ -32371,8 +34755,12 @@ components:
title: postgres
required:
- postgres
+ - not:
+ anyOf:
+ - required:
+ - postgres
+ unevaluatedProperties: false
title: TaskRunSession
- additionalProperties: false
bytebase.v1.TaskRunSession.Postgres:
type: object
properties:
@@ -32566,8 +34954,16 @@ components:
title: oidc_context
required:
- oidcContext
+ - not:
+ anyOf:
+ - required:
+ - ldapContext
+ - required:
+ - oauth2Context
+ - required:
+ - oidcContext
+ unevaluatedProperties: false
title: TestIdentityProviderRequest
- additionalProperties: false
bytebase.v1.TestIdentityProviderResponse:
type: object
properties:
@@ -34095,8 +36491,28 @@ components:
title: uint64_value
required:
- uint64Value
+ - not:
+ anyOf:
+ - required:
+ - boolValue
+ - required:
+ - bytesValue
+ - required:
+ - doubleValue
+ - required:
+ - durationValue
+ - required:
+ - int64Value
+ - required:
+ - nullValue
+ - required:
+ - stringValue
+ - required:
+ - timestampValue
+ - required:
+ - uint64Value
+ unevaluatedProperties: false
title: Constant
- additionalProperties: false
description: |-
Represents a primitive literal.
@@ -34190,8 +36606,24 @@ components:
title: struct_expr
required:
- structExpr
+ - not:
+ anyOf:
+ - required:
+ - callExpr
+ - required:
+ - comprehensionExpr
+ - required:
+ - constExpr
+ - required:
+ - identExpr
+ - required:
+ - listExpr
+ - required:
+ - selectExpr
+ - required:
+ - structExpr
+ unevaluatedProperties: false
title: Expr
- additionalProperties: false
description: |-
An abstract representation of a common expression.
@@ -34444,8 +36876,14 @@ components:
title: map_key
required:
- mapKey
+ - not:
+ anyOf:
+ - required:
+ - fieldKey
+ - required:
+ - mapKey
+ unevaluatedProperties: false
title: Entry
- additionalProperties: false
description: Represents an entry.
google.api.expr.v1alpha1.Expr.Ident:
type: object
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 3c577b8990..fd048bbc4f 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -765,6 +765,7 @@
- [PurchasePlan](#bytebase-v1-PurchasePlan)
- [PurchasePlanAdditional](#bytebase-v1-PurchasePlanAdditional)
- [PurchaseResponse](#bytebase-v1-PurchaseResponse)
+ - [StartTrialRequest](#bytebase-v1-StartTrialRequest)
- [Subscription](#bytebase-v1-Subscription)
- [UpdatePurchaseRequest](#bytebase-v1-UpdatePurchaseRequest)
- [UploadLicenseRequest](#bytebase-v1-UploadLicenseRequest)
@@ -12419,6 +12420,16 @@ PlanLimitConfig represents a single plan&#39;s configuration
+<a name="bytebase-v1-StartTrialRequest"></a>
+
+### StartTrialRequest
+
+
+
+
+
+
+
<a name="bytebase-v1-Subscription"></a>
### Subscription
@@ -12656,6 +12667,7 @@ SubscriptionService manages enterprise subscriptions and licensing.
| GetSubscription | [GetSubscriptionRequest](#bytebase-v1-GetSubscriptionRequest) | [Subscription](#bytebase-v1-Subscription) | GetSubscription returns the current subscription. If there is no license, we will return a free plan subscription without expiration time. If there is expired license, we will return a free plan subscription with the expiration time of the expired license. |
| ExportVCSProviderUsers | [ExportVCSProviderUsersRequest](#bytebase-v1-ExportVCSProviderUsersRequest) | [ExportVCSProviderUsersResponse](#bytebase-v1-ExportVCSProviderUsersResponse) | Exports active VCS users as CSV. |
| UploadLicense | [UploadLicenseRequest](#bytebase-v1-UploadLicenseRequest) | [Subscription](#bytebase-v1-Subscription) | Uploads an enterprise license (self-hosted only). |
+| StartTrial | [StartTrialRequest](#bytebase-v1-StartTrialRequest) | [Subscription](#bytebase-v1-Subscription) | StartTrial starts a free trial for an eligible SaaS workspace. |
| CreatePurchase | [CreatePurchaseRequest](#bytebase-v1-CreatePurchaseRequest) | [PurchaseResponse](#bytebase-v1-PurchaseResponse) | CreatePurchase creates a new subscription purchase (SaaS only). Returns a Stripe Checkout URL for the user to complete payment. |
| UpdatePurchase | [UpdatePurchaseRequest](#bytebase-v1-UpdatePurchaseRequest) | [PurchaseResponse](#bytebase-v1-PurchaseResponse) | UpdatePurchase updates an existing subscription (SaaS only). May return a Stripe Checkout URL if payment method change is needed. |
| CancelPurchase | [CancelPurchaseRequest](#bytebase-v1-CancelPurchaseRequest) | [PurchaseResponse](#bytebase-v1-PurchaseResponse) | CancelPurchase cancels an active subscription (SaaS only). |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 14181d75cc..e576f09a02 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -3097,6 +3097,10 @@
<a href="#bytebase.v1.PurchaseResponse"><span class="badge">M</span>PurchaseResponse</a>
</li>
+ <li>
+ <a href="#bytebase.v1.StartTrialRequest"><span class="badge">M</span>StartTrialRequest</a>
+ </li>
+
<li>
<a href="#bytebase.v1.Subscription"><span class="badge">M</span>Subscription</a>
</li>
@@ -35182,6 +35186,13 @@ If empty, the update was applied directly using the existing payment method. </p
+ <h3 id="bytebase.v1.StartTrialRequest">StartTrialRequest</h3>
+ <p></p>
+
+
+
+
+
<h3 id="bytebase.v1.Subscription">Subscription</h3>
<p></p>
@@ -35985,6 +35996,13 @@ If there is expired license, we will return a free plan subscription with the ex
<td><p>Uploads an enterprise license (self-hosted only).</p></td>
</tr>
+ <tr>
+ <td>StartTrial</td>
+ <td><a href="#bytebase.v1.StartTrialRequest">StartTrialRequest</a></td>
+ <td><a href="#bytebase.v1.Subscription">Subscription</a></td>
+ <td><p>StartTrial starts a free trial for an eligible SaaS workspace.</p></td>
+ </tr>
+
<tr>
<td>CreatePurchase</td>
<td><a href="#bytebase.v1.CreatePurchaseRequest">CreatePurchaseRequest</a></td>
@@ -36079,6 +36097,16 @@ May return a Stripe Checkout URL if payment method change is needed.</p></td>
+ <tr>
+ <td>StartTrial</td>
+ <td>POST</td>
+ <td>/v1/subscription:startTrial</td>
+ <td>*</td>
+ </tr>
+
+
+
+
<tr>
<td>CreatePurchase</td>
<td>POST</td>
diff --git a/proto/v1/v1/subscription_service.proto b/proto/v1/v1/subscription_service.proto
index 9fa56a477d..a0d4adbb6e 100644
--- a/proto/v1/v1/subscription_service.proto
+++ b/proto/v1/v1/subscription_service.proto
@@ -45,6 +45,19 @@ service SubscriptionService {
option (bytebase.v1.mcp_denial_reason) = ADMINISTERS_THE_WORKSPACE;
}
+ // StartTrial starts a free trial for an eligible SaaS workspace.
+ rpc StartTrial(StartTrialRequest) returns (Subscription) {
+ option (google.api.http) = {
+ post: "/v1/subscription:startTrial"
+ body: "*"
+ };
+ option (bytebase.v1.permission) = "bb.subscription.manage";
+ option (bytebase.v1.auth_method) = IAM;
+ option (bytebase.v1.audit) = true;
+ option (bytebase.v1.mcp_method_class) = EXCLUDED;
+ option (bytebase.v1.mcp_denial_reason) = ADMINISTERS_THE_WORKSPACE;
+ }
+
// CreatePurchase creates a new subscription purchase (SaaS only).
// Returns a Stripe Checkout URL for the user to complete payment.
rpc CreatePurchase(CreatePurchaseRequest) returns (PurchaseResponse) {
@@ -373,3 +386,5 @@ message PlanLimitConfig {
int32 maximum_seat_count = 3;
repeated PlanFeature features = 4;
}
+
+message StartTrialRequest {}