Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

feat(objects): show routines in object browser

t8y26d513afc16f7
diff --git a/crates/dbx-core/src/db/oracle_driver.rs b/crates/dbx-core/src/db/oracle_driver.rs
index 7cfb96465b..70dc0d0ea3 100644
--- a/crates/dbx-core/src/db/oracle_driver.rs
+++ b/crates/dbx-core/src/db/oracle_driver.rs
@@ -129,6 +129,44 @@ pub async fn list_tables(conn: &OracleClient, schema: &str) -> Result<Vec<TableI
.collect())
}
+pub async fn list_objects(conn: &OracleClient, schema: &str) -> Result<Vec<crate::types::ObjectInfo>, String> {
+ let s = quote_literal(schema);
+ let sql = format!(
+ "SELECT o.OBJECT_NAME, \
+ CASE o.OBJECT_TYPE \
+ WHEN 'TABLE' THEN 'TABLE' \
+ WHEN 'VIEW' THEN 'VIEW' \
+ WHEN 'PROCEDURE' THEN 'PROCEDURE' \
+ WHEN 'FUNCTION' THEN 'FUNCTION' \
+ ELSE o.OBJECT_TYPE \
+ END AS OBJECT_TYPE, \
+ c.COMMENTS \
+ FROM ALL_OBJECTS o \
+ LEFT JOIN ALL_TAB_COMMENTS c ON c.OWNER = o.OWNER AND c.TABLE_NAME = o.OBJECT_NAME \
+ WHERE o.OWNER = {s} \
+ AND o.OBJECT_TYPE IN ('TABLE','VIEW','PROCEDURE','FUNCTION') \
+ AND o.OBJECT_NAME NOT LIKE 'BIN$%' \
+ ORDER BY CASE o.OBJECT_TYPE \
+ WHEN 'TABLE' THEN 0 \
+ WHEN 'VIEW' THEN 1 \
+ WHEN 'PROCEDURE' THEN 2 \
+ WHEN 'FUNCTION' THEN 3 \
+ ELSE 4 \
+ END, o.OBJECT_NAME"
+ );
+ let result = conn.query(&sql, &[]).await.map_err(|e| e.to_string())?;
+ Ok(result
+ .rows
+ .iter()
+ .map(|row| crate::types::ObjectInfo {
+ name: row.get_string(0).unwrap_or("").to_string(),
+ object_type: row.get_string(1).unwrap_or("TABLE").to_string(),
+ schema: Some(schema.to_string()),
+ comment: row.get_string(2).filter(|s| !s.is_empty()).map(|s| s.to_string()),
+ })
+ .collect())
+}
+
pub async fn get_columns(conn: &OracleClient, schema: &str, table: &str) -> Result<Vec<ColumnInfo>, String> {
log::debug!("[oracle] get_columns: schema={schema}, table={table}");
let s = quote_literal(schema);
diff --git a/crates/dbx-core/src/db/sqlserver.rs b/crates/dbx-core/src/db/sqlserver.rs
index 0e82780ba2..f9a1d54360 100644
--- a/crates/dbx-core/src/db/sqlserver.rs
+++ b/crates/dbx-core/src/db/sqlserver.rs
@@ -135,6 +135,46 @@ pub async fn list_tables(client: &mut SqlServerClient, schema: &str) -> Result<V
.collect())
}
+pub async fn list_objects(client: &mut SqlServerClient, schema: &str) -> Result<Vec<crate::types::ObjectInfo>, String> {
+ let sql = format!(
+ "SELECT o.name, \
+ CASE o.type \
+ WHEN 'U' THEN 'TABLE' \
+ WHEN 'V' THEN 'VIEW' \
+ WHEN 'P' THEN 'PROCEDURE' \
+ WHEN 'FN' THEN 'FUNCTION' \
+ WHEN 'IF' THEN 'FUNCTION' \
+ WHEN 'TF' THEN 'FUNCTION' \
+ WHEN 'FS' THEN 'FUNCTION' \
+ WHEN 'FT' THEN 'FUNCTION' \
+ ELSE o.type_desc \
+ END AS object_type \
+ FROM sys.objects o \
+ JOIN sys.schemas s ON s.schema_id = o.schema_id \
+ WHERE s.name = '{}' \
+ AND o.type IN ('U','V','P','FN','IF','TF','FS','FT') \
+ AND o.is_ms_shipped = 0 \
+ ORDER BY CASE o.type \
+ WHEN 'U' THEN 0 \
+ WHEN 'V' THEN 1 \
+ WHEN 'P' THEN 2 \
+ ELSE 3 \
+ END, o.name",
+ schema.replace('\'', "''")
+ );
+ let stream = client.query(&*sql, &[]).await.map_err(|e| e.to_string())?;
+ let rows = stream.into_first_result().await.map_err(|e| e.to_string())?;
+ Ok(rows
+ .iter()
+ .map(|row| crate::types::ObjectInfo {
+ name: row.get::<&str, _>(0).unwrap_or("").to_string(),
+ object_type: row.get::<&str, _>(1).unwrap_or("TABLE").to_string(),
+ schema: Some(schema.to_string()),
+ comment: None,
+ })
+ .collect())
+}
+
pub async fn get_columns(client: &mut SqlServerClient, schema: &str, table: &str) -> Result<Vec<ColumnInfo>, String> {
let sql = format!(
"SELECT c.COLUMN_NAME, c.DATA_TYPE, c.IS_NULLABLE, c.COLUMN_DEFAULT, \
diff --git a/crates/dbx-core/src/schema.rs b/crates/dbx-core/src/schema.rs
index 45693f3e1f..8477fbb8cf 100644
--- a/crates/dbx-core/src/schema.rs
+++ b/crates/dbx-core/src/schema.rs
@@ -313,6 +313,59 @@ pub async fn list_tables_core(
}
}
+pub async fn list_objects_core(
+ state: &AppState,
+ connection_id: &str,
+ database: &str,
+ schema: &str,
+) -> Result<Vec<db::ObjectInfo>, String> {
+ let pool_key = state.get_or_create_pool(connection_id, Some(database)).await?;
+
+ {
+ let connections = state.connections.lock().await;
+ if let Some(ext_pool) = extract_external(&connections, &pool_key) {
+ drop(connections);
+ let cache = ext_pool.cache.clone();
+ return tokio::task::spawn_blocking(move || {
+ let con = cache.lock().map_err(|e| e.to_string())?;
+ Ok(duckdb_query_tables(&con)?
+ .into_iter()
+ .map(|table| db::ObjectInfo {
+ name: table.name,
+ object_type: table.table_type,
+ schema: None,
+ comment: table.comment,
+ })
+ .collect())
+ })
+ .await
+ .map_err(|e| e.to_string())?;
+ }
+ if let Some(client) = extract_sqlserver(&connections, &pool_key) {
+ drop(connections);
+ let mut client = client.lock().await;
+ return db::sqlserver::list_objects(&mut client, schema).await;
+ }
+ if let Some(pool) = extract_oracle(&connections, &pool_key) {
+ drop(connections);
+ let client = pool.client();
+ let client = client.lock().await;
+ return db::oracle_driver::list_objects(&*client, schema).await;
+ }
+ }
+
+ Ok(list_tables_core(state, connection_id, database, schema)
+ .await?
+ .into_iter()
+ .map(|table| db::ObjectInfo {
+ name: table.name,
+ object_type: table.table_type,
+ schema: if schema.is_empty() { None } else { Some(schema.to_string()) },
+ comment: table.comment,
+ })
+ .collect())
+}
+
pub async fn get_columns_core(
state: &AppState,
connection_id: &str,
diff --git a/crates/dbx-core/src/types.rs b/crates/dbx-core/src/types.rs
index 8e271cae23..b77adc5fd2 100644
--- a/crates/dbx-core/src/types.rs
+++ b/crates/dbx-core/src/types.rs
@@ -12,6 +12,14 @@ pub struct TableInfo {
pub comment: Option<String>,
}
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct ObjectInfo {
+ pub name: String,
+ pub object_type: String,
+ pub schema: Option<String>,
+ pub comment: Option<String>,
+}
+
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ColumnInfo {
pub name: String,
diff --git a/src-tauri/src/commands/schema.rs b/src-tauri/src/commands/schema.rs
index 27159a257b..2f7ff5e518 100644
--- a/src-tauri/src/commands/schema.rs
+++ b/src-tauri/src/commands/schema.rs
@@ -31,6 +31,16 @@ pub async fn list_tables(
dbx_core::schema::list_tables_core(&state, &connection_id, &database, &schema).await
}
+#[tauri::command]
+pub async fn list_objects(
+ state: State<'_, Arc<AppState>>,
+ connection_id: String,
+ database: String,
+ schema: String,
+) -> Result<Vec<db::ObjectInfo>, String> {
+ dbx_core::schema::list_objects_core(&state, &connection_id, &database, &schema).await
+}
+
#[tauri::command]
pub async fn get_columns(
state: State<'_, Arc<AppState>>,
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 15396fa2c6..6b52625059 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -82,6 +82,7 @@ pub fn run() {
commands::plugins::uninstall_jdbc_plugin,
commands::schema::list_databases,
commands::schema::list_tables,
+ commands::schema::list_objects,
commands::schema::list_schemas,
commands::schema::get_columns,
commands::schema::list_indexes,
diff --git a/src-web/src/main.rs b/src-web/src/main.rs
index cba7633e70..8a4f6d06e4 100644
--- a/src-web/src/main.rs
+++ b/src-web/src/main.rs
@@ -85,6 +85,7 @@ async fn main() {
.route("/schema/databases", get(routes::schema::list_databases))
.route("/schema/schemas", get(routes::schema::list_schemas))
.route("/schema/tables", get(routes::schema::list_tables))
+ .route("/schema/objects", get(routes::schema::list_objects))
.route("/schema/columns", get(routes::schema::list_columns))
.route("/schema/indexes", get(routes::schema::list_indexes))
.route("/schema/foreign-keys", get(routes::schema::list_foreign_keys))
diff --git a/src-web/src/routes/schema.rs b/src-web/src/routes/schema.rs
index d7fc783740..c5cf7857a1 100644
--- a/src-web/src/routes/schema.rs
+++ b/src-web/src/routes/schema.rs
@@ -43,6 +43,17 @@ pub async fn list_tables(
Ok(Json(serde_json::to_value(result).map_err(|e| AppError(e.to_string()))?))
}
+pub async fn list_objects(
+ State(state): State<Arc<WebState>>,
+ Query(q): Query<SchemaQuery>,
+) -> Result<Json<serde_json::Value>, AppError> {
+ let database = q.database.as_deref().unwrap_or("");
+ let schema = q.schema.as_deref().unwrap_or("");
+ let result =
+ dbx_core::schema::list_objects_core(&state.app, &q.connection_id, database, schema).await.map_err(AppError)?;
+ Ok(Json(serde_json::to_value(result).map_err(|e| AppError(e.to_string()))?))
+}
+
pub async fn list_columns(
State(state): State<Arc<WebState>>,
Query(q): Query<SchemaQuery>,
diff --git a/src/components/objects/ObjectBrowser.vue b/src/components/objects/ObjectBrowser.vue
index df1c5076e2..478c004c33 100644
--- a/src/components/objects/ObjectBrowser.vue
+++ b/src/components/objects/ObjectBrowser.vue
@@ -1,24 +1,24 @@
<script setup lang="ts">
import { computed, ref, watch } from "vue";
import { RecycleScroller } from "vue-virtual-scroller";
-import { Loader2, RefreshCw, Search, Table2, Eye } from "lucide-vue-next";
+import { Braces, Eye, Loader2, RefreshCw, Search, ScrollText, Table2 } from "lucide-vue-next";
import { useI18n } from "vue-i18n";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import * as api from "@/lib/api";
-import type { ConnectionConfig, TableInfo } from "@/types/database";
+import type { ConnectionConfig, ObjectInfo } from "@/types/database";
import { isSchemaAware } from "@/lib/databaseCapabilities";
type ObjectRow = {
id: string;
name: string;
schema?: string;
- type: "TABLE" | "VIEW";
+ type: "TABLE" | "VIEW" | "PROCEDURE" | "FUNCTION";
comment?: string | null;
};
-type ObjectFilter = "all" | "tables" | "views";
+type ObjectFilter = "all" | "tables" | "views" | "procedures" | "functions";
const props = defineProps<{
connection: ConnectionConfig;
@@ -46,7 +46,22 @@ let loadId = 0;
const needsSchema = computed(() => isSchemaAware(props.connection.db_type));
const tableCount = computed(() => rows.value.filter((row) => row.type === "TABLE").length);
const viewCount = computed(() => rows.value.filter((row) => row.type === "VIEW").length);
-const showObjectFilter = computed(() => tableCount.value > 0 && viewCount.value > 0);
+const procedureCount = computed(() => rows.value.filter((row) => row.type === "PROCEDURE").length);
+const functionCount = computed(() => rows.value.filter((row) => row.type === "FUNCTION").length);
+const objectFilters = computed<ObjectFilter[]>(() =>
+ (
+ [
+ ["all", rows.value.length],
+ ["tables", tableCount.value],
+ ["views", viewCount.value],
+ ["procedures", procedureCount.value],
+ ["functions", functionCount.value],
+ ] as Array<[ObjectFilter, number]>
+ )
+ .filter(([filter, count]) => filter === "all" || count > 0)
+ .map(([filter]) => filter),
+);
+const showObjectFilter = computed(() => objectFilters.value.length > 2);
const hasComments = computed(() => rows.value.some((row) => row.comment?.trim()));
const gridTemplateColumns = computed(() =>
hasComments.value ? "minmax(0,1fr) 120px 160px minmax(160px,0.7fr)" : "minmax(0,1fr) 120px 160px",
@@ -63,21 +78,47 @@ const searchedRows = computed(() => {
const filteredRows = computed(() => {
if (objectFilter.value === "tables") return searchedRows.value.filter((row) => row.type === "TABLE");
if (objectFilter.value === "views") return searchedRows.value.filter((row) => row.type === "VIEW");
+ if (objectFilter.value === "procedures") return searchedRows.value.filter((row) => row.type === "PROCEDURE");
+ if (objectFilter.value === "functions") return searchedRows.value.filter((row) => row.type === "FUNCTION");
return searchedRows.value;
});
function normalizeType(type: string): ObjectRow["type"] {
const value = type.toUpperCase();
if (value.includes("VIEW")) return "VIEW";
+ if (value.includes("PROC")) return "PROCEDURE";
+ if (value.includes("FUNC")) return "FUNCTION";
return "TABLE";
}
function iconFor(row: ObjectRow) {
- return row.type === "VIEW" ? Eye : Table2;
+ if (row.type === "VIEW") return Eye;
+ if (row.type === "PROCEDURE") return ScrollText;
+ if (row.type === "FUNCTION") return Braces;
+ return Table2;
}
function typeLabel(type: ObjectRow["type"]) {
- return type === "VIEW" ? t("objects.view") : t("objects.table");
+ if (type === "VIEW") return t("objects.view");
+ if (type === "PROCEDURE") return t("objects.procedure");
+ if (type === "FUNCTION") return t("objects.function");
+ return t("objects.table");
+}
+
+function iconClass(type: ObjectRow["type"]) {
+ if (type === "VIEW") return "text-purple-500";
+ if (type === "PROCEDURE") return "text-blue-500";
+ if (type === "FUNCTION") return "text-amber-500";
+ return "text-green-500";
+}
+
+function canOpen(row: ObjectRow) {
+ return row.type === "TABLE" || row.type === "VIEW";
+}
+
+function openRow(row: ObjectRow) {
+ if (!canOpen(row)) return;
+ emit("openTable", { tableName: row.name, schema: row.schema });
}
async function loadSchemas() {
@@ -105,14 +146,14 @@ async function loadObjects() {
rows.value = [];
try {
const schema = needsSchema.value ? selectedSchema.value || "" : props.database;
- const tables: TableInfo[] = await api.listTables(props.connection.id, props.database, schema);
+ const objects: ObjectInfo[] = await api.listObjects(props.connection.id, props.database, schema);
if (id !== loadId) return;
- rows.value = tables.map((table) => ({
- id: `${schema || props.database}:${table.name}:${table.table_type}`,
- name: table.name,
- schema: needsSchema.value ? schema : undefined,
- type: normalizeType(table.table_type),
- comment: table.comment,
+ rows.value = objects.map((object) => ({
+ id: `${object.schema || schema || props.database}:${object.name}:${object.object_type}`,
+ name: object.name,
+ schema: object.schema || (needsSchema.value ? schema : undefined),
+ type: normalizeType(object.object_type),
+ comment: object.comment,
}));
} catch (e: any) {
if (id !== loadId) return;
@@ -136,11 +177,22 @@ function onSchemaChange(value: any) {
function filterCount(filter: ObjectFilter) {
if (filter === "tables") return tableCount.value;
if (filter === "views") return viewCount.value;
+ if (filter === "procedures") return procedureCount.value;
+ if (filter === "functions") return functionCount.value;
return rows.value.length;
}
function filterLabel(filter: ObjectFilter) {
- const key = filter === "tables" ? "objects.tables" : filter === "views" ? "objects.views" : "objects.all";
+ const key =
+ filter === "tables"
+ ? "objects.tables"
+ : filter === "views"
+ ? "objects.views"
+ : filter === "procedures"
+ ? "objects.procedures"
+ : filter === "functions"
+ ? "objects.functions"
+ : "objects.all";
return `${t(key)} ${filterCount(filter)}`;
}
@@ -171,7 +223,7 @@ watch(
<Input v-model="search" class="h-7 text-xs" :placeholder="t('objects.search')" />
<div v-if="showObjectFilter" class="flex h-7 shrink-0 items-center rounded border bg-muted/20 p-0.5">
<button
- v-for="filter in ['all', 'tables', 'views'] as ObjectFilter[]"
+ v-for="filter in objectFilters"
:key="filter"
type="button"
class="h-6 rounded-sm px-2 text-xs text-muted-foreground transition-colors hover:text-foreground"
@@ -223,24 +275,21 @@ watch(
<div class="truncate">{{ t("objects.schemaColumn") }}</div>
<div v-if="hasComments" class="truncate">{{ t("objects.comment") }}</div>
</div>
- <RecycleScroller class="flex-1 min-h-0" :items="filteredRows" :item-size="36" key-field="id">
+ <RecycleScroller class="flex-1 min-h-0" :items="filteredRows" :item-size="38" key-field="id">
<template #default="{ item }">
<div
- class="grid h-9 cursor-pointer items-center gap-3 border-b px-3 text-xs hover:bg-accent/50"
+ class="grid h-[38px] cursor-pointer items-center gap-3 border-b px-3 hover:bg-accent/50"
+ :class="{ 'cursor-default hover:bg-transparent': !canOpen(item) }"
:style="{ gridTemplateColumns }"
- @click="emit('openTable', { tableName: item.name, schema: item.schema })"
+ @click="openRow(item)"
>
<div class="flex min-w-0 items-center gap-2">
- <component
- :is="iconFor(item)"
- class="h-3.5 w-3.5 shrink-0"
- :class="item.type === 'VIEW' ? 'text-purple-500' : 'text-green-500'"
- />
- <span class="truncate font-medium">{{ item.name }}</span>
+ <component :is="iconFor(item)" class="h-3.5 w-3.5 shrink-0" :class="iconClass(item.type)" />
+ <span class="truncate text-[13px] font-medium text-foreground">{{ item.name }}</span>
</div>
- <div class="truncate text-muted-foreground">{{ typeLabel(item.type) }}</div>
- <div class="truncate text-muted-foreground">{{ item.schema || props.database }}</div>
- <div v-if="hasComments" class="truncate text-muted-foreground" :title="item.comment || ''">
+ <div class="truncate text-xs text-muted-foreground">{{ typeLabel(item.type) }}</div>
+ <div class="truncate text-xs text-muted-foreground">{{ item.schema || props.database }}</div>
+ <div v-if="hasComments" class="truncate text-xs text-muted-foreground" :title="item.comment || ''">
{{ item.comment || "" }}
</div>
</div>
diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts
index 7758746b0a..5ba3a73ab2 100644
--- a/src/i18n/locales/en.ts
+++ b/src/i18n/locales/en.ts
@@ -549,15 +549,19 @@ export default {
all: "All",
tables: "Tables",
views: "Views",
+ procedures: "Procedures",
+ functions: "Functions",
table: "Table",
view: "View",
+ procedure: "Procedure",
+ function: "Function",
name: "Name",
type: "Type",
schemaColumn: "Schema",
comment: "Comment",
loadingSchemas: "Loading schemas...",
schema: "Schema",
- search: "Search tables or views...",
+ search: "Search tables, views, functions, or procedures...",
loading: "Loading objects...",
empty: "No objects found",
},
diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts
index 5afa54fe93..04addc25fb 100644
--- a/src/i18n/locales/zh-CN.ts
+++ b/src/i18n/locales/zh-CN.ts
@@ -538,15 +538,19 @@ export default {
all: "全部",
tables: "表",
views: "视图",
+ procedures: "存储过程",
+ functions: "函数",
table: "表",
view: "视图",
+ procedure: "存储过程",
+ function: "函数",
name: "名称",
type: "类型",
schemaColumn: "Schema",
comment: "注释",
loadingSchemas: "加载 Schema...",
schema: "Schema",
- search: "搜索表或视图...",
+ search: "搜索表、视图、函数或存储过程...",
loading: "正在加载对象...",
empty: "没有找到对象",
},
diff --git a/src/lib/api.ts b/src/lib/api.ts
index 8ea4f36761..ab54fb36d7 100644
--- a/src/lib/api.ts
+++ b/src/lib/api.ts
@@ -56,6 +56,7 @@ export const loadSchemaCache = forward("loadSchemaCache");
export const deleteSchemaCachePrefix = forward("deleteSchemaCachePrefix");
export const listSchemas = forward("listSchemas");
export const listTables = forward("listTables");
+export const listObjects = forward("listObjects");
export const getColumns = forward("getColumns");
export const listIndexes = forward("listIndexes");
export const listForeignKeys = forward("listForeignKeys");
diff --git a/src/lib/http.ts b/src/lib/http.ts
index dec308b51c..36b02990a2 100644
--- a/src/lib/http.ts
+++ b/src/lib/http.ts
@@ -2,6 +2,7 @@ import type {
ConnectionConfig,
DatabaseInfo,
TableInfo,
+ ObjectInfo,
ColumnInfo,
IndexInfo,
ForeignKeyInfo,
@@ -170,6 +171,10 @@ export async function listTables(connectionId: string, database: string, schema:
return get(`/api/schema/tables?${qs({ connection_id: connectionId, database, schema })}`);
}
+export async function listObjects(connectionId: string, database: string, schema: string): Promise<ObjectInfo[]> {
+ return get(`/api/schema/objects?${qs({ connection_id: connectionId, database, schema })}`);
+}
+
export async function getColumns(
connectionId: string,
database: string,
diff --git a/src/lib/tauri.ts b/src/lib/tauri.ts
index 2a03c45059..45e024428e 100644
--- a/src/lib/tauri.ts
+++ b/src/lib/tauri.ts
@@ -4,6 +4,7 @@ import type {
ConnectionConfig,
DatabaseInfo,
TableInfo,
+ ObjectInfo,
ColumnInfo,
IndexInfo,
ForeignKeyInfo,
@@ -139,6 +140,10 @@ export async function listTables(connectionId: string, database: string, schema:
return invoke("list_tables", { connectionId, database, schema });
}
+export async function listObjects(connectionId: string, database: string, schema: string): Promise<ObjectInfo[]> {
+ return invoke("list_objects", { connectionId, database, schema });
+}
+
export async function listSchemas(connectionId: string, database: string): Promise<string[]> {
return invoke("list_schemas", { connectionId, database });
}
diff --git a/src/types/database.ts b/src/types/database.ts
index fff39447d0..c1d0bbb2bd 100644
--- a/src/types/database.ts
+++ b/src/types/database.ts
@@ -91,6 +91,15 @@ export interface TableInfo {
comment?: string | null;
}
+export type DatabaseObjectType = "TABLE" | "VIEW" | "PROCEDURE" | "FUNCTION";
+
+export interface ObjectInfo {
+ name: string;
+ object_type: DatabaseObjectType | string;
+ schema?: string | null;
+ comment?: string | null;
+}
+
export interface ColumnInfo {
name: string;
data_type: string;