feat(postgres): 新增数据库节点新建模式功能

- 后端新增 CreateSchema 接口,支持在选中 PostgreSQL 数据库下创建 schema

- 侧边栏旧版菜单和新版菜单均增加新建模式入口

- 创建成功后刷新对象树,并支持空模式显示

- 补充 Wails 绑定与创建模式相关测试

Refs #480
This commit is contained in:
Syngnat
2026-05-23 18:32:51 +08:00
parent ec23d72332
commit 8615265ee1
7 changed files with 243 additions and 7 deletions

View File

@@ -21,6 +21,7 @@ import {
ClearOutlined,
DashboardOutlined,
FileTextOutlined,
FolderAddOutlined,
HddOutlined,
PushpinOutlined,
VerticalAlignBottomOutlined,
@@ -282,6 +283,7 @@ export const V2TableGroupContextMenuView: React.FC<{
export type V2DatabaseContextMenuActionKey =
| 'new-table'
| 'new-schema'
| 'new-materialized-view'
| 'new-external-catalog'
| 'rename-db'
@@ -296,11 +298,13 @@ export type V2DatabaseContextMenuActionKey =
export const V2DatabaseContextMenuView: React.FC<{
dbName: string;
dialect?: string;
supportsSchemaActions?: boolean;
supportsStarRocksActions?: boolean;
onAction?: (action: V2DatabaseContextMenuActionKey) => void;
}> = ({
dbName,
dialect,
supportsSchemaActions = false,
supportsStarRocksActions = false,
onAction,
}) => {
@@ -321,6 +325,7 @@ export const V2DatabaseContextMenuView: React.FC<{
<div className="gn-v2-context-menu-body">
{renderItems([
{ action: 'new-table', icon: <TableOutlined />, title: '新建表', kbd: '⌘N', featured: true },
...(supportsSchemaActions ? [{ action: 'new-schema', icon: <FolderAddOutlined />, title: '新建模式' }] : []),
{ action: 'new-query', icon: <ConsoleSqlOutlined />, title: '新建查询' },
{ action: 'run-sql', icon: <FileAddOutlined />, title: '运行外部 SQL 文件' },
])}