Skip to content

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

chore: sync the sort order of index key (#12395)

rebelice92aaf7a25c30
diff --git a/backend/api/v1/database_converter.go b/backend/api/v1/database_converter.go
index c8ff6669b9..7b978c1f6b 100644
--- a/backend/api/v1/database_converter.go
+++ b/backend/api/v1/database_converter.go
@@ -178,6 +178,7 @@ func convertStoreTableMetadata(table *storepb.TableMetadata) *v1pb.TableMetadata
Name: index.Name,
Expressions: index.Expressions,
KeyLength: index.KeyLength,
+ Descending: index.Descending,
Type: index.Type,
Unique: index.Unique,
Primary: index.Primary,
@@ -570,6 +571,7 @@ func convertV1TableMetadata(table *v1pb.TableMetadata) *storepb.TableMetadata {
Name: index.Name,
Expressions: index.Expressions,
KeyLength: index.KeyLength,
+ Descending: index.Descending,
Type: index.Type,
Unique: index.Unique,
Primary: index.Primary,
diff --git a/backend/plugin/db/mysql/sync.go b/backend/plugin/db/mysql/sync.go
index 7ad3be907d..26ff6f54c9 100644
--- a/backend/plugin/db/mysql/sync.go
+++ b/backend/plugin/db/mysql/sync.go
@@ -164,6 +164,7 @@ func (driver *Driver) SyncDBSchema(ctx context.Context) (*storepb.DatabaseSchema
TABLE_NAME,
INDEX_NAME,
COLUMN_NAME,
+ COLLATION,
IFNULL(SUB_PART, -1),
'',
SEQ_IN_INDEX,
@@ -184,6 +185,7 @@ func (driver *Driver) SyncDBSchema(ctx context.Context) (*storepb.DatabaseSchema
TABLE_NAME,
INDEX_NAME,
COLUMN_NAME,
+ COLLATION,
IFNULL(SUB_PART, -1),
EXPRESSION,
SEQ_IN_INDEX,
@@ -204,6 +206,7 @@ func (driver *Driver) SyncDBSchema(ctx context.Context) (*storepb.DatabaseSchema
var tableName, indexName, indexType, comment, expression string
var columnName sql.NullString
var expressionName sql.NullString
+ var collation sql.NullString
var position int
var subPart int64
var unique, visible bool
@@ -211,6 +214,7 @@ func (driver *Driver) SyncDBSchema(ctx context.Context) (*storepb.DatabaseSchema
&tableName,
&indexName,
&columnName,
+ &collation,
&subPart,
&expressionName,
&position,
@@ -229,6 +233,11 @@ func (driver *Driver) SyncDBSchema(ctx context.Context) (*storepb.DatabaseSchema
expression = fmt.Sprintf("(%s)", expressionName.String)
}
+ desc := false
+ if collation.Valid && collation.String == "D" {
+ desc = true
+ }
+
key := db.TableKey{Schema: "", Table: tableName}
if _, ok := indexMap[key]; !ok {
indexMap[key] = make(map[string]*storepb.IndexMetadata)
@@ -245,6 +254,7 @@ func (driver *Driver) SyncDBSchema(ctx context.Context) (*storepb.DatabaseSchema
}
indexMap[key][indexName].Expressions = append(indexMap[key][indexName].Expressions, expression)
indexMap[key][indexName].KeyLength = append(indexMap[key][indexName].KeyLength, subPart)
+ indexMap[key][indexName].Descending = append(indexMap[key][indexName].Descending, desc)
}
if err := indexRows.Err(); err != nil {
return nil, util.FormatErrorWithQuery(err, indexQuery)
diff --git a/backend/tests/syncer_test.go b/backend/tests/syncer_test.go
index c047c4417a..d1c1c89579 100644
--- a/backend/tests/syncer_test.go
+++ b/backend/tests/syncer_test.go
@@ -272,6 +272,9 @@ func TestSyncerForMySQL(t *testing.T) {
"keyLength": [
"-1"
],
+ "descending": [
+ false
+ ],
"type":"BTREE",
"unique":true,
"primary":true,
@@ -323,6 +326,11 @@ func TestSyncerForMySQL(t *testing.T) {
-1,
-1
],
+ "descending": [
+ false,
+ false,
+ false
+ ],
"type":"BTREE",
"visible":true
}
@@ -405,6 +413,11 @@ func TestSyncerForMySQL(t *testing.T) {
-1,
-1
],
+ "descending": [
+ false,
+ false,
+ false
+ ],
"type":"BTREE",
"unique":true,
"visible":true
diff --git a/frontend/src/types/proto/store/database.ts b/frontend/src/types/proto/store/database.ts
index 2889b912a5..13bcdae899 100644
--- a/frontend/src/types/proto/store/database.ts
+++ b/frontend/src/types/proto/store/database.ts
@@ -615,6 +615,8 @@ export interface IndexMetadata {
* If the key length is not specified, it's -1.
*/
keyLength: Long[];
+ /** The descending is the ordered descending of an index. */
+ descending: boolean[];
/** The type is the type of an index. */
type: string;
/** The unique is whether the index is unique. */
@@ -3058,6 +3060,7 @@ function createBaseIndexMetadata(): IndexMetadata {
name: "",
expressions: [],
keyLength: [],
+ descending: [],
type: "",
unique: false,
primary: false,
@@ -3080,6 +3083,11 @@ export const IndexMetadata = {
writer.int64(v);
}
writer.ldelim();
+ writer.uint32(82).fork();
+ for (const v of message.descending) {
+ writer.bool(v);
+ }
+ writer.ldelim();
if (message.type !== "") {
writer.uint32(26).string(message.type);
}
@@ -3138,6 +3146,23 @@ export const IndexMetadata = {
continue;
}
+ break;
+ case 10:
+ if (tag === 80) {
+ message.descending.push(reader.bool());
+
+ continue;
+ }
+
+ if (tag === 82) {
+ const end2 = reader.uint32() + reader.pos;
+ while (reader.pos < end2) {
+ message.descending.push(reader.bool());
+ }
+
+ continue;
+ }
+
break;
case 3:
if (tag !== 26) {
@@ -3197,6 +3222,9 @@ export const IndexMetadata = {
? object.expressions.map((e: any) => globalThis.String(e))
: [],
keyLength: globalThis.Array.isArray(object?.keyLength) ? object.keyLength.map((e: any) => Long.fromValue(e)) : [],
+ descending: globalThis.Array.isArray(object?.descending)
+ ? object.descending.map((e: any) => globalThis.Boolean(e))
+ : [],
type: isSet(object.type) ? globalThis.String(object.type) : "",
unique: isSet(object.unique) ? globalThis.Boolean(object.unique) : false,
primary: isSet(object.primary) ? globalThis.Boolean(object.primary) : false,
@@ -3217,6 +3245,9 @@ export const IndexMetadata = {
if (message.keyLength?.length) {
obj.keyLength = message.keyLength.map((e) => (e || Long.ZERO).toString());
}
+ if (message.descending?.length) {
+ obj.descending = message.descending;
+ }
if (message.type !== "") {
obj.type = message.type;
}
@@ -3246,6 +3277,7 @@ export const IndexMetadata = {
message.name = object.name ?? "";
message.expressions = object.expressions?.map((e) => e) || [];
message.keyLength = object.keyLength?.map((e) => Long.fromValue(e)) || [];
+ message.descending = object.descending?.map((e) => e) || [];
message.type = object.type ?? "";
message.unique = object.unique ?? false;
message.primary = object.primary ?? false;
diff --git a/frontend/src/types/proto/v1/database_service.ts b/frontend/src/types/proto/v1/database_service.ts
index 62f01e753a..808868ec55 100644
--- a/frontend/src/types/proto/v1/database_service.ts
+++ b/frontend/src/types/proto/v1/database_service.ts
@@ -993,6 +993,8 @@ export interface IndexMetadata {
* If the key length is not specified, it's -1.
*/
keyLength: Long[];
+ /** The descending is the ordered descending of an index. */
+ descending: boolean[];
/** The type is the type of an index. */
type: string;
/** The unique is whether the index is unique. */
@@ -5232,6 +5234,7 @@ function createBaseIndexMetadata(): IndexMetadata {
name: "",
expressions: [],
keyLength: [],
+ descending: [],
type: "",
unique: false,
primary: false,
@@ -5254,6 +5257,11 @@ export const IndexMetadata = {
writer.int64(v);
}
writer.ldelim();
+ writer.uint32(82).fork();
+ for (const v of message.descending) {
+ writer.bool(v);
+ }
+ writer.ldelim();
if (message.type !== "") {
writer.uint32(26).string(message.type);
}
@@ -5312,6 +5320,23 @@ export const IndexMetadata = {
continue;
}
+ break;
+ case 10:
+ if (tag === 80) {
+ message.descending.push(reader.bool());
+
+ continue;
+ }
+
+ if (tag === 82) {
+ const end2 = reader.uint32() + reader.pos;
+ while (reader.pos < end2) {
+ message.descending.push(reader.bool());
+ }
+
+ continue;
+ }
+
break;
case 3:
if (tag !== 26) {
@@ -5371,6 +5396,9 @@ export const IndexMetadata = {
? object.expressions.map((e: any) => globalThis.String(e))
: [],
keyLength: globalThis.Array.isArray(object?.keyLength) ? object.keyLength.map((e: any) => Long.fromValue(e)) : [],
+ descending: globalThis.Array.isArray(object?.descending)
+ ? object.descending.map((e: any) => globalThis.Boolean(e))
+ : [],
type: isSet(object.type) ? globalThis.String(object.type) : "",
unique: isSet(object.unique) ? globalThis.Boolean(object.unique) : false,
primary: isSet(object.primary) ? globalThis.Boolean(object.primary) : false,
@@ -5391,6 +5419,9 @@ export const IndexMetadata = {
if (message.keyLength?.length) {
obj.keyLength = message.keyLength.map((e) => (e || Long.ZERO).toString());
}
+ if (message.descending?.length) {
+ obj.descending = message.descending;
+ }
if (message.type !== "") {
obj.type = message.type;
}
@@ -5420,6 +5451,7 @@ export const IndexMetadata = {
message.name = object.name ?? "";
message.expressions = object.expressions?.map((e) => e) || [];
message.keyLength = object.keyLength?.map((e) => Long.fromValue(e)) || [];
+ message.descending = object.descending?.map((e) => e) || [];
message.type = object.type ?? "";
message.unique = object.unique ?? false;
message.primary = object.primary ?? false;
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index bb544bfcae..245b155e29 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -9950,6 +9950,11 @@ components:
description: |-
The key_lengths are the ordered key lengths of an index.
If the key length is not specified, it's -1.
+ descending:
+ type: array
+ items:
+ type: boolean
+ description: The descending is the ordered descending of an index.
type:
type: string
description: The type is the type of an index.
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 2e63383f37..08feb59d41 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -1147,6 +1147,7 @@ IndexMetadata is the metadata for indexes.
| name | [string](#string) | | The name is the name of an index. |
| expressions | [string](#string) | repeated | The expressions are the ordered columns or expressions of an index. This could refer to a column or an expression. |
| key_length | [int64](#int64) | repeated | The key_lengths are the ordered key lengths of an index. If the key length is not specified, it&#39;s -1. |
+| descending | [bool](#bool) | repeated | The descending is the ordered descending of an index. |
| type | [string](#string) | | The type is the type of an index. |
| unique | [bool](#bool) | | The unique is whether the index is unique. |
| primary | [bool](#bool) | | The primary is whether the index is a primary key index. |
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index c348fd8ec3..8191c4425a 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -3348,6 +3348,13 @@ This could refer to a column or an expression. </p></td>
If the key length is not specified, it&#39;s -1. </p></td>
</tr>
+ <tr>
+ <td>descending</td>
+ <td><a href="#bool">bool</a></td>
+ <td>repeated</td>
+ <td><p>The descending is the ordered descending of an index. </p></td>
+ </tr>
+
<tr>
<td>type</td>
<td><a href="#string">string</a></td>
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 84c42cf3d2..bac03b3f27 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -2677,6 +2677,7 @@ IndexMetadata is the metadata for indexes.
| name | [string](#string) | | The name is the name of an index. |
| expressions | [string](#string) | repeated | The expressions are the ordered columns or expressions of an index. This could refer to a column or an expression. |
| key_length | [int64](#int64) | repeated | The key_lengths are the ordered key lengths of an index. If the key length is not specified, it&#39;s -1. |
+| descending | [bool](#bool) | repeated | The descending is the ordered descending of an index. |
| type | [string](#string) | | The type is the type of an index. |
| unique | [bool](#bool) | | The unique is whether the index is unique. |
| primary | [bool](#bool) | | The primary is whether the index is a primary key index. |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 7fea81d6d4..35732d2922 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -8078,6 +8078,13 @@ This could refer to a column or an expression. </p></td>
If the key length is not specified, it&#39;s -1. </p></td>
</tr>
+ <tr>
+ <td>descending</td>
+ <td><a href="#bool">bool</a></td>
+ <td>repeated</td>
+ <td><p>The descending is the ordered descending of an index. </p></td>
+ </tr>
+
<tr>
<td>type</td>
<td><a href="#string">string</a></td>
diff --git a/proto/generated-go/store/database.pb.go b/proto/generated-go/store/database.pb.go
index 17a3224f4f..b3a42a6b11 100644
--- a/proto/generated-go/store/database.pb.go
+++ b/proto/generated-go/store/database.pb.go
@@ -1774,6 +1774,8 @@ type IndexMetadata struct {
// The key_lengths are the ordered key lengths of an index.
// If the key length is not specified, it's -1.
KeyLength []int64 `protobuf:"varint,9,rep,packed,name=key_length,json=keyLength,proto3" json:"key_length,omitempty"`
+ // The descending is the ordered descending of an index.
+ Descending []bool `protobuf:"varint,10,rep,packed,name=descending,proto3" json:"descending,omitempty"`
// The type is the type of an index.
Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
// The unique is whether the index is unique.
@@ -1841,6 +1843,13 @@ func (x *IndexMetadata) GetKeyLength() []int64 {
return nil
}
+func (x *IndexMetadata) GetDescending() []bool {
+ if x != nil {
+ return x.Descending
+ }
+ return nil
+}
+
func (x *IndexMetadata) GetType() string {
if x != nil {
return x.Type
@@ -3166,14 +3175,16 @@ var file_store_database_proto_rawDesc = []byte{
0x72, 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, 0x22, 0xfe,
- 0x01, 0x0a, 0x0d, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
+ 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x9e,
+ 0x02, 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, 0x1d, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x6c, 0x65,
0x6e, 0x67, 0x74, 0x68, 0x18, 0x09, 0x20, 0x03, 0x28, 0x03, 0x52, 0x09, 0x6b, 0x65, 0x79, 0x4c,
- 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20,
+ 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x73, 0x63, 0x65, 0x6e, 0x64,
+ 0x69, 0x6e, 0x67, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x73, 0x63, 0x65,
+ 0x6e, 0x64, 0x69, 0x6e, 0x67, 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,
diff --git a/proto/generated-go/v1/database_service.pb.go b/proto/generated-go/v1/database_service.pb.go
index b0673ea911..16565afde2 100644
--- a/proto/generated-go/v1/database_service.pb.go
+++ b/proto/generated-go/v1/database_service.pb.go
@@ -3075,6 +3075,8 @@ type IndexMetadata struct {
// The key_lengths are the ordered key lengths of an index.
// If the key length is not specified, it's -1.
KeyLength []int64 `protobuf:"varint,9,rep,packed,name=key_length,json=keyLength,proto3" json:"key_length,omitempty"`
+ // The descending is the ordered descending of an index.
+ Descending []bool `protobuf:"varint,10,rep,packed,name=descending,proto3" json:"descending,omitempty"`
// The type is the type of an index.
Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
// The unique is whether the index is unique.
@@ -3142,6 +3144,13 @@ func (x *IndexMetadata) GetKeyLength() []int64 {
return nil
}
+func (x *IndexMetadata) GetDescending() []bool {
+ if x != nil {
+ return x.Descending
+ }
+ return nil
+}
+
func (x *IndexMetadata) GetType() string {
if x != nil {
return x.Type
@@ -5940,14 +5949,16 @@ var file_v1_database_service_proto_rawDesc = []byte{
0x12, 0x10, 0x0a, 0x0c, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54,
0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x41, 0x50, 0x50, 0x45, 0x4e,
0x44, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x4d, 0x4f, 0x44, 0x45,
- 0x5f, 0x49, 0x4e, 0x53, 0x45, 0x52, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x03, 0x22, 0xfe,
- 0x01, 0x0a, 0x0d, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
+ 0x5f, 0x49, 0x4e, 0x53, 0x45, 0x52, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x03, 0x22, 0x9e,
+ 0x02, 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, 0x1d, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x6c, 0x65,
0x6e, 0x67, 0x74, 0x68, 0x18, 0x09, 0x20, 0x03, 0x28, 0x03, 0x52, 0x09, 0x6b, 0x65, 0x79, 0x4c,
- 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20,
+ 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x73, 0x63, 0x65, 0x6e, 0x64,
+ 0x69, 0x6e, 0x67, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x73, 0x63, 0x65,
+ 0x6e, 0x64, 0x69, 0x6e, 0x67, 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,
diff --git a/proto/store/database.proto b/proto/store/database.proto
index f1ab209c88..9bd6a48f3d 100644
--- a/proto/store/database.proto
+++ b/proto/store/database.proto
@@ -387,6 +387,9 @@ message IndexMetadata {
// If the key length is not specified, it's -1.
repeated int64 key_length = 9;
+ // The descending is the ordered descending of an index.
+ repeated bool descending = 10;
+
// The type is the type of an index.
string type = 3;
diff --git a/proto/v1/database_service.proto b/proto/v1/database_service.proto
index b9d3781a19..6ef2c5ce1c 100644
--- a/proto/v1/database_service.proto
+++ b/proto/v1/database_service.proto
@@ -719,6 +719,9 @@ message IndexMetadata {
// If the key length is not specified, it's -1.
repeated int64 key_length = 9;
+ // The descending is the ordered descending of an index.
+ repeated bool descending = 10;
+
// The type is the type of an index.
string type = 3;