Skip to content

wip#10

Merged
datlechin merged 7 commits intomainfrom
feat/database-switcher
Dec 26, 2025
Merged

wip#10
datlechin merged 7 commits intomainfrom
feat/database-switcher

Conversation

@datlechin
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings December 26, 2025 02:23
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a database switcher feature that allows users to quickly switch between databases on the same server, similar to TablePlus's "Open database" feature (⌘K). The implementation adds a modal sheet UI for database selection with keyboard navigation and search functionality.

Key changes:

  • Added a DatabaseSwitcherSheet modal with search, keyboard navigation, and database selection UI
  • Implemented fetchDatabases() method across all database drivers (MySQL, PostgreSQL, SQLite)
  • Added database name display in the toolbar with clickable UI to open the switcher
  • Integrated focused values to manage ESC key behavior when sheets are open

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
DatabaseSwitcherSheet.swift New modal sheet component for database switching with search and keyboard navigation
OpenTableApp.swift Refactored pasteboard commands to support focused values and added ⌘K shortcut for database switcher
MainContentView.swift Added database switcher state management and connection switching logic
ConnectionStatusView.swift Added clickable database name section in toolbar
OpenTableToolbarView.swift Passed database name to ConnectionStatusView
ConnectionSidebarHeader.swift Changed display from connection name to database name
PostgreSQLDriver.swift Implemented fetchDatabases() using pg_database query
MySQLDriver.swift Implemented fetchDatabases() using SHOW DATABASES
SQLiteDriver.swift Implemented fetchDatabases() returning empty array (file-based)
DatabaseDriver.swift Added fetchDatabases() protocol requirement
FocusedValues+Extensions.swift New file defining isDatabaseSwitcherOpen focused value key
ConnectionToolbarState.swift Added databaseName property to state
ContentView.swift Enhanced ESC key handling to respect sheet presentation state

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread OpenTable/Views/DatabaseSwitcher/DatabaseSwitcherSheet.swift Outdated
Comment thread OpenTable/Core/Database/PostgreSQLDriver.swift Outdated
Comment thread OpenTable/Core/Database/MySQLDriver.swift Outdated
Comment thread OpenTable/Views/Connection/ConnectionSidebarHeader.swift
Comment thread OpenTable/Views/Connection/ConnectionSidebarHeader.swift Outdated
Comment thread OpenTable/Views/MainContentView.swift Outdated
Comment thread OpenTable/Views/MainContentView.swift
Comment thread OpenTable/Views/DatabaseSwitcher/DatabaseSwitcherSheet.swift Outdated
datlechin and others added 4 commits December 26, 2025 09:29
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread OpenTable/Views/Connection/ConnectionSidebarHeader.swift
Comment thread OpenTable/Core/Database/MySQLDriver.swift Outdated
Comment thread OpenTable/ContentView.swift
Comment thread OpenTable/Views/MainContentView.swift
Comment thread OpenTable/Views/MainContentView.swift Outdated
- Refactor DatabaseSwitcherSheet to use custom listRowBackground with
  native selection color instead of focus-dependent List selection
- Fix scroll-to-selection timing by adding delay for List rendering
- Unify all row deletion paths to use notification system, fixing bug
  where deleting newly added rows only cleared background but didn't
  remove the row from the data source
- Remove unused deleteRow/deleteRows methods from TableViewCoordinator
- Simplify fetchDatabases() using flatMap instead of redundant nil coalescing
- Restore missing listRowInsets in DatabaseSwitcherSheet
- Show error alert when database switch fails instead of just logging
- Remove xcuserstate from git tracking (already in .gitignore)
@datlechin datlechin merged commit 7981868 into main Dec 26, 2025
@datlechin datlechin deleted the feat/database-switcher branch December 26, 2025 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants