Skip to content

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

feat: get peer database from db groups (#12647)

boojack74a20b58ca27
diff --git a/backend/runner/taskrun/database_create_executor.go b/backend/runner/taskrun/database_create_executor.go
index a9f53803ad..3944403a8e 100644
--- a/backend/runner/taskrun/database_create_executor.go
+++ b/backend/runner/taskrun/database_create_executor.go
@@ -357,7 +357,7 @@ func (exec *DatabaseCreateExecutor) createInitialSchema(ctx context.Context, dri
return nil, model.Version{}, "", nil
}
- peerDatabase, schemaVersion, schema, err := exec.getSchemaFromPeerTenantDatabase(ctx, exec.store, exec.dbFactory, instance, project, database)
+ peerDatabase, schemaVersion, schema, err := exec.getSchemaFromPeerTenantDatabase(ctx, instance, project, database)
if err != nil {
return nil, model.Version{}, "", err
}
@@ -454,29 +454,43 @@ func getConnectionStatement(dbType storepb.Engine, databaseName string) (string,
// It's used for creating a database in a tenant mode project.
// When a peer tenant database doesn't exist, we will return an error if there are databases in the project with the same name.
// Otherwise, we will create a blank database without schema.
-func (*DatabaseCreateExecutor) getSchemaFromPeerTenantDatabase(ctx context.Context, stores *store.Store, dbFactory *dbfactory.DBFactory, instance *store.InstanceMessage, project *store.ProjectMessage, database *store.DatabaseMessage) (*store.DatabaseMessage, model.Version, string, error) {
- allDatabases, err := stores.ListDatabases(ctx, &store.FindDatabaseMessage{
- ProjectID: &project.ResourceID,
- Engine: &instance.Engine,
- })
+func (exec *DatabaseCreateExecutor) getSchemaFromPeerTenantDatabase(ctx context.Context, instance *store.InstanceMessage, project *store.ProjectMessage, database *store.DatabaseMessage) (*store.DatabaseMessage, model.Version, string, error) {
+ // Try to find a peer tenant database from database groups.
+ matchedDatabases, err := exec.getPeerTenantDatabasesFromDatabaseGroup(ctx, instance, project, database)
if err != nil {
- return nil, model.Version{}, "", errors.Wrapf(err, "Failed to fetch databases in project ID: %v", project.UID)
+ return nil, model.Version{}, "", errors.Wrapf(err, "Failed to fetch database groups in project ID: %v", project.UID)
+ }
+ // Otherwise, we will try to find a peer tenant database from all databases in the project.
+ // TODO(steven): remove me.
+ if len(matchedDatabases) == 0 {
+ allDatabases, err := exec.store.ListDatabases(ctx, &store.FindDatabaseMessage{
+ ProjectID: &project.ResourceID,
+ Engine: &instance.Engine,
+ })
+ if err != nil {
+ return nil, model.Version{}, "", errors.Wrapf(err, "Failed to fetch databases in project ID: %v", project.UID)
+ }
+ matchedDatabases = allDatabases
}
+
+ // Filter out the database itself.
var databases []*store.DatabaseMessage
- for _, d := range allDatabases {
+ for _, d := range matchedDatabases {
if d.UID != database.UID {
databases = append(databases, d)
}
}
+ matchedDatabases = databases
- deploymentConfig, err := stores.GetDeploymentConfigV2(ctx, project.UID)
+ // Then we will try to find a peer tenant database from deployment schedule with the matched databases.
+ deploymentConfig, err := exec.store.GetDeploymentConfigV2(ctx, project.UID)
if err != nil {
return nil, model.Version{}, "", errors.Wrapf(err, "Failed to fetch deployment config for project ID: %v", project.UID)
}
if err := utils.ValidateDeploymentSchedule(deploymentConfig.Schedule); err != nil {
return nil, model.Version{}, "", errors.Errorf("Failed to get deployment schedule")
}
- matrix, err := utils.GetDatabaseMatrixFromDeploymentSchedule(deploymentConfig.Schedule, databases)
+ matrix, err := utils.GetDatabaseMatrixFromDeploymentSchedule(deploymentConfig.Schedule, matchedDatabases)
if err != nil {
return nil, model.Version{}, "", errors.Errorf("Failed to create deployment pipeline")
}
@@ -484,17 +498,17 @@ func (*DatabaseCreateExecutor) getSchemaFromPeerTenantDatabase(ctx context.Conte
if similarDB == nil {
return nil, model.Version{}, "", nil
}
- similarDBInstance, err := stores.GetInstanceV2(ctx, &store.FindInstanceMessage{ResourceID: &similarDB.InstanceID})
+ similarDBInstance, err := exec.store.GetInstanceV2(ctx, &store.FindInstanceMessage{ResourceID: &similarDB.InstanceID})
if err != nil {
return nil, model.Version{}, "", err
}
- driver, err := dbFactory.GetAdminDatabaseDriver(ctx, similarDBInstance, similarDB, db.ConnectionContext{})
+ driver, err := exec.dbFactory.GetAdminDatabaseDriver(ctx, similarDBInstance, similarDB, db.ConnectionContext{})
if err != nil {
return nil, model.Version{}, "", err
}
defer driver.Close(ctx)
- schemaVersion, err := getLatestDoneSchemaVersion(ctx, stores, similarDBInstance.UID, similarDB.UID, similarDB.DatabaseName)
+ schemaVersion, err := getLatestDoneSchemaVersion(ctx, exec.store, similarDBInstance.UID, similarDB.UID, similarDB.DatabaseName)
if err != nil {
return nil, model.Version{}, "", errors.Wrapf(err, "failed to get migration history for database %q", similarDB.DatabaseName)
}
@@ -506,6 +520,46 @@ func (*DatabaseCreateExecutor) getSchemaFromPeerTenantDatabase(ctx context.Conte
return similarDB, schemaVersion, schemaBuf.String(), nil
}
+func (exec *DatabaseCreateExecutor) getPeerTenantDatabasesFromDatabaseGroup(ctx context.Context, instance *store.InstanceMessage, project *store.ProjectMessage, database *store.DatabaseMessage) ([]*store.DatabaseMessage, error) {
+ dbGroups, err := exec.store.ListDatabaseGroups(ctx, &store.FindDatabaseGroupMessage{ProjectUID: &project.UID})
+ if err != nil {
+ return nil, errors.Wrapf(err, "Failed to fetch database groups in project ID: %v", project.UID)
+ }
+ allDatabases, err := exec.store.ListDatabases(ctx, &store.FindDatabaseMessage{
+ ProjectID: &project.ResourceID,
+ Engine: &instance.Engine,
+ })
+ if err != nil {
+ return nil, errors.Wrapf(err, "Failed to fetch databases in project ID: %v", project.UID)
+ }
+
+ var matchedDatabases []*store.DatabaseMessage
+ for _, dbGroup := range dbGroups {
+ // TODO(steven): move this filter into FindDatabaseGroupMessage.
+ if !dbGroup.Payload.Multitenancy {
+ continue
+ }
+
+ isMatched, err := utils.CheckDatabaseGroupMatch(ctx, dbGroup, database)
+ if err != nil {
+ return nil, errors.Wrapf(err, "Failed to get matched and unmatched databases in database group %q", dbGroup.Placeholder)
+ }
+ // If current database is not matched, continue to the next database group.
+ if !isMatched {
+ continue
+ }
+
+ matchedDb, _, err := utils.GetMatchedAndUnmatchedDatabasesInDatabaseGroup(ctx, dbGroup, allDatabases)
+ if err != nil {
+ return nil, errors.Wrapf(err, "Failed to get matched and unmatched databases in database group %q", dbGroup.Placeholder)
+ }
+ if len(matchedDb) > 0 {
+ matchedDatabases = matchedDb
+ }
+ }
+ return matchedDatabases, nil
+}
+
// GetLatestDoneSchemaVersion gets the latest schema version for a database.
func getLatestDoneSchemaVersion(ctx context.Context, stores *store.Store, instanceID int, databaseID int, databaseName string) (model.Version, error) {
// TODO(d): support semantic versioning.
diff --git a/backend/store/database_group.go b/backend/store/database_group.go
index 4d53512e1f..e4fc4ff0b5 100644
--- a/backend/store/database_group.go
+++ b/backend/store/database_group.go
@@ -12,12 +12,12 @@ import (
"google.golang.org/protobuf/encoding/protojson"
"github.com/bytebase/bytebase/backend/common"
+ storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
// DatabaseGroupMessage is the message for database groups.
type DatabaseGroupMessage struct {
// Output only fields.
- //
UID int64
CreatedTs int64
UpdatedTs int64
@@ -25,11 +25,11 @@ type DatabaseGroupMessage struct {
UpdaterID int
// Normal fields.
- //
ProjectUID int
ResourceID string
Placeholder string
Expression *expr.Expr
+ Payload *storepb.DatabaseGroupPayload
}
// FindDatabaseGroupMessage is the message for finding database group.
@@ -43,6 +43,7 @@ type FindDatabaseGroupMessage struct {
type UpdateDatabaseGroupMessage struct {
Placeholder *string
Expression *expr.Expr
+ Payload *storepb.DatabaseGroupPayload
}
// DeleteDatabaseGroup deletes a database group.
@@ -139,7 +140,7 @@ func (s *Store) GetDatabaseGroup(ctx context.Context, find *FindDatabaseGroupMes
return databaseGroups[0], nil
}
-func (*Store) listDatabaseGroupImpl(ctx context.Context, tx *Tx, find *FindDatabaseGroupMessage) ([]*DatabaseGroupMessage, error) {
+func (s *Store) listDatabaseGroupImpl(ctx context.Context, tx *Tx, find *FindDatabaseGroupMessage) ([]*DatabaseGroupMessage, error) {
where, args := []string{"TRUE"}, []any{}
if v := find.ProjectUID; v != nil {
where, args = append(where, fmt.Sprintf("project_id = $%d", len(args)+1)), append(args, *v)
@@ -150,19 +151,23 @@ func (*Store) listDatabaseGroupImpl(ctx context.Context, tx *Tx, find *FindDatab
if v := find.UID; v != nil {
where, args = append(where, fmt.Sprintf("id = $%d", len(args)+1)), append(args, *v)
}
+ fields := []string{
+ "id",
+ "created_ts",
+ "updated_ts",
+ "creator_id",
+ "updater_id",
+ "project_id",
+ "resource_id",
+ "placeholder",
+ "expression",
+ }
+ // TODO(steven): remove me before production.
+ if s.profile.Mode == common.ReleaseModeDev {
+ fields = append(fields, "payload")
+ }
- query := fmt.Sprintf(`SELECT
- id,
- created_ts,
- updated_ts,
- creator_id,
- updater_id,
- project_id,
- resource_id,
- placeholder,
- expression
- FROM db_group WHERE %s ORDER BY id DESC;`, strings.Join(where, " AND "))
-
+ query := fmt.Sprintf(`SELECT %s FROM db_group WHERE %s ORDER BY id DESC;`, strings.Join(fields, ","), strings.Join(where, " AND "))
var databaseGroups []*DatabaseGroupMessage
rows, err := tx.QueryContext(ctx, query, args...)
if err != nil {
@@ -171,8 +176,8 @@ func (*Store) listDatabaseGroupImpl(ctx context.Context, tx *Tx, find *FindDatab
defer rows.Close()
for rows.Next() {
var databaseGroup DatabaseGroupMessage
- var stringExpr string
- if err := rows.Scan(
+ var exprBytes, payloadBytes []byte
+ dest := []any{
&databaseGroup.UID,
&databaseGroup.CreatedTs,
&databaseGroup.UpdatedTs,
@@ -181,14 +186,25 @@ func (*Store) listDatabaseGroupImpl(ctx context.Context, tx *Tx, find *FindDatab
&databaseGroup.ProjectUID,
&databaseGroup.ResourceID,
&databaseGroup.Placeholder,
- &stringExpr,
- ); err != nil {
+ &exprBytes,
+ }
+ if s.profile.Mode == common.ReleaseModeDev {
+ dest = append(dest, &payloadBytes)
+ }
+ if err := rows.Scan(dest...); err != nil {
return nil, errors.Wrapf(err, "failed to scan")
}
var expression expr.Expr
- if err := common.ProtojsonUnmarshaler.Unmarshal([]byte(stringExpr), &expression); err != nil {
+ if err := common.ProtojsonUnmarshaler.Unmarshal(exprBytes, &expression); err != nil {
return nil, errors.Wrapf(err, "failed to unmarshal expression")
}
+ if s.profile.Mode == common.ReleaseModeDev {
+ var payload storepb.DatabaseGroupPayload
+ if err := common.ProtojsonUnmarshaler.Unmarshal(payloadBytes, &payload); err != nil {
+ return nil, errors.Wrapf(err, "failed to unmarshal payload")
+ }
+ databaseGroup.Payload = &payload
+ }
databaseGroup.Expression = &expression
databaseGroups = append(databaseGroups, &databaseGroup)
}
diff --git a/backend/utils/utils.go b/backend/utils/utils.go
index ead1fa6071..759abe2a5c 100644
--- a/backend/utils/utils.go
+++ b/backend/utils/utils.go
@@ -658,32 +658,17 @@ func GetSecretMapFromDatabaseMessage(databaseMessage *store.DatabaseMessage) map
// GetMatchedAndUnmatchedDatabasesInDatabaseGroup returns the matched and unmatched databases in the given database group.
func GetMatchedAndUnmatchedDatabasesInDatabaseGroup(ctx context.Context, databaseGroup *store.DatabaseGroupMessage, allDatabases []*store.DatabaseMessage) ([]*store.DatabaseMessage, []*store.DatabaseMessage, error) {
- prog, err := common.ValidateGroupCELExpr(databaseGroup.Expression.Expression)
- if err != nil {
- return nil, nil, err
- }
var matches []*store.DatabaseMessage
var unmatches []*store.DatabaseMessage
// DONOT check bb.feature.database-grouping for instance. The API here is read-only in the frontend, we need to show if the instance is matched but missing required license.
// The feature guard will works during issue creation.
for _, database := range allDatabases {
- res, _, err := prog.ContextEval(ctx, map[string]any{
- "resource": map[string]any{
- "database_name": database.DatabaseName,
- "environment_name": common.FormatEnvironment(database.EffectiveEnvironmentID),
- "instance_id": database.InstanceID,
- },
- })
+ matched, err := CheckDatabaseGroupMatch(ctx, databaseGroup, database)
if err != nil {
- return nil, nil, status.Errorf(codes.Internal, err.Error())
+ return nil, nil, err
}
-
- val, err := res.ConvertToNative(reflect.TypeOf(false))
- if err != nil {
- return nil, nil, status.Errorf(codes.Internal, "expect bool result")
- }
- if boolVal, ok := val.(bool); ok && boolVal {
+ if matched {
matches = append(matches, database)
} else {
unmatches = append(unmatches, database)
@@ -692,6 +677,33 @@ func GetMatchedAndUnmatchedDatabasesInDatabaseGroup(ctx context.Context, databas
return matches, unmatches, nil
}
+func CheckDatabaseGroupMatch(ctx context.Context, databaseGroup *store.DatabaseGroupMessage, database *store.DatabaseMessage) (bool, error) {
+ prog, err := common.ValidateGroupCELExpr(databaseGroup.Expression.Expression)
+ if err != nil {
+ return false, err
+ }
+
+ res, _, err := prog.ContextEval(ctx, map[string]any{
+ "resource": map[string]any{
+ "database_name": database.DatabaseName,
+ "environment_name": common.FormatEnvironment(database.EffectiveEnvironmentID),
+ "instance_id": database.InstanceID,
+ },
+ })
+ if err != nil {
+ return false, status.Errorf(codes.Internal, err.Error())
+ }
+
+ val, err := res.ConvertToNative(reflect.TypeOf(false))
+ if err != nil {
+ return false, status.Errorf(codes.Internal, "expect bool result")
+ }
+ if boolVal, ok := val.(bool); ok && boolVal {
+ return true, nil
+ }
+ return false, nil
+}
+
func uniq[T comparable](array []T) []T {
res := make([]T, 0, len(array))
seen := make(map[T]struct{}, len(array))
diff --git a/frontend/src/types/proto/google/protobuf/descriptor.ts b/frontend/src/types/proto/google/protobuf/descriptor.ts
index 3185d3cbac..f12b30a9e2 100644
--- a/frontend/src/types/proto/google/protobuf/descriptor.ts
+++ b/frontend/src/types/proto/google/protobuf/descriptor.ts
@@ -8,6 +8,11 @@ export const protobufPackage = "google.protobuf";
export enum Edition {
/** EDITION_UNKNOWN - A placeholder for an unknown edition value. */
EDITION_UNKNOWN = "EDITION_UNKNOWN",
+ /**
+ * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature
+ * was first introduced. This is effectively an "infinite past".
+ */
+ EDITION_LEGACY = "EDITION_LEGACY",
/**
* EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like
* distinct editions. These can't be used to specify the edition of proto
@@ -22,6 +27,7 @@ export enum Edition {
* comparison.
*/
EDITION_2023 = "EDITION_2023",
+ EDITION_2024 = "EDITION_2024",
/**
* EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be
* used or relyed on outside of tests.
@@ -31,6 +37,12 @@ export enum Edition {
EDITION_99997_TEST_ONLY = "EDITION_99997_TEST_ONLY",
EDITION_99998_TEST_ONLY = "EDITION_99998_TEST_ONLY",
EDITION_99999_TEST_ONLY = "EDITION_99999_TEST_ONLY",
+ /**
+ * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only
+ * ever be used by plugins that can expect to never require any changes to
+ * support a new edition.
+ */
+ EDITION_MAX = "EDITION_MAX",
UNRECOGNIZED = "UNRECOGNIZED",
}
@@ -39,6 +51,9 @@ export function editionFromJSON(object: any): Edition {
case 0:
case "EDITION_UNKNOWN":
return Edition.EDITION_UNKNOWN;
+ case 900:
+ case "EDITION_LEGACY":
+ return Edition.EDITION_LEGACY;
case 998:
case "EDITION_PROTO2":
return Edition.EDITION_PROTO2;
@@ -48,6 +63,9 @@ export function editionFromJSON(object: any): Edition {
case 1000:
case "EDITION_2023":
return Edition.EDITION_2023;
+ case 1001:
+ case "EDITION_2024":
+ return Edition.EDITION_2024;
case 1:
case "EDITION_1_TEST_ONLY":
return Edition.EDITION_1_TEST_ONLY;
@@ -63,6 +81,9 @@ export function editionFromJSON(object: any): Edition {
case 99999:
case "EDITION_99999_TEST_ONLY":
return Edition.EDITION_99999_TEST_ONLY;
+ case 2147483647:
+ case "EDITION_MAX":
+ return Edition.EDITION_MAX;
case -1:
case "UNRECOGNIZED":
default:
@@ -74,12 +95,16 @@ export function editionToJSON(object: Edition): string {
switch (object) {
case Edition.EDITION_UNKNOWN:
return "EDITION_UNKNOWN";
+ case Edition.EDITION_LEGACY:
+ return "EDITION_LEGACY";
case Edition.EDITION_PROTO2:
return "EDITION_PROTO2";
case Edition.EDITION_PROTO3:
return "EDITION_PROTO3";
case Edition.EDITION_2023:
return "EDITION_2023";
+ case Edition.EDITION_2024:
+ return "EDITION_2024";
case Edition.EDITION_1_TEST_ONLY:
return "EDITION_1_TEST_ONLY";
case Edition.EDITION_2_TEST_ONLY:
@@ -90,6 +115,8 @@ export function editionToJSON(object: Edition): string {
return "EDITION_99998_TEST_ONLY";
case Edition.EDITION_99999_TEST_ONLY:
return "EDITION_99999_TEST_ONLY";
+ case Edition.EDITION_MAX:
+ return "EDITION_MAX";
case Edition.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
@@ -100,12 +127,16 @@ export function editionToNumber(object: Edition): number {
switch (object) {
case Edition.EDITION_UNKNOWN:
return 0;
+ case Edition.EDITION_LEGACY:
+ return 900;
case Edition.EDITION_PROTO2:
return 998;
case Edition.EDITION_PROTO3:
return 999;
case Edition.EDITION_2023:
return 1000;
+ case Edition.EDITION_2024:
+ return 1001;
case Edition.EDITION_1_TEST_ONLY:
return 1;
case Edition.EDITION_2_TEST_ONLY:
@@ -116,6 +147,8 @@ export function editionToNumber(object: Edition): number {
return 99998;
case Edition.EDITION_99999_TEST_ONLY:
return 99999;
+ case Edition.EDITION_MAX:
+ return 2147483647;
case Edition.UNRECOGNIZED:
default:
return -1;
@@ -357,12 +390,12 @@ export interface FieldDescriptorProto {
* If true, this is a proto3 "optional". When a proto3 field is optional, it
* tracks presence regardless of field type.
*
- * When proto3_optional is true, this field must be belong to a oneof to
- * signal to old proto3 clients that presence is tracked for this field. This
- * oneof is known as a "synthetic" oneof, and this field must be its sole
- * member (each proto3 optional field gets its own synthetic oneof). Synthetic
- * oneofs exist in the descriptor only, and do not generate any API. Synthetic
- * oneofs must be ordered after all "real" oneofs.
+ * When proto3_optional is true, this field must belong to a oneof to signal
+ * to old proto3 clients that presence is tracked for this field. This oneof
+ * is known as a "synthetic" oneof, and this field must be its sole member
+ * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs
+ * exist in the descriptor only, and do not generate any API. Synthetic oneofs
+ * must be ordered after all "real" oneofs.
*
* For message fields, proto3_optional doesn't create any semantic change,
* since non-repeated message fields always track presence. However it still
@@ -739,12 +772,16 @@ export interface FileOptions {
*/
javaGenerateEqualsAndHash: boolean;
/**
- * If set true, then the Java2 code generator will generate code that
- * throws an exception whenever an attempt is made to assign a non-UTF-8
- * byte sequence to a string field.
- * Message reflection will do the same.
- * However, an extension field still accepts non-UTF-8 byte sequences.
- * This option has no effect on when used with the lite runtime.
+ * A proto2 file can set this to true to opt in to UTF-8 checking for Java,
+ * which will throw an exception if invalid UTF-8 is parsed from the wire or
+ * assigned to a string field.
+ *
+ * TODO: clarify exactly what kinds of field types this option
+ * applies to, and update these docs accordingly.
+ *
+ * Proto3 files already perform these checks. Setting the option explicitly to
+ * false has no effect: it cannot be used to opt proto3 files out of UTF-8
+ * checks.
*/
javaStringCheckUtf8: boolean;
optimizeFor: FileOptions_OptimizeMode;
@@ -771,7 +808,6 @@ export interface FileOptions {
ccGenericServices: boolean;
javaGenericServices: boolean;
pyGenericServices: boolean;
- phpGenericServices: boolean;
/**
* Is this file deprecated?
* Depending on the target platform, this can emit Deprecated annotations
@@ -925,10 +961,6 @@ export interface MessageOptions {
*/
deprecated: boolean;
/**
- * NOTE: Do not set the option in .proto files. Always use the maps syntax
- * instead. The option should only be implicitly set by the proto compiler
- * parser.
- *
* Whether the message is an automatically generated map entry type for the
* maps field.
*
@@ -946,6 +978,10 @@ export interface MessageOptions {
* use a native map in the target language to hold the keys and values.
* The reflection APIs in such implementations still need to work as
* if the field is a repeated message field.
+ *
+ * NOTE: Do not set the option in .proto files. Always use the maps syntax
+ * instead. The option should only be implicitly set by the proto compiler
+ * parser.
*/
mapEntry: boolean;
/**
@@ -1023,19 +1059,11 @@ export interface FieldOptions {
* call from multiple threads concurrently, while non-const methods continue
* to require exclusive access.
*
- * Note that implementations may choose not to check required fields within
- * a lazy sub-message. That is, calling IsInitialized() on the outer message
- * may return true even if the inner message has missing required fields.
- * This is necessary because otherwise the inner message would have to be
- * parsed in order to perform the check, defeating the purpose of lazy
- * parsing. An implementation which chooses not to check required fields
- * must be consistent about it. That is, for any particular sub-message, the
- * implementation must either *always* check its required fields, or *never*
- * check its required fields, regardless of whether or not the message has
- * been parsed.
- *
- * As of May 2022, lazy verifies the contents of the byte stream during
- * parsing. An invalid byte stream will cause the overall parsing to fail.
+ * Note that lazy message fields are still eagerly verified to check
+ * ill-formed wireformat or missing required fields. Calling IsInitialized()
+ * on the outer message would fail if the inner message has missing required
+ * fields. Failed verification would result in parsing failure (except when
+ * uninitialized messages are acceptable).
*/
lazy: boolean;
/**
@@ -1062,8 +1090,9 @@ export interface FieldOptions {
targets: FieldOptions_OptionTargetType[];
editionDefaults: FieldOptions_EditionDefault[];
/** Any features defined in the specific edition. */
- features:
- | FeatureSet
+ features: FeatureSet | undefined;
+ featureSupport:
+ | FieldOptions_FeatureSupport
| undefined;
/** The parser stores options it doesn't recognize here. See above. */
uninterpretedOption: UninterpretedOption[];
@@ -1366,6 +1395,32 @@ export interface FieldOptions_EditionDefault {
value: string;
}
+/** Information about the support window of a feature. */
+export interface FieldOptions_FeatureSupport {
+ /**
+ * The edition that this feature was first available in. In editions
+ * earlier than this one, the default assigned to EDITION_LEGACY will be
+ * used, and proto files will not be able to override it.
+ */
+ editionIntroduced: Edition;
+ /**
+ * The edition this feature becomes deprecated in. Using this after this
+ * edition may trigger warnings.
+ */
+ editionDeprecated: Edition;
+ /**
+ * The deprecation warning text if this feature is used after the edition it
+ * was marked deprecated in.
+ */
+ deprecationWarning: string;
+ /**
+ * The edition this feature is no longer available in. In editions after
+ * this one, the last default assigned will be used, and proto files will
+ * not be able to override it.
+ */
+ editionRemoved: Edition;
+}
+
export interface OneofOptions {
/** Any features defined in the specific edition. */
features:
@@ -1425,6 +1480,10 @@ export interface EnumValueOptions {
* credentials.
*/
debugRedact: boolean;
+ /** Information about the support window of a feature value. */
+ featureSupport:
+ | FieldOptions_FeatureSupport
+ | undefined;
/** The parser stores options it doesn't recognize here. See above. */
uninterpretedOption: UninterpretedOption[];
}
@@ -1742,8 +1801,8 @@ export function featureSet_RepeatedFieldEncodingToNumber(object: FeatureSet_Repe
export enum FeatureSet_Utf8Validation {
UTF8_VALIDATION_UNKNOWN = "UTF8_VALIDATION_UNKNOWN",
- NONE = "NONE",
VERIFY = "VERIFY",
+ NONE = "NONE",
UNRECOGNIZED = "UNRECOGNIZED",
}
@@ -1752,12 +1811,12 @@ export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8V
case 0:
case "UTF8_VALIDATION_UNKNOWN":
return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN;
- case 1:
- case "NONE":
- return FeatureSet_Utf8Validation.NONE;
case 2:
case "VERIFY":
return FeatureSet_Utf8Validation.VERIFY;
+ case 3:
+ case "NONE":
+ return FeatureSet_Utf8Validation.NONE;
case -1:
case "UNRECOGNIZED":
default:
@@ -1769,10 +1828,10 @@ export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validatio
switch (object) {
case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN:
return "UTF8_VALIDATION_UNKNOWN";
- case FeatureSet_Utf8Validation.NONE:
- return "NONE";
case FeatureSet_Utf8Validation.VERIFY:
return "VERIFY";
+ case FeatureSet_Utf8Validation.NONE:
+ return "NONE";
case FeatureSet_Utf8Validation.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
@@ -1783,10 +1842,10 @@ export function featureSet_Utf8ValidationToNumber(object: FeatureSet_Utf8Validat
switch (object) {
case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN:
return 0;
- case FeatureSet_Utf8Validation.NONE:
- return 1;
case FeatureSet_Utf8Validation.VERIFY:
return 2;
+ case FeatureSet_Utf8Validation.NONE:
+ return 3;
case FeatureSet_Utf8Validation.UNRECOGNIZED:
default:
return -1;
@@ -1927,7 +1986,12 @@ export interface FeatureSetDefaults {
*/
export interface FeatureSetDefaults_FeatureSetEditionDefault {
edition: Edition;
- features: FeatureSet | undefined;
+ /** Defaults of features that can be overridden in this edition. */
+ overridableFeatures:
+ | FeatureSet
+ | undefined;
+ /** Defaults of features that can't be overridden in this edition. */
+ fixedFeatures: FeatureSet | undefined;
}
/**
@@ -1989,7 +2053,7 @@ export interface SourceCodeInfo_Location {
* location.
*
* Each element is a field number or an index. They form a path from
- * the root FileDescriptorProto to the place where the definition occurs.
+ * the root FileDescriptorProto to the place where the definition appears.
* For example, this path:
* [ 4, 3, 2, 7, 1 ]
* refers to:
@@ -3987,7 +4051,6 @@ function createBaseFileOptions(): FileOptions {
ccGenericServices: false,
javaGenericServices: false,
pyGenericServices: false,
- phpGenericServices: false,
deprecated: false,
ccEnableArenas: false,
objcClassPrefix: "",
@@ -4034,9 +4097,6 @@ export const FileOptions = {
if (message.pyGenericServices === true) {
writer.uint32(144).bool(message.pyGenericServices);
}
- if (message.phpGenericServices === true) {
- writer.uint32(336).bool(message.phpGenericServices);
- }
if (message.deprecated === true) {
writer.uint32(184).bool(message.deprecated);
}
@@ -4150,13 +4210,6 @@ export const FileOptions = {
message.pyGenericServices = reader.bool();
continue;
- case 42:
- if (tag !== 336) {
- break;
- }
-
- message.phpGenericServices = reader.bool();
- continue;
case 23:
if (tag !== 184) {
break;
@@ -4259,7 +4312,6 @@ export const FileOptions = {
ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false,
javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false,
pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false,
- phpGenericServices: isSet(object.phpGenericServices) ? globalThis.Boolean(object.phpGenericServices) : false,
deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false,
ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : false,
objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "",
@@ -4308,9 +4360,6 @@ export const FileOptions = {
if (message.pyGenericServices === true) {
obj.pyGenericServices = message.pyGenericServices;
}
- if (message.phpGenericServices === true) {
- obj.phpGenericServices = message.phpGenericServices;
- }
if (message.deprecated === true) {
obj.deprecated = message.deprecated;
}
@@ -4362,7 +4411,6 @@ export const FileOptions = {
message.ccGenericServices = object.ccGenericServices ?? false;
message.javaGenericServices = object.javaGenericServices ?? false;
message.pyGenericServices = object.pyGenericServices ?? false;
- message.phpGenericServices = object.phpGenericServices ?? false;
message.deprecated = object.deprecated ?? false;
message.ccEnableArenas = object.ccEnableArenas ?? false;
message.objcClassPrefix = object.objcClassPrefix ?? "";
@@ -4561,6 +4609,7 @@ function createBaseFieldOptions(): FieldOptions {
targets: [],
editionDefaults: [],
features: undefined,
+ featureSupport: undefined,
uninterpretedOption: [],
};
}
@@ -4605,6 +4654,9 @@ export const FieldOptions = {
if (message.features !== undefined) {
FeatureSet.encode(message.features, writer.uint32(170).fork()).ldelim();
}
+ if (message.featureSupport !== undefined) {
+ FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).ldelim();
+ }
for (const v of message.uninterpretedOption) {
UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim();
}
@@ -4712,6 +4764,13 @@ export const FieldOptions = {
message.features = FeatureSet.decode(reader, reader.uint32());
continue;
+ case 22:
+ if (tag !== 178) {
+ break;
+ }
+
+ message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32());
+ continue;
case 999:
if (tag !== 7994) {
break;
@@ -4748,6 +4807,9 @@ export const FieldOptions = {
? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e))
: [],
features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined,
+ featureSupport: isSet(object.featureSupport)
+ ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport)
+ : undefined,
uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption)
? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e))
: [],
@@ -4792,6 +4854,9 @@ export const FieldOptions = {
if (message.features !== undefined) {
obj.features = FeatureSet.toJSON(message.features);
}
+ if (message.featureSupport !== undefined) {
+ obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport);
+ }
if (message.uninterpretedOption?.length) {
obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e));
}
@@ -4817,6 +4882,9 @@ export const FieldOptions = {
message.features = (object.features !== undefined && object.features !== null)
? FeatureSet.fromPartial(object.features)
: undefined;
+ message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null)
+ ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport)
+ : undefined;
message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || [];
return message;
},
@@ -4896,6 +4964,119 @@ export const FieldOptions_EditionDefault = {
},
};
+function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport {
+ return {
+ editionIntroduced: Edition.EDITION_UNKNOWN,
+ editionDeprecated: Edition.EDITION_UNKNOWN,
+ deprecationWarning: "",
+ editionRemoved: Edition.EDITION_UNKNOWN,
+ };
+}
+
+export const FieldOptions_FeatureSupport = {
+ encode(message: FieldOptions_FeatureSupport, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.editionIntroduced !== Edition.EDITION_UNKNOWN) {
+ writer.uint32(8).int32(editionToNumber(message.editionIntroduced));
+ }
+ if (message.editionDeprecated !== Edition.EDITION_UNKNOWN) {
+ writer.uint32(16).int32(editionToNumber(message.editionDeprecated));
+ }
+ if (message.deprecationWarning !== "") {
+ writer.uint32(26).string(message.deprecationWarning);
+ }
+ if (message.editionRemoved !== Edition.EDITION_UNKNOWN) {
+ writer.uint32(32).int32(editionToNumber(message.editionRemoved));
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions_FeatureSupport {
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseFieldOptions_FeatureSupport();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ if (tag !== 8) {
+ break;
+ }
+
+ message.editionIntroduced = editionFromJSON(reader.int32());
+ continue;
+ case 2:
+ if (tag !== 16) {
+ break;
+ }
+
+ message.editionDeprecated = editionFromJSON(reader.int32());
+ continue;
+ case 3:
+ if (tag !== 26) {
+ break;
+ }
+
+ message.deprecationWarning = reader.string();
+ continue;
+ case 4:
+ if (tag !== 32) {
+ break;
+ }
+
+ message.editionRemoved = editionFromJSON(reader.int32());
+ continue;
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skipType(tag & 7);
+ }
+ return message;
+ },
+
+ fromJSON(object: any): FieldOptions_FeatureSupport {
+ return {
+ editionIntroduced: isSet(object.editionIntroduced)
+ ? editionFromJSON(object.editionIntroduced)
+ : Edition.EDITION_UNKNOWN,
+ editionDeprecated: isSet(object.editionDeprecated)
+ ? editionFromJSON(object.editionDeprecated)
+ : Edition.EDITION_UNKNOWN,
+ deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "",
+ editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : Edition.EDITION_UNKNOWN,
+ };
+ },
+
+ toJSON(message: FieldOptions_FeatureSupport): unknown {
+ const obj: any = {};
+ if (message.editionIntroduced !== Edition.EDITION_UNKNOWN) {
+ obj.editionIntroduced = editionToJSON(message.editionIntroduced);
+ }
+ if (message.editionDeprecated !== Edition.EDITION_UNKNOWN) {
+ obj.editionDeprecated = editionToJSON(message.editionDeprecated);
+ }
+ if (message.deprecationWarning !== "") {
+ obj.deprecationWarning = message.deprecationWarning;
+ }
+ if (message.editionRemoved !== Edition.EDITION_UNKNOWN) {
+ obj.editionRemoved = editionToJSON(message.editionRemoved);
+ }
+ return obj;
+ },
+
+ create(base?: DeepPartial<FieldOptions_FeatureSupport>): FieldOptions_FeatureSupport {
+ return FieldOptions_FeatureSupport.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<FieldOptions_FeatureSupport>): FieldOptions_FeatureSupport {
+ const message = createBaseFieldOptions_FeatureSupport();
+ message.editionIntroduced = object.editionIntroduced ?? Edition.EDITION_UNKNOWN;
+ message.editionDeprecated = object.editionDeprecated ?? Edition.EDITION_UNKNOWN;
+ message.deprecationWarning = object.deprecationWarning ?? "";
+ message.editionRemoved = object.editionRemoved ?? Edition.EDITION_UNKNOWN;
+ return message;
+ },
+};
+
function createBaseOneofOptions(): OneofOptions {
return { features: undefined, uninterpretedOption: [] };
}
@@ -5106,7 +5287,13 @@ export const EnumOptions = {
};
function createBaseEnumValueOptions(): EnumValueOptions {
- return { deprecated: false, features: undefined, debugRedact: false, uninterpretedOption: [] };
+ return {
+ deprecated: false,
+ features: undefined,
+ debugRedact: false,
+ featureSupport: undefined,
+ uninterpretedOption: [],
+ };
}
export const EnumValueOptions = {
@@ -5120,6 +5307,9 @@ export const EnumValueOptions = {
if (message.debugRedact === true) {
writer.uint32(24).bool(message.debugRedact);
}
+ if (message.featureSupport !== undefined) {
+ FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).ldelim();
+ }
for (const v of message.uninterpretedOption) {
UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim();
}
@@ -5154,6 +5344,13 @@ export const EnumValueOptions = {
message.debugRedact = reader.bool();
continue;
+ case 4:
+ if (tag !== 34) {
+ break;
+ }
+
+ message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32());
+ continue;
case 999:
if (tag !== 7994) {
break;
@@ -5175,6 +5372,9 @@ export const EnumValueOptions = {
deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false,
features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined,
debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false,
+ featureSupport: isSet(object.featureSupport)
+ ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport)
+ : undefined,
uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption)
? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e))
: [],
@@ -5192,6 +5392,9 @@ export const EnumValueOptions = {
if (message.debugRedact === true) {
obj.debugRedact = message.debugRedact;
}
+ if (message.featureSupport !== undefined) {
+ obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport);
+ }
if (message.uninterpretedOption?.length) {
obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e));
}
@@ -5208,6 +5411,9 @@ export const EnumValueOptions = {
? FeatureSet.fromPartial(object.features)
: undefined;
message.debugRedact = object.debugRedact ?? false;
+ message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null)
+ ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport)
+ : undefined;
message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || [];
return message;
},
@@ -5904,7 +6110,7 @@ export const FeatureSetDefaults = {
};
function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault {
- return { edition: Edition.EDITION_UNKNOWN, features: undefined };
+ return { edition: Edition.EDITION_UNKNOWN, overridableFeatures: undefined, fixedFeatures: undefined };
}
export const FeatureSetDefaults_FeatureSetEditionDefault = {
@@ -5912,8 +6118,11 @@ export const FeatureSetDefaults_FeatureSetEditionDefault = {
if (message.edition !== Edition.EDITION_UNKNOWN) {
writer.uint32(24).int32(editionToNumber(message.edition));
}
- if (message.features !== undefined) {
- FeatureSet.encode(message.features, writer.uint32(18).fork()).ldelim();
+ if (message.overridableFeatures !== undefined) {
+ FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).ldelim();
+ }
+ if (message.fixedFeatures !== undefined) {
+ FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).ldelim();
}
return writer;
},
@@ -5932,12 +6141,19 @@ export const FeatureSetDefaults_FeatureSetEditionDefault = {
message.edition = editionFromJSON(reader.int32());
continue;
- case 2:
- if (tag !== 18) {
+ case 4:
+ if (tag !== 34) {
break;
}
- message.features = FeatureSet.decode(reader, reader.uint32());
+ message.overridableFeatures = FeatureSet.decode(reader, reader.uint32());
+ continue;
+ case 5:
+ if (tag !== 42) {
+ break;
+ }
+
+ message.fixedFeatures = FeatureSet.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
@@ -5951,7 +6167,10 @@ export const FeatureSetDefaults_FeatureSetEditionDefault = {
fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault {
return {
edition: isSet(object.edition) ? editionFromJSON(object.edition) : Edition.EDITION_UNKNOWN,
- features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined,
+ overridableFeatures: isSet(object.overridableFeatures)
+ ? FeatureSet.fromJSON(object.overridableFeatures)
+ : undefined,
+ fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined,
};
},
@@ -5960,8 +6179,11 @@ export const FeatureSetDefaults_FeatureSetEditionDefault = {
if (message.edition !== Edition.EDITION_UNKNOWN) {
obj.edition = editionToJSON(message.edition);
}
- if (message.features !== undefined) {
- obj.features = FeatureSet.toJSON(message.features);
+ if (message.overridableFeatures !== undefined) {
+ obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures);
+ }
+ if (message.fixedFeatures !== undefined) {
+ obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures);
}
return obj;
},
@@ -5974,8 +6196,11 @@ export const FeatureSetDefaults_FeatureSetEditionDefault = {
): FeatureSetDefaults_FeatureSetEditionDefault {
const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault();
message.edition = object.edition ?? Edition.EDITION_UNKNOWN;
- message.features = (object.features !== undefined && object.features !== null)
- ? FeatureSet.fromPartial(object.features)
+ message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null)
+ ? FeatureSet.fromPartial(object.overridableFeatures)
+ : undefined;
+ message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null)
+ ? FeatureSet.fromPartial(object.fixedFeatures)
: undefined;
return message;
},
diff --git a/frontend/src/types/proto/store/db_group.ts b/frontend/src/types/proto/store/db_group.ts
new file mode 100644
index 0000000000..68da1ff7bc
--- /dev/null
+++ b/frontend/src/types/proto/store/db_group.ts
@@ -0,0 +1,83 @@
+/* eslint-disable */
+import Long from "long";
+import _m0 from "protobufjs/minimal";
+
+export const protobufPackage = "bytebase.store";
+
+export interface DatabaseGroupPayload {
+ multitenancy: boolean;
+}
+
+function createBaseDatabaseGroupPayload(): DatabaseGroupPayload {
+ return { multitenancy: false };
+}
+
+export const DatabaseGroupPayload = {
+ encode(message: DatabaseGroupPayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.multitenancy === true) {
+ writer.uint32(8).bool(message.multitenancy);
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): DatabaseGroupPayload {
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseDatabaseGroupPayload();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ if (tag !== 8) {
+ break;
+ }
+
+ message.multitenancy = reader.bool();
+ continue;
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skipType(tag & 7);
+ }
+ return message;
+ },
+
+ fromJSON(object: any): DatabaseGroupPayload {
+ return { multitenancy: isSet(object.multitenancy) ? globalThis.Boolean(object.multitenancy) : false };
+ },
+
+ toJSON(message: DatabaseGroupPayload): unknown {
+ const obj: any = {};
+ if (message.multitenancy === true) {
+ obj.multitenancy = message.multitenancy;
+ }
+ return obj;
+ },
+
+ create(base?: DeepPartial<DatabaseGroupPayload>): DatabaseGroupPayload {
+ return DatabaseGroupPayload.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<DatabaseGroupPayload>): DatabaseGroupPayload {
+ const message = createBaseDatabaseGroupPayload();
+ message.multitenancy = object.multitenancy ?? false;
+ return message;
+ },
+};
+
+type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
+
+export type DeepPartial<T> = T extends Builtin ? T
+ : T extends Long ? string | number | Long : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
+ : Partial<T>;
+
+if (_m0.util.Long !== Long) {
+ _m0.util.Long = Long as any;
+ _m0.configure();
+}
+
+function isSet(value: any): boolean {
+ return value !== null && value !== undefined;
+}
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 38ba33542c..90c9448798 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -110,6 +110,9 @@
- [DataSourceExternalSecret.SecretType](#bytebase-store-DataSourceExternalSecret-SecretType)
- [DataSourceOptions.AuthenticationType](#bytebase-store-DataSourceOptions-AuthenticationType)
+- [store/db_group.proto](#store_db_group-proto)
+ - [DatabaseGroupPayload](#bytebase-store-DatabaseGroupPayload)
+
- [store/export_archive.proto](#store_export_archive-proto)
- [ExportArchivePayload](#bytebase-store-ExportArchivePayload)
@@ -1883,6 +1886,37 @@ PostgreSQL: RANGE, LIST, HASH (https://www.postgresql.org/docs/current/ddl-parti
+<a name="store_db_group-proto"></a>
+<p align="right"><a href="#top">Top</a></p>
+
+## store/db_group.proto
+
+
+
+<a name="bytebase-store-DatabaseGroupPayload"></a>
+
+### DatabaseGroupPayload
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| multitenancy | [bool](#bool) | | |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<a name="store_export_archive-proto"></a>
<p align="right"><a href="#top">Top</a></p>
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index ec13acb84e..b269b03d00 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -601,6 +601,21 @@
</li>
+ <li>
+ <a href="#store%2fdb_group.proto">store/db_group.proto</a>
+ <ul>
+
+ <li>
+ <a href="#bytebase.store.DatabaseGroupPayload"><span class="badge">M</span>DatabaseGroupPayload</a>
+ </li>
+
+
+
+
+ </ul>
+ </li>
+
+
<li>
<a href="#store%2fexport_archive.proto">store/export_archive.proto</a>
<ul>
@@ -5258,6 +5273,44 @@ Used for authentication when connecting to the data source. </p></td>
+ <div class="file-heading">
+ <h2 id="store/db_group.proto">store/db_group.proto</h2><a href="#title">Top</a>
+ </div>
+ <p></p>
+
+
+ <h3 id="bytebase.store.DatabaseGroupPayload">DatabaseGroupPayload</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>multitenancy</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
+
+
+
+
+
+
+
+
<div class="file-heading">
<h2 id="store/export_archive.proto">store/export_archive.proto</h2><a href="#title">Top</a>
</div>
diff --git a/proto/generated-go/store/db_group.pb.go b/proto/generated-go/store/db_group.pb.go
new file mode 100644
index 0000000000..b120e081e9
--- /dev/null
+++ b/proto/generated-go/store/db_group.pb.go
@@ -0,0 +1,144 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.34.2
+// protoc (unknown)
+// source: store/db_group.proto
+
+package store
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type DatabaseGroupPayload struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Multitenancy bool `protobuf:"varint,1,opt,name=multitenancy,proto3" json:"multitenancy,omitempty"`
+}
+
+func (x *DatabaseGroupPayload) Reset() {
+ *x = DatabaseGroupPayload{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_store_db_group_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DatabaseGroupPayload) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DatabaseGroupPayload) ProtoMessage() {}
+
+func (x *DatabaseGroupPayload) ProtoReflect() protoreflect.Message {
+ mi := &file_store_db_group_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DatabaseGroupPayload.ProtoReflect.Descriptor instead.
+func (*DatabaseGroupPayload) Descriptor() ([]byte, []int) {
+ return file_store_db_group_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *DatabaseGroupPayload) GetMultitenancy() bool {
+ if x != nil {
+ return x.Multitenancy
+ }
+ return false
+}
+
+var File_store_db_group_proto protoreflect.FileDescriptor
+
+var file_store_db_group_proto_rawDesc = []byte{
+ 0x0a, 0x14, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x64, 0x62, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,
+ 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x3a, 0x0a, 0x14, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61,
+ 0x73, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x22,
+ 0x0a, 0x0c, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x63, 0x79, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x74, 0x65, 0x6e, 0x61, 0x6e,
+ 0x63, 0x79, 0x42, 0x14, 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d,
+ 0x67, 0x6f, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_store_db_group_proto_rawDescOnce sync.Once
+ file_store_db_group_proto_rawDescData = file_store_db_group_proto_rawDesc
+)
+
+func file_store_db_group_proto_rawDescGZIP() []byte {
+ file_store_db_group_proto_rawDescOnce.Do(func() {
+ file_store_db_group_proto_rawDescData = protoimpl.X.CompressGZIP(file_store_db_group_proto_rawDescData)
+ })
+ return file_store_db_group_proto_rawDescData
+}
+
+var file_store_db_group_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
+var file_store_db_group_proto_goTypes = []any{
+ (*DatabaseGroupPayload)(nil), // 0: bytebase.store.DatabaseGroupPayload
+}
+var file_store_db_group_proto_depIdxs = []int32{
+ 0, // [0:0] is the sub-list for method output_type
+ 0, // [0:0] is the sub-list for method input_type
+ 0, // [0:0] is the sub-list for extension type_name
+ 0, // [0:0] is the sub-list for extension extendee
+ 0, // [0:0] is the sub-list for field type_name
+}
+
+func init() { file_store_db_group_proto_init() }
+func file_store_db_group_proto_init() {
+ if File_store_db_group_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_store_db_group_proto_msgTypes[0].Exporter = func(v any, i int) any {
+ switch v := v.(*DatabaseGroupPayload); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_store_db_group_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 1,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_store_db_group_proto_goTypes,
+ DependencyIndexes: file_store_db_group_proto_depIdxs,
+ MessageInfos: file_store_db_group_proto_msgTypes,
+ }.Build()
+ File_store_db_group_proto = out.File
+ file_store_db_group_proto_rawDesc = nil
+ file_store_db_group_proto_goTypes = nil
+ file_store_db_group_proto_depIdxs = nil
+}
diff --git a/proto/store/db_group.proto b/proto/store/db_group.proto
new file mode 100644
index 0000000000..18cc0022b5
--- /dev/null
+++ b/proto/store/db_group.proto
@@ -0,0 +1,9 @@
+syntax = "proto3";
+
+package bytebase.store;
+
+option go_package = "generated-go/store";
+
+message DatabaseGroupPayload {
+ bool multitenancy = 1;
+}