Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: use protocol for database role (#3932)
ecmadao0d63345c7d80
diff --git a/api/v1/database_role.go b/api/v1/database_role.godeleted file mode 100644index ee1b689970..0000000000--- a/api/v1/database_role.go+++ /dev/null@@ -1,12 +0,0 @@-package v1--import "github.com/bytebase/bytebase/plugin/db"--// DatabaseRole is the API message for role in db.-type DatabaseRole struct {- Name string `json:"name"`- InstanceID int `json:"instanceId"`- ConnectionLimit int `json:"connectionLimit"`- ValidUntil *string `json:"validUntil"`- Attribute *db.RoleAttribute `json:"attribute"`-}diff --git a/plugin/advisor/utils_for_tests.go b/plugin/advisor/utils_for_tests.goindex 3ca44b15c1..043559ad3c 100644--- a/plugin/advisor/utils_for_tests.go+++ b/plugin/advisor/utils_for_tests.go@@ -20,6 +20,7 @@ import ("github.com/bytebase/bytebase/plugin/advisor/db"database "github.com/bytebase/bytebase/plugin/db"storepb "github.com/bytebase/bytebase/proto/generated-go/store"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")var (@@ -318,17 +319,17 @@ func (*MockDriver) Restore(_ context.Context, _ io.Reader) error {}// CreateRole creates the role.-func (*MockDriver) CreateRole(_ context.Context, _ *database.RoleUpsert) (*database.Role, error) {+func (*MockDriver) CreateRole(_ context.Context, _ *v1pb.DatabaseRoleUpsert) (*v1pb.DatabaseRole, error) {return nil, nil}// UpdateRole updates the role.-func (*MockDriver) UpdateRole(_ context.Context, _ string, _ *database.RoleUpsert) (*database.Role, error) {+func (*MockDriver) UpdateRole(_ context.Context, _ string, _ *v1pb.DatabaseRoleUpsert) (*v1pb.DatabaseRole, error) {return nil, nil}// FindRole finds the role by name.-func (*MockDriver) FindRole(_ context.Context, _ string) (*database.Role, error) {+func (*MockDriver) FindRole(_ context.Context, _ string) (*v1pb.DatabaseRole, error) {return nil, nil}diff --git a/plugin/db/clickhouse/role.go b/plugin/db/clickhouse/role.goindex b3c218bf04..5b66fa6a4d 100644--- a/plugin/db/clickhouse/role.go+++ b/plugin/db/clickhouse/role.go@@ -5,21 +5,21 @@ import ("github.com/pkg/errors"- "github.com/bytebase/bytebase/plugin/db"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")// CreateRole creates the role.-func (*Driver) CreateRole(_ context.Context, _ *db.RoleUpsert) (*db.Role, error) {+func (*Driver) CreateRole(_ context.Context, _ *v1pb.DatabaseRoleUpsert) (*v1pb.DatabaseRole, error) {return nil, errors.Errorf("create role for ClickHouse is not implemented yet")}// UpdateRole updates the role.-func (*Driver) UpdateRole(_ context.Context, _ string, _ *db.RoleUpsert) (*db.Role, error) {+func (*Driver) UpdateRole(_ context.Context, _ string, _ *v1pb.DatabaseRoleUpsert) (*v1pb.DatabaseRole, error) {return nil, errors.Errorf("update role for ClickHouse is not implemented yet")}// FindRole finds the role by name.-func (*Driver) FindRole(_ context.Context, _ string) (*db.Role, error) {+func (*Driver) FindRole(_ context.Context, _ string) (*v1pb.DatabaseRole, error) {return nil, errors.Errorf("find role for ClickHouse is not implemented yet")}diff --git a/plugin/db/driver.go b/plugin/db/driver.goindex 607bb33172..4db49dcc10 100644--- a/plugin/db/driver.go+++ b/plugin/db/driver.go@@ -14,6 +14,7 @@ import ("github.com/pkg/errors""github.com/bytebase/bytebase/plugin/vcs"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")// Type is the type of a database.@@ -164,35 +165,6 @@ type Schema struct {ExtensionList []Extension}-// RoleAttribute is the attribute for role.-type RoleAttribute struct {- SuperUser bool `json:"superUser"`- NoInherit bool `json:"noInherit"`- CreateRole bool `json:"createRole"`- CreateDB bool `json:"createDB"`- CanLogin bool `json:"canLogin"`- Replication bool `json:"replication"`- ByPassRLS bool `json:"byPassRLS"`-}--// Role is the API message for role.-type Role struct {- Name string- ConnectionLimit int- ValidUntil *string- Attribute *RoleAttribute-}--// RoleUpsert is the API message for upserting a new role.-// TODO(ed): we may need to support IN ROLE role_name, ROLE role_name[,...] and ADMIN role_name[,...] statement.-type RoleUpsert struct {- Name string `json:"name"`- Password *string `json:"password"`- ConnectionLimit *int `json:"connectionLimit"`- ValidUntil *string `json:"validUntil"`- Attribute *RoleAttribute `json:"attribute"`-}-var (driversMu sync.RWMutexdrivers = make(map[Type]driverFunc)@@ -530,11 +502,11 @@ type Driver interface {// Role// CreateRole creates the role.- CreateRole(ctx context.Context, upsert *RoleUpsert) (*Role, error)+ CreateRole(ctx context.Context, upsert *v1pb.DatabaseRoleUpsert) (*v1pb.DatabaseRole, error)// UpdateRole updates the role.- UpdateRole(ctx context.Context, roleName string, upsert *RoleUpsert) (*Role, error)+ UpdateRole(ctx context.Context, roleName string, upsert *v1pb.DatabaseRoleUpsert) (*v1pb.DatabaseRole, error)// FindRole finds the role by name.- FindRole(ctx context.Context, roleName string) (*Role, error)+ FindRole(ctx context.Context, roleName string) (*v1pb.DatabaseRole, error)// DeleteRole deletes the role by name.DeleteRole(ctx context.Context, roleName string) errordiff --git a/plugin/db/mongodb/role.go b/plugin/db/mongodb/role.goindex 9433df5b83..3259513e17 100644--- a/plugin/db/mongodb/role.go+++ b/plugin/db/mongodb/role.go@@ -5,21 +5,21 @@ import ("github.com/pkg/errors"- "github.com/bytebase/bytebase/plugin/db"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")// CreateRole creates the role.-func (*Driver) CreateRole(_ context.Context, _ *db.RoleUpsert) (*db.Role, error) {+func (*Driver) CreateRole(_ context.Context, _ *v1pb.DatabaseRoleUpsert) (*v1pb.DatabaseRole, error) {return nil, errors.Errorf("create role for MongoDB is not implemented yet")}// UpdateRole updates the role.-func (*Driver) UpdateRole(_ context.Context, _ string, _ *db.RoleUpsert) (*db.Role, error) {+func (*Driver) UpdateRole(_ context.Context, _ string, _ *v1pb.DatabaseRoleUpsert) (*v1pb.DatabaseRole, error) {return nil, errors.Errorf("update role for MongoDB is not implemented yet")}// FindRole finds the role by name.-func (*Driver) FindRole(_ context.Context, _ string) (*db.Role, error) {+func (*Driver) FindRole(_ context.Context, _ string) (*v1pb.DatabaseRole, error) {return nil, errors.Errorf("find role for MongoDB is not implemented yet")}diff --git a/plugin/db/mysql/role.go b/plugin/db/mysql/role.goindex 330d452e7a..b2ef4942ea 100644--- a/plugin/db/mysql/role.go+++ b/plugin/db/mysql/role.go@@ -5,21 +5,21 @@ import ("github.com/pkg/errors"- "github.com/bytebase/bytebase/plugin/db"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")// CreateRole creates the role.-func (*Driver) CreateRole(_ context.Context, _ *db.RoleUpsert) (*db.Role, error) {+func (*Driver) CreateRole(_ context.Context, _ *v1pb.DatabaseRoleUpsert) (*v1pb.DatabaseRole, error) {return nil, errors.Errorf("create role for MySQL is not implemented yet")}// UpdateRole updates the role.-func (*Driver) UpdateRole(_ context.Context, _ string, _ *db.RoleUpsert) (*db.Role, error) {+func (*Driver) UpdateRole(_ context.Context, _ string, _ *v1pb.DatabaseRoleUpsert) (*v1pb.DatabaseRole, error) {return nil, errors.Errorf("update role for MySQL is not implemented yet")}// FindRole finds the role by name.-func (*Driver) FindRole(_ context.Context, _ string) (*db.Role, error) {+func (*Driver) FindRole(_ context.Context, _ string) (*v1pb.DatabaseRole, error) {return nil, errors.Errorf("find role for MySQL is not implemented yet")}diff --git a/plugin/db/pg/role.go b/plugin/db/pg/role.goindex 04139baf70..60627be8ea 100644--- a/plugin/db/pg/role.go+++ b/plugin/db/pg/role.go@@ -7,8 +7,8 @@ import ("strings""github.com/bytebase/bytebase/common"- "github.com/bytebase/bytebase/plugin/db""github.com/bytebase/bytebase/plugin/db/util"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")// RoleAttribute is the attribute string for role.@@ -38,7 +38,7 @@ func (a RoleAttribute) ToString() string {}// CreateRole will create the PG role.-func (driver *Driver) CreateRole(ctx context.Context, upsert *db.RoleUpsert) (*db.Role, error) {+func (driver *Driver) CreateRole(ctx context.Context, upsert *v1pb.DatabaseRoleUpsert) (*v1pb.DatabaseRole, error) {txn, err := driver.db.BeginTx(ctx, nil)if err != nil {return nil, err@@ -62,7 +62,7 @@ func (driver *Driver) CreateRole(ctx context.Context, upsert *db.RoleUpsert) (*d}// UpdateRole will alter the PG role.-func (driver *Driver) UpdateRole(ctx context.Context, roleName string, upsert *db.RoleUpsert) (*db.Role, error) {+func (driver *Driver) UpdateRole(ctx context.Context, roleName string, upsert *v1pb.DatabaseRoleUpsert) (*v1pb.DatabaseRole, error) {txn, err := driver.db.BeginTx(ctx, nil)if err != nil {return nil, err@@ -86,7 +86,7 @@ func (driver *Driver) UpdateRole(ctx context.Context, roleName string, upsert *d}// FindRole will find the PG role by name.-func (driver *Driver) FindRole(ctx context.Context, roleName string) (*db.Role, error) {+func (driver *Driver) FindRole(ctx context.Context, roleName string) (*v1pb.DatabaseRole, error) {txn, err := driver.db.BeginTx(ctx, nil)if err != nil {return nil, err@@ -115,7 +115,7 @@ func (driver *Driver) DeleteRole(ctx context.Context, roleName string) error {return nil}-func getRoleImpl(ctx context.Context, txn *sql.Tx, roleName string) (*db.Role, error) {+func getRoleImpl(ctx context.Context, txn *sql.Tx, roleName string) (*v1pb.DatabaseRole, error) {statement := fmt.Sprintf(`SELECTr.rolname,@@ -132,9 +132,9 @@ func getRoleImpl(ctx context.Context, txn *sql.Tx, roleName string) (*db.Role, eWHERE r.rolname = '%s';`, roleName)- role := &db.Role{+ role := &v1pb.DatabaseRole{Name: roleName,- Attribute: &db.RoleAttribute{},+ Attribute: &v1pb.DatabaseRoleAttribute{},}inherit := false@@ -144,15 +144,15 @@ func getRoleImpl(ctx context.Context, txn *sql.Tx, roleName string) (*db.Role, e&role.Attribute.SuperUser,&inherit,&role.Attribute.CreateRole,- &role.Attribute.CreateDB,+ &role.Attribute.CreateDb,&role.Attribute.CanLogin,&role.Attribute.Replication,- &role.Attribute.ByPassRLS,+ &role.Attribute.BypassRls,&role.ValidUntil,&role.ConnectionLimit,); err != nil {if err == sql.ErrNoRows {- return nil, common.FormatDBErrorEmptyRowWithQuery(statement)+ return nil, common.Errorf(common.NotFound, fmt.Sprintf("query %q returned empty row", statement))}return nil, util.FormatErrorWithQuery(err, statement)}@@ -162,7 +162,7 @@ func getRoleImpl(ctx context.Context, txn *sql.Tx, roleName string) (*db.Role, ereturn role, nil}-func createRoleImpl(ctx context.Context, txn *sql.Tx, upsert *db.RoleUpsert) error {+func createRoleImpl(ctx context.Context, txn *sql.Tx, upsert *v1pb.DatabaseRoleUpsert) error {statement := fmt.Sprintf(`CREATE ROLE "%s" %s;`, upsert.Name, convertToAttributeStatement(upsert))if _, err := txn.ExecContext(ctx, statement); err != nil {return util.FormatErrorWithQuery(err, statement)@@ -171,7 +171,7 @@ func createRoleImpl(ctx context.Context, txn *sql.Tx, upsert *db.RoleUpsert) errreturn nil}-func alterRoleImpl(ctx context.Context, txn *sql.Tx, roleName string, upsert *db.RoleUpsert) error {+func alterRoleImpl(ctx context.Context, txn *sql.Tx, roleName string, upsert *v1pb.DatabaseRoleUpsert) error {if roleName != upsert.Name {renameStatement := fmt.Sprintf(`ALTER ROLE "%s" RENAME TO "%s";`, roleName, upsert.Name)if _, err := txn.ExecContext(ctx, renameStatement); err != nil {@@ -192,7 +192,7 @@ func alterRoleImpl(ctx context.Context, txn *sql.Tx, roleName string, upsert *dbreturn nil}-func convertToAttributeStatement(r *db.RoleUpsert) string {+func convertToAttributeStatement(r *v1pb.DatabaseRoleUpsert) string {attributeList := []string{}if r.Attribute != nil {@@ -208,13 +208,13 @@ func convertToAttributeStatement(r *db.RoleUpsert) string {if r.Attribute.CreateRole {attributeList = append(attributeList, CREATEROLE.ToString())}- if r.Attribute.CreateDB {+ if r.Attribute.CreateDb {attributeList = append(attributeList, CREATEDB.ToString())}if r.Attribute.Replication {attributeList = append(attributeList, REPLICATION.ToString())}- if r.Attribute.ByPassRLS {+ if r.Attribute.BypassRls {attributeList = append(attributeList, BYPASSRLS.ToString())}}diff --git a/plugin/db/snowflake/role.go b/plugin/db/snowflake/role.goindex 945f460c51..44023294f1 100644--- a/plugin/db/snowflake/role.go+++ b/plugin/db/snowflake/role.go@@ -5,21 +5,21 @@ import ("github.com/pkg/errors"- "github.com/bytebase/bytebase/plugin/db"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")// CreateRole creates the role.-func (*Driver) CreateRole(_ context.Context, _ *db.RoleUpsert) (*db.Role, error) {+func (*Driver) CreateRole(_ context.Context, _ *v1pb.DatabaseRoleUpsert) (*v1pb.DatabaseRole, error) {return nil, errors.Errorf("create role for Snowflake is not implemented yet")}// UpdateRole updates the role.-func (*Driver) UpdateRole(_ context.Context, _ string, _ *db.RoleUpsert) (*db.Role, error) {+func (*Driver) UpdateRole(_ context.Context, _ string, _ *v1pb.DatabaseRoleUpsert) (*v1pb.DatabaseRole, error) {return nil, errors.Errorf("update role for Snowflake is not implemented yet")}// FindRole finds the role by name.-func (*Driver) FindRole(_ context.Context, _ string) (*db.Role, error) {+func (*Driver) FindRole(_ context.Context, _ string) (*v1pb.DatabaseRole, error) {return nil, errors.Errorf("find role for Snowflake is not implemented yet")}diff --git a/plugin/db/sqlite/role.go b/plugin/db/sqlite/role.goindex 1a71b6d26b..dbb66dbf59 100644--- a/plugin/db/sqlite/role.go+++ b/plugin/db/sqlite/role.go@@ -5,21 +5,21 @@ import ("github.com/pkg/errors"- "github.com/bytebase/bytebase/plugin/db"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")// CreateRole creates the role.-func (*Driver) CreateRole(_ context.Context, _ *db.RoleUpsert) (*db.Role, error) {+func (*Driver) CreateRole(_ context.Context, _ *v1pb.DatabaseRoleUpsert) (*v1pb.DatabaseRole, error) {return nil, errors.Errorf("create role for SQLite is not implemented yet")}// UpdateRole updates the role.-func (*Driver) UpdateRole(_ context.Context, _ string, _ *db.RoleUpsert) (*db.Role, error) {+func (*Driver) UpdateRole(_ context.Context, _ string, _ *v1pb.DatabaseRoleUpsert) (*v1pb.DatabaseRole, error) {return nil, errors.Errorf("update role for SQLite is not implemented yet")}// FindRole finds the role by name.-func (*Driver) FindRole(_ context.Context, _ string) (*db.Role, error) {+func (*Driver) FindRole(_ context.Context, _ string) (*v1pb.DatabaseRole, error) {return nil, errors.Errorf("find role for SQLite is not implemented yet")}diff --git a/proto/generate_go.sh b/proto/generate_go.shindex 2fbe9ffb81..5b7c924465 100755--- a/proto/generate_go.sh+++ b/proto/generate_go.sh@@ -4,4 +4,4 @@ cd "$(dirname "$0")/../"# https://developers.google.com/protocol-buffers/docs/gotutorial# store package belongs to storage related proto's.-protoc --proto_path=proto/store --go_out=./proto proto/store/database.proto+protoc --proto_path=proto --go_out=./proto proto/store/database.proto proto/v1/database_role.protodiff --git a/proto/generated-go/store/database.pb.go b/proto/generated-go/store/database.pb.goindex f416d7dba9..9273f487af 100644--- a/proto/generated-go/store/database.pb.go+++ b/proto/generated-go/store/database.pb.go@@ -1,8 +1,8 @@// Code generated by protoc-gen-go. DO NOT EDIT.// versions:// protoc-gen-go v1.28.1-// protoc v3.21.11-// source: database.proto+// protoc v3.21.12+// source: store/database.protopackage store@@ -40,7 +40,7 @@ type DatabaseMetadata struct {func (x *DatabaseMetadata) Reset() {*x = DatabaseMetadata{}if protoimpl.UnsafeEnabled {- mi := &file_database_proto_msgTypes[0]+ mi := &file_store_database_proto_msgTypes[0]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -53,7 +53,7 @@ func (x *DatabaseMetadata) String() string {func (*DatabaseMetadata) ProtoMessage() {}func (x *DatabaseMetadata) ProtoReflect() protoreflect.Message {- mi := &file_database_proto_msgTypes[0]+ mi := &file_store_database_proto_msgTypes[0]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -66,7 +66,7 @@ func (x *DatabaseMetadata) ProtoReflect() protoreflect.Message {// Deprecated: Use DatabaseMetadata.ProtoReflect.Descriptor instead.func (*DatabaseMetadata) Descriptor() ([]byte, []int) {- return file_database_proto_rawDescGZIP(), []int{0}+ return file_store_database_proto_rawDescGZIP(), []int{0}}func (x *DatabaseMetadata) GetName() string {@@ -123,7 +123,7 @@ type SchemaMetadata struct {func (x *SchemaMetadata) Reset() {*x = SchemaMetadata{}if protoimpl.UnsafeEnabled {- mi := &file_database_proto_msgTypes[1]+ mi := &file_store_database_proto_msgTypes[1]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -136,7 +136,7 @@ func (x *SchemaMetadata) String() string {func (*SchemaMetadata) ProtoMessage() {}func (x *SchemaMetadata) ProtoReflect() protoreflect.Message {- mi := &file_database_proto_msgTypes[1]+ mi := &file_store_database_proto_msgTypes[1]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -149,7 +149,7 @@ func (x *SchemaMetadata) ProtoReflect() protoreflect.Message {// Deprecated: Use SchemaMetadata.ProtoReflect.Descriptor instead.func (*SchemaMetadata) Descriptor() ([]byte, []int) {- return file_database_proto_rawDescGZIP(), []int{1}+ return file_store_database_proto_rawDescGZIP(), []int{1}}func (x *SchemaMetadata) GetName() string {@@ -208,7 +208,7 @@ type TableMetadata struct {func (x *TableMetadata) Reset() {*x = TableMetadata{}if protoimpl.UnsafeEnabled {- mi := &file_database_proto_msgTypes[2]+ mi := &file_store_database_proto_msgTypes[2]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -221,7 +221,7 @@ func (x *TableMetadata) String() string {func (*TableMetadata) ProtoMessage() {}func (x *TableMetadata) ProtoReflect() protoreflect.Message {- mi := &file_database_proto_msgTypes[2]+ mi := &file_store_database_proto_msgTypes[2]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -234,7 +234,7 @@ func (x *TableMetadata) ProtoReflect() protoreflect.Message {// Deprecated: Use TableMetadata.ProtoReflect.Descriptor instead.func (*TableMetadata) Descriptor() ([]byte, []int) {- return file_database_proto_rawDescGZIP(), []int{2}+ return file_store_database_proto_rawDescGZIP(), []int{2}}func (x *TableMetadata) GetName() string {@@ -352,7 +352,7 @@ type ColumnMetadata struct {func (x *ColumnMetadata) Reset() {*x = ColumnMetadata{}if protoimpl.UnsafeEnabled {- mi := &file_database_proto_msgTypes[3]+ mi := &file_store_database_proto_msgTypes[3]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -365,7 +365,7 @@ func (x *ColumnMetadata) String() string {func (*ColumnMetadata) ProtoMessage() {}func (x *ColumnMetadata) ProtoReflect() protoreflect.Message {- mi := &file_database_proto_msgTypes[3]+ mi := &file_store_database_proto_msgTypes[3]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -378,7 +378,7 @@ func (x *ColumnMetadata) ProtoReflect() protoreflect.Message {// Deprecated: Use ColumnMetadata.ProtoReflect.Descriptor instead.func (*ColumnMetadata) Descriptor() ([]byte, []int) {- return file_database_proto_rawDescGZIP(), []int{3}+ return file_store_database_proto_rawDescGZIP(), []int{3}}func (x *ColumnMetadata) GetName() string {@@ -461,7 +461,7 @@ type ViewMetadata struct {func (x *ViewMetadata) Reset() {*x = ViewMetadata{}if protoimpl.UnsafeEnabled {- mi := &file_database_proto_msgTypes[4]+ mi := &file_store_database_proto_msgTypes[4]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -474,7 +474,7 @@ func (x *ViewMetadata) String() string {func (*ViewMetadata) ProtoMessage() {}func (x *ViewMetadata) ProtoReflect() protoreflect.Message {- mi := &file_database_proto_msgTypes[4]+ mi := &file_store_database_proto_msgTypes[4]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -487,7 +487,7 @@ func (x *ViewMetadata) ProtoReflect() protoreflect.Message {// Deprecated: Use ViewMetadata.ProtoReflect.Descriptor instead.func (*ViewMetadata) Descriptor() ([]byte, []int) {- return file_database_proto_rawDescGZIP(), []int{4}+ return file_store_database_proto_rawDescGZIP(), []int{4}}func (x *ViewMetadata) GetName() string {@@ -537,7 +537,7 @@ type IndexMetadata struct {func (x *IndexMetadata) Reset() {*x = IndexMetadata{}if protoimpl.UnsafeEnabled {- mi := &file_database_proto_msgTypes[5]+ mi := &file_store_database_proto_msgTypes[5]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -550,7 +550,7 @@ func (x *IndexMetadata) String() string {func (*IndexMetadata) ProtoMessage() {}func (x *IndexMetadata) ProtoReflect() protoreflect.Message {- mi := &file_database_proto_msgTypes[5]+ mi := &file_store_database_proto_msgTypes[5]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -563,7 +563,7 @@ func (x *IndexMetadata) ProtoReflect() protoreflect.Message {// Deprecated: Use IndexMetadata.ProtoReflect.Descriptor instead.func (*IndexMetadata) Descriptor() ([]byte, []int) {- return file_database_proto_rawDescGZIP(), []int{5}+ return file_store_database_proto_rawDescGZIP(), []int{5}}func (x *IndexMetadata) GetName() string {@@ -634,7 +634,7 @@ type ExtensionMetadata struct {func (x *ExtensionMetadata) Reset() {*x = ExtensionMetadata{}if protoimpl.UnsafeEnabled {- mi := &file_database_proto_msgTypes[6]+ mi := &file_store_database_proto_msgTypes[6]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -647,7 +647,7 @@ func (x *ExtensionMetadata) String() string {func (*ExtensionMetadata) ProtoMessage() {}func (x *ExtensionMetadata) ProtoReflect() protoreflect.Message {- mi := &file_database_proto_msgTypes[6]+ mi := &file_store_database_proto_msgTypes[6]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -660,7 +660,7 @@ func (x *ExtensionMetadata) ProtoReflect() protoreflect.Message {// Deprecated: Use ExtensionMetadata.ProtoReflect.Descriptor instead.func (*ExtensionMetadata) Descriptor() ([]byte, []int) {- return file_database_proto_rawDescGZIP(), []int{6}+ return file_store_database_proto_rawDescGZIP(), []int{6}}func (x *ExtensionMetadata) GetName() string {@@ -721,7 +721,7 @@ type ForeignKeyMetadata struct {func (x *ForeignKeyMetadata) Reset() {*x = ForeignKeyMetadata{}if protoimpl.UnsafeEnabled {- mi := &file_database_proto_msgTypes[7]+ mi := &file_store_database_proto_msgTypes[7]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -734,7 +734,7 @@ func (x *ForeignKeyMetadata) String() string {func (*ForeignKeyMetadata) ProtoMessage() {}func (x *ForeignKeyMetadata) ProtoReflect() protoreflect.Message {- mi := &file_database_proto_msgTypes[7]+ mi := &file_store_database_proto_msgTypes[7]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -747,7 +747,7 @@ func (x *ForeignKeyMetadata) ProtoReflect() protoreflect.Message {// Deprecated: Use ForeignKeyMetadata.ProtoReflect.Descriptor instead.func (*ForeignKeyMetadata) Descriptor() ([]byte, []int) {- return file_database_proto_rawDescGZIP(), []int{7}+ return file_store_database_proto_rawDescGZIP(), []int{7}}func (x *ForeignKeyMetadata) GetName() string {@@ -806,143 +806,143 @@ func (x *ForeignKeyMetadata) GetMatchType() string {return ""}-var File_database_proto protoreflect.FileDescriptor--var file_database_proto_rawDesc = []byte{- 0x0a, 0x0e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,- 0x12, 0x0e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65,- 0x22, 0xe6, 0x01, 0x0a, 0x10, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x4d, 0x65, 0x74,- 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,- 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x63, 0x68,- 0x65, 0x6d, 0x61, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x79, 0x74,- 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x63, 0x68, 0x65,- 0x6d, 0x61, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x07, 0x73, 0x63, 0x68, 0x65,- 0x6d, 0x61, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72,- 0x5f, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x68, 0x61, 0x72,- 0x61, 0x63, 0x74, 0x65, 0x72, 0x53, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6c, 0x6c,- 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6c,- 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73,- 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x62, 0x79, 0x74,- 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x78, 0x74, 0x65,- 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x0a, 0x65,- 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x8f, 0x01, 0x0a, 0x0e, 0x53, 0x63,- 0x68, 0x65, 0x6d, 0x61, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04,- 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,- 0x12, 0x35, 0x0a, 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,- 0x32, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72,- 0x65, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52,- 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x05, 0x76, 0x69, 0x65, 0x77, 0x73,- 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,- 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x4d, 0x65, 0x74, 0x61,- 0x64, 0x61, 0x74, 0x61, 0x52, 0x05, 0x76, 0x69, 0x65, 0x77, 0x73, 0x22, 0xca, 0x03, 0x0a, 0x0d,- 0x54, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a,- 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,- 0x65, 0x12, 0x38, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03,- 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74,- 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,- 0x74, 0x61, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x37, 0x0a, 0x07, 0x69,- 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62,- 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e,- 0x64, 0x65, 0x78, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x07, 0x69, 0x6e, 0x64,- 0x65, 0x78, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x18, 0x04,- 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, 0x1c, 0x0a, 0x09,- 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,- 0x09, 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f,- 0x77, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x72,- 0x6f, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x61, 0x74, 0x61, 0x5f,- 0x73, 0x69, 0x7a, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61,- 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x73, 0x69,- 0x7a, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x53,- 0x69, 0x7a, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x66, 0x72, 0x65, 0x65,- 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x46, 0x72, 0x65, 0x65,- 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f,- 0x6e, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65,- 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65,- 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e,- 0x74, 0x12, 0x45, 0x0a, 0x0c, 0x66, 0x6f, 0x72, 0x65, 0x69, 0x67, 0x6e, 0x5f, 0x6b, 0x65, 0x79,- 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,- 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x46, 0x6f, 0x72, 0x65, 0x69, 0x67, 0x6e,- 0x4b, 0x65, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x0b, 0x66, 0x6f, 0x72,- 0x65, 0x69, 0x67, 0x6e, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x88, 0x02, 0x0a, 0x0e, 0x43, 0x6f, 0x6c,- 0x75, 0x6d, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e,+var File_store_database_proto protoreflect.FileDescriptor++var file_store_database_proto_rawDesc = []byte{+ 0x0a, 0x14, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65,+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,+ 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0xe6, 0x01, 0x0a, 0x10, 0x44, 0x61, 0x74, 0x61, 0x62,+ 0x61, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e,0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,- 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,- 0x05, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x68,- 0x61, 0x73, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08,- 0x52, 0x0a, 0x68, 0x61, 0x73, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07,- 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64,- 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62,- 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62,- 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09,- 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63,- 0x74, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63,- 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x53, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x63,- 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,- 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d,- 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d,- 0x65, 0x6e, 0x74, 0x22, 0x5c, 0x0a, 0x0c, 0x56, 0x69, 0x65, 0x77, 0x4d, 0x65, 0x74, 0x61, 0x64,+ 0x38, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,+ 0x32, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72,+ 0x65, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,+ 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x68, 0x61,+ 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,+ 0x52, 0x0c, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x53, 0x65, 0x74, 0x12, 0x1c,+ 0x0a, 0x09, 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28,+ 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x0a,+ 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b,+ 0x32, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72,+ 0x65, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x64,+ 0x61, 0x74, 0x61, 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22,+ 0x8f, 0x01, 0x0a, 0x0e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,+ 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,+ 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73,+ 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,+ 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x65, 0x74,+ 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, 0x32, 0x0a,+ 0x05, 0x76, 0x69, 0x65, 0x77, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x62,+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x56, 0x69,+ 0x65, 0x77, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x05, 0x76, 0x69, 0x65, 0x77,+ 0x73, 0x22, 0xca, 0x03, 0x0a, 0x0d, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64,0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,- 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x66, 0x69, 0x6e,- 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x66,- 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65,- 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e,- 0x74, 0x22, 0xbf, 0x01, 0x0a, 0x0d, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4d, 0x65, 0x74, 0x61, 0x64,- 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,- 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x72, 0x65,- 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x78,- 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70,- 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a,- 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x75,- 0x6e, 0x69, 0x71, 0x75, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79,- 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x12,- 0x18, 0x0a, 0x07, 0x76, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08,- 0x52, 0x07, 0x76, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d,- 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d,- 0x65, 0x6e, 0x74, 0x22, 0x7b, 0x0a, 0x11, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e,- 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,- 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06,- 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63,- 0x68, 0x65, 0x6d, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18,- 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x20,- 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20,- 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e,- 0x22, 0xa2, 0x02, 0x0a, 0x12, 0x46, 0x6f, 0x72, 0x65, 0x69, 0x67, 0x6e, 0x4b, 0x65, 0x79, 0x4d,- 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,- 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63,- 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f,- 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,- 0x63, 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,- 0x52, 0x10, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65,- 0x6d, 0x61, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x64,- 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65,- 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x64, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x2d, 0x0a,- 0x12, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x75,- 0x6d, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x72, 0x65, 0x66, 0x65, 0x72,- 0x65, 0x6e, 0x63, 0x65, 0x64, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x1b, 0x0a, 0x09,- 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52,- 0x08, 0x6f, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6f, 0x6e, 0x5f,- 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6f, 0x6e,- 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f,- 0x74, 0x79, 0x70, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63,- 0x68, 0x54, 0x79, 0x70, 0x65, 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,+ 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d,+ 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,+ 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e,+ 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e,+ 0x73, 0x12, 0x37, 0x0a, 0x07, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03,+ 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74,+ 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,+ 0x61, 0x52, 0x07, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e,+ 0x67, 0x69, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x6e, 0x67, 0x69,+ 0x6e, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18,+ 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,+ 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x77, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20,+ 0x01, 0x28, 0x03, 0x52, 0x08, 0x72, 0x6f, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1b, 0x0a,+ 0x09, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03,+ 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e,+ 0x64, 0x65, 0x78, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09,+ 0x69, 0x6e, 0x64, 0x65, 0x78, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x61, 0x74,+ 0x61, 0x5f, 0x66, 0x72, 0x65, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x61,+ 0x74, 0x61, 0x46, 0x72, 0x65, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65,+ 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d,+ 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x18, 0x0a,+ 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,+ 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0c, 0x66, 0x6f, 0x72, 0x65, 0x69,+ 0x67, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e,+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x46,+ 0x6f, 0x72, 0x65, 0x69, 0x67, 0x6e, 0x4b, 0x65, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,+ 0x61, 0x52, 0x0b, 0x66, 0x6f, 0x72, 0x65, 0x69, 0x67, 0x6e, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x88,+ 0x02, 0x0a, 0x0e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,+ 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,+ 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,+ 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x68, 0x61, 0x73, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74,+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x68, 0x61, 0x73, 0x44, 0x65, 0x66, 0x61, 0x75,+ 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x04, 0x20,+ 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x1a, 0x0a, 0x08,+ 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08,+ 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,+ 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x23, 0x0a, 0x0d,+ 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x18, 0x07, 0x20,+ 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x53, 0x65,+ 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08,+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12,+ 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09,+ 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x5c, 0x0a, 0x0c, 0x56, 0x69, 0x65,+ 0x77, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,+ 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a,+ 0x0a, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,+ 0x09, 0x52, 0x0a, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a,+ 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,+ 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0xbf, 0x01, 0x0a, 0x0d, 0x49, 0x6e, 0x64, 0x65,+ 0x78, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,+ 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a,+ 0x0b, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03,+ 0x28, 0x09, 0x52, 0x0b, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12,+ 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74,+ 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x18, 0x04, 0x20,+ 0x01, 0x28, 0x08, 0x52, 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70,+ 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x70, 0x72,+ 0x69, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65,+ 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x76, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x12,+ 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09,+ 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x7b, 0x0a, 0x11, 0x45, 0x78, 0x74,+ 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12,+ 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,+ 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01,+ 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65,+ 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72,+ 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,+ 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,+ 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xa2, 0x02, 0x0a, 0x12, 0x46, 0x6f, 0x72, 0x65, 0x69,+ 0x67, 0x6e, 0x4b, 0x65, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a,+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,+ 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03,+ 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x72,+ 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61,+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,+ 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x66, 0x65,+ 0x72, 0x65, 0x6e, 0x63, 0x65, 0x64, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01,+ 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x64, 0x54, 0x61,+ 0x62, 0x6c, 0x65, 0x12, 0x2d, 0x0a, 0x12, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65,+ 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52,+ 0x11, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x64, 0x43, 0x6f, 0x6c, 0x75, 0x6d,+ 0x6e, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18,+ 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6f, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12,+ 0x1b, 0x0a, 0x09, 0x6f, 0x6e, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01,+ 0x28, 0x09, 0x52, 0x08, 0x6f, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x1d, 0x0a, 0x0a,+ 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09,+ 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 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_database_proto_rawDescOnce sync.Once- file_database_proto_rawDescData = file_database_proto_rawDesc+ file_store_database_proto_rawDescOnce sync.Once+ file_store_database_proto_rawDescData = file_store_database_proto_rawDesc)-func file_database_proto_rawDescGZIP() []byte {- file_database_proto_rawDescOnce.Do(func() {- file_database_proto_rawDescData = protoimpl.X.CompressGZIP(file_database_proto_rawDescData)+func file_store_database_proto_rawDescGZIP() []byte {+ file_store_database_proto_rawDescOnce.Do(func() {+ file_store_database_proto_rawDescData = protoimpl.X.CompressGZIP(file_store_database_proto_rawDescData)})- return file_database_proto_rawDescData+ return file_store_database_proto_rawDescData}-var file_database_proto_msgTypes = make([]protoimpl.MessageInfo, 8)-var file_database_proto_goTypes = []interface{}{+var file_store_database_proto_msgTypes = make([]protoimpl.MessageInfo, 8)+var file_store_database_proto_goTypes = []interface{}{(*DatabaseMetadata)(nil), // 0: bytebase.store.DatabaseMetadata(*SchemaMetadata)(nil), // 1: bytebase.store.SchemaMetadata(*TableMetadata)(nil), // 2: bytebase.store.TableMetadata@@ -952,7 +952,7 @@ var file_database_proto_goTypes = []interface{}{(*ExtensionMetadata)(nil), // 6: bytebase.store.ExtensionMetadata(*ForeignKeyMetadata)(nil), // 7: bytebase.store.ForeignKeyMetadata}-var file_database_proto_depIdxs = []int32{+var file_store_database_proto_depIdxs = []int32{1, // 0: bytebase.store.DatabaseMetadata.schemas:type_name -> bytebase.store.SchemaMetadata6, // 1: bytebase.store.DatabaseMetadata.extensions:type_name -> bytebase.store.ExtensionMetadata2, // 2: bytebase.store.SchemaMetadata.tables:type_name -> bytebase.store.TableMetadata@@ -967,13 +967,13 @@ var file_database_proto_depIdxs = []int32{0, // [0:7] is the sub-list for field type_name}-func init() { file_database_proto_init() }-func file_database_proto_init() {- if File_database_proto != nil {+func init() { file_store_database_proto_init() }+func file_store_database_proto_init() {+ if File_store_database_proto != nil {return}if !protoimpl.UnsafeEnabled {- file_database_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {+ file_store_database_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*DatabaseMetadata); i {case 0:return &v.state@@ -985,7 +985,7 @@ func file_database_proto_init() {return nil}}- file_database_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {+ file_store_database_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*SchemaMetadata); i {case 0:return &v.state@@ -997,7 +997,7 @@ func file_database_proto_init() {return nil}}- file_database_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {+ file_store_database_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*TableMetadata); i {case 0:return &v.state@@ -1009,7 +1009,7 @@ func file_database_proto_init() {return nil}}- file_database_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {+ file_store_database_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*ColumnMetadata); i {case 0:return &v.state@@ -1021,7 +1021,7 @@ func file_database_proto_init() {return nil}}- file_database_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {+ file_store_database_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*ViewMetadata); i {case 0:return &v.state@@ -1033,7 +1033,7 @@ func file_database_proto_init() {return nil}}- file_database_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {+ file_store_database_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*IndexMetadata); i {case 0:return &v.state@@ -1045,7 +1045,7 @@ func file_database_proto_init() {return nil}}- file_database_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {+ file_store_database_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*ExtensionMetadata); i {case 0:return &v.state@@ -1057,7 +1057,7 @@ func file_database_proto_init() {return nil}}- file_database_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {+ file_store_database_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*ForeignKeyMetadata); i {case 0:return &v.state@@ -1074,18 +1074,18 @@ func file_database_proto_init() {out := protoimpl.TypeBuilder{File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),- RawDescriptor: file_database_proto_rawDesc,+ RawDescriptor: file_store_database_proto_rawDesc,NumEnums: 0,NumMessages: 8,NumExtensions: 0,NumServices: 0,},- GoTypes: file_database_proto_goTypes,- DependencyIndexes: file_database_proto_depIdxs,- MessageInfos: file_database_proto_msgTypes,+ GoTypes: file_store_database_proto_goTypes,+ DependencyIndexes: file_store_database_proto_depIdxs,+ MessageInfos: file_store_database_proto_msgTypes,}.Build()- File_database_proto = out.File- file_database_proto_rawDesc = nil- file_database_proto_goTypes = nil- file_database_proto_depIdxs = nil+ File_store_database_proto = out.File+ file_store_database_proto_rawDesc = nil+ file_store_database_proto_goTypes = nil+ file_store_database_proto_depIdxs = nil}diff --git a/proto/generated-go/v1/database_role.pb.go b/proto/generated-go/v1/database_role.pb.gonew file mode 100644index 0000000000..65a01578d4--- /dev/null+++ b/proto/generated-go/v1/database_role.pb.go@@ -0,0 +1,445 @@+// Code generated by protoc-gen-go. DO NOT EDIT.+// versions:+// protoc-gen-go v1.28.1+// protoc v3.21.12+// source: v1/database_role.proto++package v1++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)+)++// RoleAttribute is the attribute for role. Docs: https://www.postgresql.org/docs/current/role-attributes.html+type DatabaseRoleAttribute struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // A database superuser bypasses all permission checks, except the right to log in.+ SuperUser bool `protobuf:"varint,1,opt,name=super_user,json=superUser,proto3" json:"super_user,omitempty"`+ // A role is given permission to inherit the privileges of roles it is a member of. To create a role without the permission, use "noInherit = true"+ NoInherit bool `protobuf:"varint,2,opt,name=no_inherit,json=noInherit,proto3" json:"no_inherit,omitempty"`+ // A role must be explicitly given permission to create more roles (except for superusers, since those bypass all permission checks).+ CreateRole bool `protobuf:"varint,3,opt,name=create_role,json=createRole,proto3" json:"create_role,omitempty"`+ // A role must be explicitly given permission to create databases (except for superusers, since those bypass all permission checks).+ CreateDb bool `protobuf:"varint,4,opt,name=create_db,json=createDb,proto3" json:"create_db,omitempty"`+ // Only roles that have the LOGIN attribute can be used as the initial role name for a database connection.+ CanLogin bool `protobuf:"varint,5,opt,name=can_login,json=canLogin,proto3" json:"can_login,omitempty"`+ // A role must explicitly be given permission to initiate streaming replication (except for superusers, since those bypass all permission checks).+ Replication bool `protobuf:"varint,6,opt,name=replication,proto3" json:"replication,omitempty"`+ // A role must be explicitly given permission to bypass every row-level security (RLS) policy (except for superusers, since those bypass all permission checks).+ BypassRls bool `protobuf:"varint,7,opt,name=bypass_rls,json=bypassRls,proto3" json:"bypass_rls,omitempty"`+}++func (x *DatabaseRoleAttribute) Reset() {+ *x = DatabaseRoleAttribute{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_database_role_proto_msgTypes[0]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *DatabaseRoleAttribute) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*DatabaseRoleAttribute) ProtoMessage() {}++func (x *DatabaseRoleAttribute) ProtoReflect() protoreflect.Message {+ mi := &file_v1_database_role_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 DatabaseRoleAttribute.ProtoReflect.Descriptor instead.+func (*DatabaseRoleAttribute) Descriptor() ([]byte, []int) {+ return file_v1_database_role_proto_rawDescGZIP(), []int{0}+}++func (x *DatabaseRoleAttribute) GetSuperUser() bool {+ if x != nil {+ return x.SuperUser+ }+ return false+}++func (x *DatabaseRoleAttribute) GetNoInherit() bool {+ if x != nil {+ return x.NoInherit+ }+ return false+}++func (x *DatabaseRoleAttribute) GetCreateRole() bool {+ if x != nil {+ return x.CreateRole+ }+ return false+}++func (x *DatabaseRoleAttribute) GetCreateDb() bool {+ if x != nil {+ return x.CreateDb+ }+ return false+}++func (x *DatabaseRoleAttribute) GetCanLogin() bool {+ if x != nil {+ return x.CanLogin+ }+ return false+}++func (x *DatabaseRoleAttribute) GetReplication() bool {+ if x != nil {+ return x.Replication+ }+ return false+}++func (x *DatabaseRoleAttribute) GetBypassRls() bool {+ if x != nil {+ return x.BypassRls+ }+ return false+}++// DatabaseRole is the API message for database role.+type DatabaseRole struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // The role unique name.+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`+ // The Bytebase instance id for this role.+ InstanceId int32 `protobuf:"varint,2,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"`+ // The connection count limit for this role.+ ConnectionLimit int32 `protobuf:"varint,3,opt,name=connection_limit,json=connectionLimit,proto3" json:"connection_limit,omitempty"`+ // The expiration for the role's password.+ ValidUntil *string `protobuf:"bytes,4,opt,name=valid_until,json=validUntil,proto3,oneof" json:"valid_until,omitempty"`+ // The role attribute.+ Attribute *DatabaseRoleAttribute `protobuf:"bytes,5,opt,name=attribute,proto3" json:"attribute,omitempty"`+}++func (x *DatabaseRole) Reset() {+ *x = DatabaseRole{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_database_role_proto_msgTypes[1]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *DatabaseRole) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*DatabaseRole) ProtoMessage() {}++func (x *DatabaseRole) ProtoReflect() protoreflect.Message {+ mi := &file_v1_database_role_proto_msgTypes[1]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use DatabaseRole.ProtoReflect.Descriptor instead.+func (*DatabaseRole) Descriptor() ([]byte, []int) {+ return file_v1_database_role_proto_rawDescGZIP(), []int{1}+}++func (x *DatabaseRole) GetName() string {+ if x != nil {+ return x.Name+ }+ return ""+}++func (x *DatabaseRole) GetInstanceId() int32 {+ if x != nil {+ return x.InstanceId+ }+ return 0+}++func (x *DatabaseRole) GetConnectionLimit() int32 {+ if x != nil {+ return x.ConnectionLimit+ }+ return 0+}++func (x *DatabaseRole) GetValidUntil() string {+ if x != nil && x.ValidUntil != nil {+ return *x.ValidUntil+ }+ return ""+}++func (x *DatabaseRole) GetAttribute() *DatabaseRoleAttribute {+ if x != nil {+ return x.Attribute+ }+ return nil+}++// DatabaseRoleUpsert is the API message for upserting a database role.+type DatabaseRoleUpsert struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // The role unique name.+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`+ // A password is only significant if the client authentication method requires the user to supply a password when connecting to the database.+ Password *string `protobuf:"bytes,2,opt,name=password,proto3,oneof" json:"password,omitempty"`+ // Connection limit can specify how many concurrent connections a role can make. -1 (the default) means no limit.+ ConnectionLimit *int32 `protobuf:"varint,3,opt,name=connection_limit,json=connectionLimit,proto3,oneof" json:"connection_limit,omitempty"`+ // The VALID UNTIL clause sets a date and time after which the role's password is no longer valid. If this clause is omitted the password will be valid for all time.+ ValidUntil *string `protobuf:"bytes,4,opt,name=valid_until,json=validUntil,proto3,oneof" json:"valid_until,omitempty"`+ // The role attribute.+ Attribute *DatabaseRoleAttribute `protobuf:"bytes,5,opt,name=attribute,proto3,oneof" json:"attribute,omitempty"`+}++func (x *DatabaseRoleUpsert) Reset() {+ *x = DatabaseRoleUpsert{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_database_role_proto_msgTypes[2]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *DatabaseRoleUpsert) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*DatabaseRoleUpsert) ProtoMessage() {}++func (x *DatabaseRoleUpsert) ProtoReflect() protoreflect.Message {+ mi := &file_v1_database_role_proto_msgTypes[2]+ 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 DatabaseRoleUpsert.ProtoReflect.Descriptor instead.+func (*DatabaseRoleUpsert) Descriptor() ([]byte, []int) {+ return file_v1_database_role_proto_rawDescGZIP(), []int{2}+}++func (x *DatabaseRoleUpsert) GetName() string {+ if x != nil {+ return x.Name+ }+ return ""+}++func (x *DatabaseRoleUpsert) GetPassword() string {+ if x != nil && x.Password != nil {+ return *x.Password+ }+ return ""+}++func (x *DatabaseRoleUpsert) GetConnectionLimit() int32 {+ if x != nil && x.ConnectionLimit != nil {+ return *x.ConnectionLimit+ }+ return 0+}++func (x *DatabaseRoleUpsert) GetValidUntil() string {+ if x != nil && x.ValidUntil != nil {+ return *x.ValidUntil+ }+ return ""+}++func (x *DatabaseRoleUpsert) GetAttribute() *DatabaseRoleAttribute {+ if x != nil {+ return x.Attribute+ }+ return nil+}++var File_v1_database_role_proto protoreflect.FileDescriptor++var file_v1_database_role_proto_rawDesc = []byte{+ 0x0a, 0x16, 0x76, 0x31, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x72, 0x6f,+ 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,+ 0x73, 0x65, 0x2e, 0x76, 0x31, 0x22, 0xf1, 0x01, 0x0a, 0x15, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61,+ 0x73, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12,+ 0x1d, 0x0a, 0x0a, 0x73, 0x75, 0x70, 0x65, 0x72, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20,+ 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x75, 0x70, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1d,+ 0x0a, 0x0a, 0x6e, 0x6f, 0x5f, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01,+ 0x28, 0x08, 0x52, 0x09, 0x6e, 0x6f, 0x49, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x12, 0x1f, 0x0a,+ 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01,+ 0x28, 0x08, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x1b,+ 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x64, 0x62, 0x18, 0x04, 0x20, 0x01, 0x28,+ 0x08, 0x52, 0x08, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x62, 0x12, 0x1b, 0x0a, 0x09, 0x63,+ 0x61, 0x6e, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08,+ 0x63, 0x61, 0x6e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x65, 0x70, 0x6c,+ 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x72,+ 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x79,+ 0x70, 0x61, 0x73, 0x73, 0x5f, 0x72, 0x6c, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09,+ 0x62, 0x79, 0x70, 0x61, 0x73, 0x73, 0x52, 0x6c, 0x73, 0x22, 0xe6, 0x01, 0x0a, 0x0c, 0x44, 0x61,+ 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,+ 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1f,+ 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20,+ 0x01, 0x28, 0x05, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12,+ 0x29, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69,+ 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x65,+ 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x24, 0x0a, 0x0b, 0x76, 0x61,+ 0x6c, 0x69, 0x64, 0x5f, 0x75, 0x6e, 0x74, 0x69, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48,+ 0x00, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x55, 0x6e, 0x74, 0x69, 0x6c, 0x88, 0x01, 0x01,+ 0x12, 0x40, 0x0a, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x05, 0x20,+ 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,+ 0x31, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x41, 0x74,+ 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75,+ 0x74, 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x5f, 0x75, 0x6e, 0x74,+ 0x69, 0x6c, 0x22, 0xa6, 0x02, 0x0a, 0x12, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52,+ 0x6f, 0x6c, 0x65, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,+ 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a,+ 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48,+ 0x00, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x88, 0x01, 0x01, 0x12, 0x2e,+ 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69, 0x6d,+ 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x6e,+ 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x88, 0x01, 0x01, 0x12, 0x24,+ 0x0a, 0x0b, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x5f, 0x75, 0x6e, 0x74, 0x69, 0x6c, 0x18, 0x04, 0x20,+ 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x55, 0x6e, 0x74, 0x69,+ 0x6c, 0x88, 0x01, 0x01, 0x12, 0x45, 0x0a, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74,+ 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,+ 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x6f,+ 0x6c, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x48, 0x03, 0x52, 0x09, 0x61,+ 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0b, 0x0a, 0x09, 0x5f,+ 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x42, 0x13, 0x0a, 0x11, 0x5f, 0x63, 0x6f, 0x6e,+ 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x42, 0x0e, 0x0a,+ 0x0c, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x5f, 0x75, 0x6e, 0x74, 0x69, 0x6c, 0x42, 0x0c, 0x0a,+ 0x0a, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x42, 0x11, 0x5a, 0x0f, 0x67,+ 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06,+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,+}++var (+ file_v1_database_role_proto_rawDescOnce sync.Once+ file_v1_database_role_proto_rawDescData = file_v1_database_role_proto_rawDesc+)++func file_v1_database_role_proto_rawDescGZIP() []byte {+ file_v1_database_role_proto_rawDescOnce.Do(func() {+ file_v1_database_role_proto_rawDescData = protoimpl.X.CompressGZIP(file_v1_database_role_proto_rawDescData)+ })+ return file_v1_database_role_proto_rawDescData+}++var file_v1_database_role_proto_msgTypes = make([]protoimpl.MessageInfo, 3)+var file_v1_database_role_proto_goTypes = []interface{}{+ (*DatabaseRoleAttribute)(nil), // 0: bytebase.v1.DatabaseRoleAttribute+ (*DatabaseRole)(nil), // 1: bytebase.v1.DatabaseRole+ (*DatabaseRoleUpsert)(nil), // 2: bytebase.v1.DatabaseRoleUpsert+}+var file_v1_database_role_proto_depIdxs = []int32{+ 0, // 0: bytebase.v1.DatabaseRole.attribute:type_name -> bytebase.v1.DatabaseRoleAttribute+ 0, // 1: bytebase.v1.DatabaseRoleUpsert.attribute:type_name -> bytebase.v1.DatabaseRoleAttribute+ 2, // [2:2] is the sub-list for method output_type+ 2, // [2:2] is the sub-list for method input_type+ 2, // [2:2] is the sub-list for extension type_name+ 2, // [2:2] is the sub-list for extension extendee+ 0, // [0:2] is the sub-list for field type_name+}++func init() { file_v1_database_role_proto_init() }+func file_v1_database_role_proto_init() {+ if File_v1_database_role_proto != nil {+ return+ }+ if !protoimpl.UnsafeEnabled {+ file_v1_database_role_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*DatabaseRoleAttribute); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_database_role_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*DatabaseRole); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_database_role_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*DatabaseRoleUpsert); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ }+ file_v1_database_role_proto_msgTypes[1].OneofWrappers = []interface{}{}+ file_v1_database_role_proto_msgTypes[2].OneofWrappers = []interface{}{}+ type x struct{}+ out := protoimpl.TypeBuilder{+ File: protoimpl.DescBuilder{+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),+ RawDescriptor: file_v1_database_role_proto_rawDesc,+ NumEnums: 0,+ NumMessages: 3,+ NumExtensions: 0,+ NumServices: 0,+ },+ GoTypes: file_v1_database_role_proto_goTypes,+ DependencyIndexes: file_v1_database_role_proto_depIdxs,+ MessageInfos: file_v1_database_role_proto_msgTypes,+ }.Build()+ File_v1_database_role_proto = out.File+ file_v1_database_role_proto_rawDesc = nil+ file_v1_database_role_proto_goTypes = nil+ file_v1_database_role_proto_depIdxs = nil+}diff --git a/proto/v1/database_role.proto b/proto/v1/database_role.protonew file mode 100644index 0000000000..16783b4334--- /dev/null+++ b/proto/v1/database_role.proto@@ -0,0 +1,64 @@+syntax = "proto3";++package bytebase.v1;+option go_package = "generated-go/v1";++// RoleAttribute is the attribute for role. Docs: https://www.postgresql.org/docs/current/role-attributes.html+message DatabaseRoleAttribute {+ // A database superuser bypasses all permission checks, except the right to log in.+ bool super_user = 1;++ // A role is given permission to inherit the privileges of roles it is a member of. To create a role without the permission, use "noInherit = true"+ bool no_inherit = 2;++ // A role must be explicitly given permission to create more roles (except for superusers, since those bypass all permission checks).+ bool create_role = 3;++ // A role must be explicitly given permission to create databases (except for superusers, since those bypass all permission checks).+ bool create_db = 4;++ // Only roles that have the LOGIN attribute can be used as the initial role name for a database connection.+ bool can_login = 5;++ // A role must explicitly be given permission to initiate streaming replication (except for superusers, since those bypass all permission checks).+ bool replication = 6;++ // A role must be explicitly given permission to bypass every row-level security (RLS) policy (except for superusers, since those bypass all permission checks).+ bool bypass_rls = 7;+}++// DatabaseRole is the API message for database role.+message DatabaseRole {+ // The role unique name.+ string name = 1;++ // The Bytebase instance id for this role.+ int32 instance_id = 2;++ // The connection count limit for this role.+ int32 connection_limit = 3;++ // The expiration for the role's password.+ optional string valid_until = 4;++ // The role attribute.+ DatabaseRoleAttribute attribute = 5;+}++// DatabaseRoleUpsert is the API message for upserting a database role.+message DatabaseRoleUpsert {+ // The role unique name.+ string name = 1;++ // A password is only significant if the client authentication method requires the user to supply a password when connecting to the database.+ optional string password = 2;++ // Connection limit can specify how many concurrent connections a role can make. -1 (the default) means no limit.+ optional int32 connection_limit = 3;++ // The VALID UNTIL clause sets a date and time after which the role's password is no longer valid. If this clause is omitted the password will be valid for all time.+ optional string valid_until = 4;++ // The role attribute.+ optional DatabaseRoleAttribute attribute = 5;+}diff --git a/server/openapi_instance.go b/server/openapi_instance.goindex 30223b26cc..1b031ad16d 100644--- a/server/openapi_instance.go+++ b/server/openapi_instance.go@@ -10,10 +10,13 @@ import ("time""github.com/labstack/echo/v4"+ "google.golang.org/protobuf/encoding/protojson""github.com/bytebase/bytebase/api"openAPIV1 "github.com/bytebase/bytebase/api/v1"- "github.com/bytebase/bytebase/plugin/db"+ "github.com/bytebase/bytebase/common"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"+"github.com/bytebase/bytebase/store")@@ -199,7 +202,7 @@ func (s *Server) getDatabaseRole(c echo.Context) error {return err}- role, err := func() (*db.Role, error) {+ role, err := func() (*v1pb.DatabaseRole, error) {driver, err := s.dbFactory.GetAdminDatabaseDriver(ctx, instance, "" /* database name */)if err != nil {return nil, err@@ -214,10 +217,13 @@ func (s *Server) getDatabaseRole(c echo.Context) error {return role, nil}()if err != nil {+ if common.ErrorCode(err) == common.NotFound {+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Cannot found the role %s in instance %d", roleName, instance.ID))+ }return echo.NewHTTPError(http.StatusInternalServerError, "Failed to query the role").SetInternal(err)}- return c.JSON(http.StatusOK, convertToOpenAPIDatabaseRole(role, instance.ID))+ return marshalDatabaseRoleResponse(c, role, instance.ID)}func (s *Server) createDatabaseRole(c echo.Context) error {@@ -228,9 +234,9 @@ func (s *Server) createDatabaseRole(c echo.Context) error {return echo.NewHTTPError(http.StatusBadRequest, "Failed to read request body").SetInternal(err)}- upsert := &db.RoleUpsert{}- if err := json.Unmarshal(body, upsert); err != nil {- return echo.NewHTTPError(http.StatusBadRequest, "Malformed create role request").SetInternal(err)+ var upsert v1pb.DatabaseRoleUpsert+ if err := protojson.Unmarshal(body, &upsert); err != nil {+ return err}instance, err := s.validateInstance(ctx, c)@@ -238,14 +244,14 @@ func (s *Server) createDatabaseRole(c echo.Context) error {return err}- role, err := func() (*db.Role, error) {+ role, err := func() (*v1pb.DatabaseRole, error) {driver, err := s.dbFactory.GetAdminDatabaseDriver(ctx, instance, "" /* database name */)if err != nil {return nil, err}defer driver.Close(ctx)- role, err := driver.CreateRole(ctx, upsert)+ role, err := driver.CreateRole(ctx, &upsert)if err != nil {return nil, err}@@ -256,7 +262,7 @@ func (s *Server) createDatabaseRole(c echo.Context) error {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to query the role").SetInternal(err)}- return c.JSON(http.StatusOK, convertToOpenAPIDatabaseRole(role, instance.ID))+ return marshalDatabaseRoleResponse(c, role, instance.ID)}func (s *Server) deleteDatabaseRole(c echo.Context) error {@@ -291,9 +297,9 @@ func (s *Server) updateDatabaseRole(c echo.Context) error {return echo.NewHTTPError(http.StatusBadRequest, "Failed to read request body").SetInternal(err)}- upsert := &db.RoleUpsert{}- if err := json.Unmarshal(body, upsert); err != nil {- return echo.NewHTTPError(http.StatusBadRequest, "Malformed create role request").SetInternal(err)+ var upsert v1pb.DatabaseRoleUpsert+ if err := protojson.Unmarshal(body, &upsert); err != nil {+ return err}instance, err := s.validateInstance(ctx, c)@@ -302,14 +308,14 @@ func (s *Server) updateDatabaseRole(c echo.Context) error {}rawName := c.Param("roleName")- role, err := func() (*db.Role, error) {+ role, err := func() (*v1pb.DatabaseRole, error) {driver, err := s.dbFactory.GetAdminDatabaseDriver(ctx, instance, "" /* database name */)if err != nil {return nil, err}defer driver.Close(ctx)- role, err := driver.UpdateRole(ctx, rawName, upsert)+ role, err := driver.UpdateRole(ctx, rawName, &upsert)if err != nil {return nil, err}@@ -320,7 +326,7 @@ func (s *Server) updateDatabaseRole(c echo.Context) error {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to query the role").SetInternal(err)}- return c.JSON(http.StatusOK, convertToOpenAPIDatabaseRole(role, instance.ID))+ return marshalDatabaseRoleResponse(c, role, instance.ID)}func (s *Server) validateInstance(ctx context.Context, c echo.Context) (*api.Instance, error) {@@ -340,14 +346,23 @@ func (s *Server) validateInstance(ctx context.Context, c echo.Context) (*api.Insreturn instance, nil}-func convertToOpenAPIDatabaseRole(role *db.Role, instanceID int) *openAPIV1.DatabaseRole {- return &openAPIV1.DatabaseRole{+func marshalDatabaseRoleResponse(c echo.Context, role *v1pb.DatabaseRole, instanceID int) error {+ c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)+ metadataBytes, err := protojson.Marshal(&v1pb.DatabaseRole{Name: role.Name,- InstanceID: instanceID,+ InstanceId: int32(instanceID),ConnectionLimit: role.ConnectionLimit,ValidUntil: role.ValidUntil,Attribute: role.Attribute,+ })+ if err != nil {+ return err}+ if _, err := c.Response().Write(metadataBytes); err != nil {+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to write schema response for role %v", role.Name)).SetInternal(err)+ }++ return nil}func convertToOpenAPIInstance(instance *api.Instance) *openAPIV1.Instance {