Skip to content

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

chore: introduce search path (#16205)

rebelice3b4d0b69627a
diff --git a/frontend/src/types/proto/v1/database_service.ts b/frontend/src/types/proto/v1/database_service.ts
index 72ce14ae38..05ff242e94 100644
--- a/frontend/src/types/proto/v1/database_service.ts
+++ b/frontend/src/types/proto/v1/database_service.ts
@@ -351,6 +351,8 @@ export interface DatabaseMetadata {
/** The extensions is the list of extensions in a database. */
extensions: ExtensionMetadata[];
owner: string;
+ /** The search_path is the search path of a PostgreSQL database. */
+ searchPath: string;
}
/**
@@ -3223,7 +3225,7 @@ export const Database_LabelsEntry: MessageFns<Database_LabelsEntry> = {
};
function createBaseDatabaseMetadata(): DatabaseMetadata {
- return { name: "", schemas: [], characterSet: "", collation: "", extensions: [], owner: "" };
+ return { name: "", schemas: [], characterSet: "", collation: "", extensions: [], owner: "", searchPath: "" };
}
export const DatabaseMetadata: MessageFns<DatabaseMetadata> = {
@@ -3246,6 +3248,9 @@ export const DatabaseMetadata: MessageFns<DatabaseMetadata> = {
if (message.owner !== "") {
writer.uint32(58).string(message.owner);
}
+ if (message.searchPath !== "") {
+ writer.uint32(66).string(message.searchPath);
+ }
return writer;
},
@@ -3304,6 +3309,14 @@ export const DatabaseMetadata: MessageFns<DatabaseMetadata> = {
message.owner = reader.string();
continue;
}
+ case 8: {
+ if (tag !== 66) {
+ break;
+ }
+
+ message.searchPath = reader.string();
+ continue;
+ }
}
if ((tag & 7) === 4 || tag === 0) {
break;
@@ -3325,6 +3338,7 @@ export const DatabaseMetadata: MessageFns<DatabaseMetadata> = {
? object.extensions.map((e: any) => ExtensionMetadata.fromJSON(e))
: [],
owner: isSet(object.owner) ? globalThis.String(object.owner) : "",
+ searchPath: isSet(object.searchPath) ? globalThis.String(object.searchPath) : "",
};
},
@@ -3348,6 +3362,9 @@ export const DatabaseMetadata: MessageFns<DatabaseMetadata> = {
if (message.owner !== "") {
obj.owner = message.owner;
}
+ if (message.searchPath !== "") {
+ obj.searchPath = message.searchPath;
+ }
return obj;
},
@@ -3362,6 +3379,7 @@ export const DatabaseMetadata: MessageFns<DatabaseMetadata> = {
message.collation = object.collation ?? "";
message.extensions = object.extensions?.map((e) => ExtensionMetadata.fromPartial(e)) || [];
message.owner = object.owner ?? "";
+ message.searchPath = object.searchPath ?? "";
return message;
},
};
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index beef8f11a3..1cc5cc2318 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -2080,6 +2080,11 @@ paths:
in: query
schema:
type: string
+ - name: metadata.searchPath
+ in: query
+ description: The search_path is the search path of a PostgreSQL database.
+ schema:
+ type: string
responses:
"200":
description: OK
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index fc7a3a3c2d..3b0c1b372d 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -1173,6 +1173,7 @@ DatabaseSchemaMetadata is the schema metadata for databases.
| service_name | [string](#string) | | The service name of the database. It&#39;s the Oracle specific concept. |
| linked_databases | [LinkedDatabaseMetadata](#bytebase-store-LinkedDatabaseMetadata) | repeated | |
| owner | [string](#string) | | |
+| search_path | [string](#string) | | The search_path is the search path of a PostgreSQL database. |
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index 88e3478e90..42e63bbb6a 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -3528,6 +3528,13 @@ classification and user_comment is parsed from the comment. </p></td>
<td><p> </p></td>
</tr>
+ <tr>
+ <td>search_path</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The search_path is the search path of a PostgreSQL database. </p></td>
+ </tr>
+
</tbody>
</table>
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 0f06ae101a..c6d9b17f51 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -2167,6 +2167,7 @@ Format: instances/{instance}/databases/{database}/metadata |
| collation | [string](#string) | | The collation is the collation of a database. |
| extensions | [ExtensionMetadata](#bytebase-v1-ExtensionMetadata) | repeated | The extensions is the list of extensions in a database. |
| owner | [string](#string) | | |
+| search_path | [string](#string) | | The search_path is the search path of a PostgreSQL database. |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 0358901d4f..c68e6c9857 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -6751,6 +6751,13 @@ Format: instances/{instance}/databases/{database}/metadata </p></td>
<td><p> </p></td>
</tr>
+ <tr>
+ <td>search_path</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The search_path is the search path of a PostgreSQL database. </p></td>
+ </tr>
+
</tbody>
</table>
diff --git a/proto/generated-go/store/database.pb.go b/proto/generated-go/store/database.pb.go
index 93de4ae41b..a2ad8ab5d2 100644
--- a/proto/generated-go/store/database.pb.go
+++ b/proto/generated-go/store/database.pb.go
@@ -504,8 +504,10 @@ type DatabaseSchemaMetadata struct {
ServiceName string `protobuf:"bytes,7,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"`
LinkedDatabases []*LinkedDatabaseMetadata `protobuf:"bytes,8,rep,name=linked_databases,json=linkedDatabases,proto3" json:"linked_databases,omitempty"`
Owner string `protobuf:"bytes,9,opt,name=owner,proto3" json:"owner,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
+ // The search_path is the search path of a PostgreSQL database.
+ SearchPath string `protobuf:"bytes,10,opt,name=search_path,json=searchPath,proto3" json:"search_path,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
}
func (x *DatabaseSchemaMetadata) Reset() {
@@ -601,6 +603,13 @@ func (x *DatabaseSchemaMetadata) GetOwner() string {
return ""
}
+func (x *DatabaseSchemaMetadata) GetSearchPath() string {
+ if x != nil {
+ return x.SearchPath
+ }
+ return ""
+}
+
type LinkedDatabaseMetadata struct {
state protoimpl.MessageState `protogen:"open.v1"`
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
@@ -3825,7 +3834,7 @@ const file_store_database_proto_rawDesc = "" +
"\adrifted\x18\x06 \x01(\bR\adrifted\x1a9\n" +
"\vLabelsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
- "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x96\x03\n" +
+ "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xb7\x03\n" +
"\x16DatabaseSchemaMetadata\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x128\n" +
"\aschemas\x18\x02 \x03(\v2\x1e.bytebase.store.SchemaMetadataR\aschemas\x12#\n" +
@@ -3837,7 +3846,10 @@ const file_store_database_proto_rawDesc = "" +
"\tdatashare\x18\x06 \x01(\bR\tdatashare\x12!\n" +
"\fservice_name\x18\a \x01(\tR\vserviceName\x12Q\n" +
"\x10linked_databases\x18\b \x03(\v2&.bytebase.store.LinkedDatabaseMetadataR\x0flinkedDatabases\x12\x14\n" +
- "\x05owner\x18\t \x01(\tR\x05owner\"\\\n" +
+ "\x05owner\x18\t \x01(\tR\x05owner\x12\x1f\n" +
+ "\vsearch_path\x18\n" +
+ " \x01(\tR\n" +
+ "searchPath\"\\\n" +
"\x16LinkedDatabaseMetadata\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x12\x1a\n" +
"\busername\x18\x02 \x01(\tR\busername\x12\x12\n" +
diff --git a/proto/generated-go/v1/database_service.pb.go b/proto/generated-go/v1/database_service.pb.go
index a03f42cecf..a88165fa03 100644
--- a/proto/generated-go/v1/database_service.pb.go
+++ b/proto/generated-go/v1/database_service.pb.go
@@ -1655,8 +1655,10 @@ type DatabaseMetadata struct {
// The collation is the collation of a database.
Collation string `protobuf:"bytes,4,opt,name=collation,proto3" json:"collation,omitempty"`
// The extensions is the list of extensions in a database.
- Extensions []*ExtensionMetadata `protobuf:"bytes,5,rep,name=extensions,proto3" json:"extensions,omitempty"`
- Owner string `protobuf:"bytes,7,opt,name=owner,proto3" json:"owner,omitempty"`
+ Extensions []*ExtensionMetadata `protobuf:"bytes,5,rep,name=extensions,proto3" json:"extensions,omitempty"`
+ Owner string `protobuf:"bytes,7,opt,name=owner,proto3" json:"owner,omitempty"`
+ // The search_path is the search path of a PostgreSQL database.
+ SearchPath string `protobuf:"bytes,8,opt,name=search_path,json=searchPath,proto3" json:"search_path,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -1733,6 +1735,13 @@ func (x *DatabaseMetadata) GetOwner() string {
return ""
}
+func (x *DatabaseMetadata) GetSearchPath() string {
+ if x != nil {
+ return x.SearchPath
+ }
+ return ""
+}
+
// SchemaMetadata is the metadata for schemas.
// This is the concept of schema in Postgres, but it's a no-op for MySQL.
type SchemaMetadata struct {
@@ -5671,7 +5680,7 @@ const file_v1_database_service_proto_rawDesc = "" +
"\vLabelsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01:E\xeaAB\n" +
- "\x15bytebase.com/Database\x12)instances/{instance}/databases/{database}J\x04\b\x02\x10\x03\"\xcf\x02\n" +
+ "\x15bytebase.com/Database\x12)instances/{instance}/databases/{database}J\x04\b\x02\x10\x03\"\xf0\x02\n" +
"\x10DatabaseMetadata\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x125\n" +
"\aschemas\x18\x02 \x03(\v2\x1b.bytebase.v1.SchemaMetadataR\aschemas\x12#\n" +
@@ -5680,7 +5689,9 @@ const file_v1_database_service_proto_rawDesc = "" +
"\n" +
"extensions\x18\x05 \x03(\v2\x1e.bytebase.v1.ExtensionMetadataR\n" +
"extensions\x12\x14\n" +
- "\x05owner\x18\a \x01(\tR\x05owner:W\xeaAT\n" +
+ "\x05owner\x18\a \x01(\tR\x05owner\x12\x1f\n" +
+ "\vsearch_path\x18\b \x01(\tR\n" +
+ "searchPath:W\xeaAT\n" +
"\x1dbytebase.com/DatabaseMetadata\x123bytebase.com/Database/databases/{database}/metadata\"\xad\x06\n" +
"\x0eSchemaMetadata\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x122\n" +
diff --git a/proto/store/store/database.proto b/proto/store/store/database.proto
index b60abe52e5..85c0f99cf4 100644
--- a/proto/store/store/database.proto
+++ b/proto/store/store/database.proto
@@ -44,6 +44,9 @@ message DatabaseSchemaMetadata {
repeated LinkedDatabaseMetadata linked_databases = 8;
string owner = 9;
+
+ // The search_path is the search path of a PostgreSQL database.
+ string search_path = 10;
}
message LinkedDatabaseMetadata {
diff --git a/proto/v1/v1/database_service.proto b/proto/v1/v1/database_service.proto
index 68e26fa2a4..f65e924c60 100644
--- a/proto/v1/v1/database_service.proto
+++ b/proto/v1/v1/database_service.proto
@@ -445,6 +445,9 @@ message DatabaseMetadata {
repeated ExtensionMetadata extensions = 5;
string owner = 7;
+
+ // The search_path is the search path of a PostgreSQL database.
+ string search_path = 8;
}
// SchemaMetadata is the metadata for schemas.