## 问题描述 问题1:设计表中修改索引时,当前实现采用“先删除旧索引,再创建新索引”的流程。当新索引创建过程中出现异常时,旧索引已经被删除,最终会导致原有索引丢失。见https://github.com/Syngnat/GoNavi/issues/300 问题2:自测时发现 索引列表还存在选择交互异常: - 只有一条索引被选中时,checkbox 偶发无法取消 - “修改”按钮会因选中状态异常而偶发不可用 - checkbox 与整行点击在某些情况下表现不一致 ## 问题原因 ### 1. 索引编辑失败后丢失原索引 索引修改流程是拆成两条 DDL 顺序执行: 1. 删除旧索引 2. 创建新索引 执行层没有事务保护,也没有失败补偿逻辑。 因此当第 1 步成功、第 2 步失败时,原索引会被直接删掉。 ### 2. 索引勾选状态异常 索引表存在两套同时修改选中状态的交互: - checkbox 自己维护一套 toggle - 整行点击也维护一套 toggle 两套逻辑共同修改 `selectedIndexKeys`,会导致事件命中时出现互相抵消,从而出现: - checkbox 偶发点不动 - 单选状态不稳定 - “修改”按钮偶发不可用 ## 修复方案 ### 1. 增加索引编辑失败恢复机制 - 抽出统一的 DDL 顺序执行逻辑,明确拿到失败语句位置 - 修改索引时,若旧索引删除成功但新索引创建失败,则自动尝试按旧定义恢复原索引 - 若无法恢复,则给出明确错误提示 - 同时增加“无实际变更”判断,避免无意义执行破坏性 DDL ### 2. 统一索引选择交互入口 - 将索引选中状态收敛到单一的 `toggleIndexSelection` 入口 - checkbox 区域改为只走同一套状态切换逻辑 - 阻断 checkbox 区域事件冒泡,避免和整行点击双重触发 - 消除重复选中与单选取消不稳定问题 ### 3. 补充单元测试 新增针对索引相关 helper 的单元测试,覆盖: - 索引行到编辑表单的归一化 - 无变更编辑识别 - 选择切换不重复 - 单选场景下反复点击可稳定选中/取消 - 仅在“删除旧索引成功、创建新索引失败”时触发恢复判断 ## 验证效果 ### 已验证 - 修改索引时,若新索引创建失败,会尝试恢复原索引 - 单条索引选中后,可稳定通过 checkbox 取消选中 - 多选/取消后,单选状态仍然稳定 - “修改”按钮随单选状态稳定启用/禁用 ### 单元测试 执行命令: ```bash npm test -- src/components/tableDesignerIndexUtils.test.ts ``` ## 回归执行结果: ### 问题1 - 索引bug#300_上报问题现象 <img width="1119" height="433" alt="索引bug#300_上报问题现象" src="https://github.com/user-attachments/assets/61831c2f-5840-4d0d-ab71-d6c82d0db63e" /> - 索引bug#300_修复效果截图 <img width="1500" height="460" alt="索引bug#300_修复效果截图" src="https://github.com/user-attachments/assets/277fd339-9bc4-4cfb-9e0f-d2365e334cdd" /> ### 问题2 - 索引修改前端事件问题现象截图,有时看着是正常的,实则是两套前端事件冲突 <img width="324" height="283" alt="索引修改前端事件问题" src="https://github.com/user-attachments/assets/849c362c-4ce3-46b6-9a33-f7348be9c581" /> <img width="491" height="348" alt="索引修改前端事件问题2_有时看着是正常的" src="https://github.com/user-attachments/assets/855a1ed7-1365-44cc-a2f9-6993c3d761e0" /> <img width="707" height="406" alt="索引修改前端事件问题3_checkbox事件冲突" src="https://github.com/user-attachments/assets/3c5fc75f-9eb2-470e-8b0c-976b8eaf5a94" /> - 索引修改前端事件问题修复效果 <img width="2308" height="792" alt="索引修改前端事件问题修复效果" src="https://github.com/user-attachments/assets/f22e8145-58fd-4ba1-9d29-e81a879af64d" /> ### 影响范围说明 本次修改影响设计表中的“索引”页签交互与索引编辑执行流程,主要包括: - 索引修改 - 索引单选/多选 - “修改”按钮启用状态 - 索引失败后的恢复处理 不影响: - 普通表结构保存流程 - 外键维护逻辑 - 触发器维护逻辑 - 非索引相关页面交互 ### 风险说明 - 索引恢复依赖旧索引定义能正确还原为创建 SQL - 当前修复已覆盖前端交互和失败补偿逻辑,但不同数据库方言下仍建议结合实际库型回归验证一次索引修改流程
GoNavi - A Modern Lightweight Database Client
Language: English | 简体中文
GoNavi is a modern, high-performance, cross-platform database client built with Wails (Go) and React. It delivers native-like responsiveness with low resource usage.
Compared with many Electron-based clients, GoNavi is typically smaller in binary size (around 10MB class), starts faster, and uses less memory.
Project Overview
GoNavi is designed for developers and DBAs who need a unified desktop experience across multiple databases.
- Native-performance architecture: Wails (Go + WebView) with lightweight runtime overhead.
- Large dataset usability: virtualized rendering and optimized DataGrid workflows for high-volume tables.
- Unified connectivity: URI build/parse, SSH tunnel, proxy support, and on-demand driver activation.
- Production-oriented workflow: SQL editor, object management, batch export/backup, sync tools, execution logs, and update checks.
Supported Data Sources
Built-in: available out of the box.
Optional driver agent: install/enable via Driver Manager first.
| Category | Data Source | Driver Mode | Typical Capabilities |
|---|---|---|---|
| Relational | MySQL | Built-in | Schema browsing, SQL query, data editing, export/backup |
| Relational | PostgreSQL | Built-in | Schema browsing, SQL query, data editing, object management |
| Relational | Oracle | Built-in | Query execution, object browsing, data editing |
| Cache | Redis | Built-in | Key browsing, command execution, encoding/view switch |
| Relational | MariaDB | Optional driver agent | Querying, object management, data editing |
| Relational | Doris | Optional driver agent | Querying, object browsing, SQL execution |
| Search | Sphinx | Optional driver agent | SphinxQL querying and object browsing |
| Relational | SQL Server | Optional driver agent | Schema browsing, SQL query, object management |
| File-based | SQLite | Optional driver agent | Local DB browsing, editing, export |
| File-based | DuckDB | Optional driver agent | Large-table query, pagination, file-DB workflow |
| Domestic DB | Dameng | Optional driver agent | Querying, object browsing, data editing |
| Domestic DB | Kingbase | Optional driver agent | Querying, object browsing, data editing |
| Domestic DB | HighGo | Optional driver agent | Querying, object browsing, data editing |
| Domestic DB | Vastbase | Optional driver agent | Querying, object browsing, data editing |
| Document | MongoDB | Optional driver agent | Document query, collection browsing, connection management |
| Time-series | TDengine | Optional driver agent | Time-series schema browsing and querying |
| Columnar Analytics | ClickHouse | Optional driver agent | Analytical query, object browsing, SQL execution |
| Extensibility | Custom Driver/DSN | Custom | Extend to more data sources via Driver + DSN |
📸 Screenshots
Key Features
Performance
- Smooth interaction under load: optimized table interaction (including column resize workflow on large datasets).
- Virtualized rendering: keeps large result sets responsive.
Data Management (DataGrid)
- In-place cell editing.
- Batch insert/update/delete with transaction-oriented submit/rollback.
- Large-field popup editor.
- Context actions (set NULL, copy/export, etc.).
- Smart read/write mode switching based on query context.
- Export formats: CSV, Excel (XLSX), JSON, Markdown.
SQL Editor
- Monaco Editor core.
- Context-aware completion for databases/tables/columns.
- Multi-tab query workflow.
Batch Export / Backup
- Database-level and table-level batch export/backup.
- Scope-aware operation flow to reduce mistakes.
Connectivity
- URI generation/parsing.
- SSH tunnel support.
- Proxy support.
- Config import/export (JSON).
- Optional driver management and activation.
Redis Tools
- Multi-view value rendering (auto/raw text/UTF-8/hex).
- Built-in command execution panel.
Observability and Update
- SQL execution logs with timing information.
- Startup/scheduled/manual update checks.
UI/UX
- Ant Design 5 based interface.
- Light/Dark themes.
- Flexible sidebar and layout behavior.
Tech Stack
- Backend: Go 1.24 + Wails v2
- Frontend: React 18 + TypeScript + Vite
- UI: Ant Design 5
- State Management: Zustand
- Editor: Monaco Editor
Installation and Run
Prerequisites
Development Mode
# Clone
git clone https://github.com/Syngnat/GoNavi.git
cd GoNavi
# Start development with hot reload
wails dev
Build
# Build for current platform
wails build
# Clean build (recommended before release)
wails build -clean
Artifacts are generated in build/bin.
Cross-Platform Release (GitHub Actions)
The repository includes a release workflow.
Push a v* tag to trigger automated build and release.
Release notes are generated automatically from merged pull requests and categorized by .github/release.yaml.
Target artifacts include:
- macOS (AMD64 / ARM64)
- Windows (AMD64)
- Linux (AMD64, WebKitGTK 4.0 and 4.1 variants)
Troubleshooting
macOS: "App is damaged and can’t be opened"
Without Apple notarization, Gatekeeper may block startup.
- Move
GoNavi.appto Applications. - Open Terminal.
- Run:
sudo xattr -rd com.apple.quarantine /Applications/GoNavi.app
Or right-click the app in Finder and choose Open with Control key flow.
Linux: missing libwebkit2gtk / libjavascriptcoregtk
GoNavi depends on WebKitGTK runtime libraries.
# Debian 13 / Ubuntu 24.04+
sudo apt-get update
sudo apt-get install -y libgtk-3-0 libwebkit2gtk-4.1-0 libjavascriptcoregtk-4.1-0
# Ubuntu 22.04 / Debian 12
sudo apt-get update
sudo apt-get install -y libgtk-3-0 libwebkit2gtk-4.0-37 libjavascriptcoregtk-4.0-18
If you use Linux artifacts with the -WebKit41 suffix, prefer Debian 13 / Ubuntu 24.04+.
Contributing
Issues and pull requests are welcome.
For the full workflow, branch model, and maintainer sync rules, see:
External contributors should open pull requests directly against main.
License
Licensed under Apache-2.0.