Skip to content

Refresh catalog on ddl query execution#311

Merged
danvergara merged 3 commits into
mainfrom
refresh-catalog
May 28, 2026
Merged

Refresh catalog on ddl query execution#311
danvergara merged 3 commits into
mainfrom
refresh-catalog

Conversation

@danvergara

@danvergara danvergara commented May 27, 2026

Copy link
Copy Markdown
Owner

Refresh catalog on DDL query execution

Summary

This PR automatically refreshes the database catalog (sidebar tree) whenever the user executes a DDL query (e.g., CREATE, DROP, ALTER, TRUNCATE, RENAME). Previously, the sidebar would remain stale after schema changes, requiring the user to restart the application to see updated tables and structures.

Changes

  • Detect DDL queries: After executing a query, the first keyword is inspected. If it matches a DDL statement (create, drop, alter, truncate, rename), the querySuccessMsg is flagged with reloadCatalog: true.
  • Async catalog refresh: A new updateGraph method on SidebarViewport fetches the catalog and rebuilds the tree view asynchronously via a Bubble Tea command, so it does not block the UI.
  • New message types: updateGraphMsg and updateGraphErrMsg are introduced to propagate the refreshed tree (or errors) through the Bubble Tea update loop.
  • Sidebar handles refresh: The SidebarViewport.Update method now listens for querySuccessMsg to trigger a reload and for updateGraphMsg to swap in the new tree.
  • Cleanup: Removed a stale expandAll method call from the sidebar.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Locally, against databases running on containers.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

@danvergara danvergara marked this pull request as draft May 27, 2026 05:11
@danvergara danvergara changed the title feat(bubbletui): refresh the catalog when a ddl query is executed Refresh the catalog when a ddl query is executed May 28, 2026
@danvergara danvergara marked this pull request as ready for review May 28, 2026 02:03
@danvergara danvergara changed the title Refresh the catalog when a ddl query is executed Refresh catalog on ddl query execution May 28, 2026
@danvergara danvergara merged commit c7d28bf into main May 28, 2026
4 checks passed
@danvergara danvergara deleted the refresh-catalog branch May 28, 2026 02:08
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.

1 participant