Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@

## Features

- **Multi-Database Support**: Connect to PostgreSQL, MySQL, and SQLite.
- **Multi-Database Support**: Connect to PostgreSQL, MySQL, SQLite, and local DuckDB files.
- **DuckDB (read-only preview)**: Open an existing `.duckdb` file, browse tables and views, run one bounded `SELECT` at a time, and profile a bounded table sample. DuckDB connections cannot edit data, import/export, compare databases, or use the relationship map yet; external file access and extension autoloading are disabled.
- **AI Assistant**: Generate, explain, and fix SQL with your own Gemini, Groq, Claude, or OpenAI API key. Review the outbound request and proposed SQL before use.
- **Modern Sidebar Experience**:
- **Items**: Explore your databases, schemas, and tables.
Expand Down Expand Up @@ -94,7 +95,7 @@ For automated PostgreSQL and MariaDB release checks, use the [cross-engine smoke
## Tech Stack

- **Frontend**: React, TypeScript, Tailwind CSS, Monaco Editor, Lucide Icons.
- **Backend**: Rust (using `sqlx` for database interactions).
- **Backend**: Rust (`sqlx` for PostgreSQL, MySQL, and SQLite; `duckdb` for local DuckDB files).
- **Framework**: [Tauri](https://tauri.app/).

## Recommended IDE Setup
Expand Down
4 changes: 4 additions & 0 deletions scripts/connection-clarity.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ test('untagged and SQLite connections do not pretend to be local servers', () =>
assert.equal(connectionIdentity({ name: 'Archive', type: 'Sqlite', database: '/tmp/archive.db' }).target, '/tmp/archive.db');
});

test('DuckDB connections identify the selected local file', () => {
assert.equal(connectionIdentity({ name: 'Warehouse', type: 'DuckDb', database: '/tmp/warehouse.duckdb' }).target, '/tmp/warehouse.duckdb');
});

test('mode descriptions reflect actual SQL approval behavior', () => {
assert.match(safetyModeDescription('Alert'), /every SQL query and data change/i);
assert.match(safetyModeDescription('Safe'), /read-only SELECT/i);
Expand Down
1 change: 1 addition & 0 deletions scripts/connection-credentials.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ test('remembered connections skip the prompt only when every required secret exi
test('unremembered connections still request credentials', () => {
assert.equal(needsCredentialPrompt({ type: 'Postgres' }, { database: true, ssh: true }), true);
assert.equal(needsCredentialPrompt({ type: 'Sqlite' }, null), false);
assert.equal(needsCredentialPrompt({ type: 'DuckDb' }, null), false);
});
7 changes: 7 additions & 0 deletions scripts/connection-target.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ test('SQLite metadata does not depend on hidden server fields', () => {
assert.equal(connectionTargetChanged(previous, { ...previous, host: '127.0.0.1', username: '' }), false);
});

test('DuckDB target identity uses only the file path', () => {
const previous = { type: 'DuckDb', database: '/tmp/shop.duckdb' };
assert.equal(connectionTargetChanged(previous, { ...previous, host: 'unused' }), false);
assert.equal(connectionTargetChanged(previous, { ...previous, database: '/tmp/other.duckdb' }), true);
assert.equal(connectionTargetFingerprint(previous), connectionTargetFingerprint({ ...previous, username: 'unused' }));
});

test('saved-query target fingerprint ignores labels but detects a new destination', () => {
const previous = { type: 'MySql', host: 'db.example.com', port: 3306, username: 'app', database: 'main', ssh_enabled: true, ssh_host: 'bastion-a' };
assert.equal(connectionTargetFingerprint(previous), connectionTargetFingerprint({ ...previous, name: 'Renamed', safetyMode: 'Safe' }));
Expand Down
22 changes: 22 additions & 0 deletions scripts/quick-open.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,28 @@ test('quick open keeps duplicate tab and table names distinguishable by kind and
assert.ok(items.find(item => item.id === 'tab:tab-remote').detail.includes('Production'));
});

test('quick open keeps DuckDB tables with the same name in different schemas distinct', () => {
const duckdbState = {
...state,
activeConnectionId: 'duckdb',
activeDatabase: '/tmp/shop.duckdb',
openConnectionIds: ['duckdb'],
savedConnections: [{ id: 'duckdb', name: 'Shop', type: 'DuckDb', database: '/tmp/shop.duckdb' }],
databases: ['/tmp/shop.duckdb'],
sidebarItems: { duckdb: [
{ name: 'orders', schema: 'main', item_type: 'Table' },
{ name: 'orders', schema: 'archive', item_type: 'Table' },
] },
tabs: [],
savedQueries: [],
queryHistory: [],
};
const tables = buildQuickOpenItems(duckdbState).filter(item => item.kind === 'table');
assert.deepEqual(tables.map(item => item.targetId), ['main.orders', 'archive.orders']);
assert.equal(new Set(tables.map(item => item.id)).size, 2);
assert.equal(resolveQuickOpenTarget(tables[1], duckdbState)?.targetId, 'archive.orders');
});

test('quick open rejects stale targets rather than using an old connection or database', () => {
const items = buildQuickOpenItems(state);
const table = items.find(item => item.id === 'table:local:Table:admins');
Expand Down
24 changes: 24 additions & 0 deletions scripts/sql-identifiers.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import assert from 'node:assert/strict';
import { test } from 'node:test';
import { build } from 'esbuild';

const { outputFiles } = await build({
entryPoints: ['src/utils/sqlIdentifiers.ts'],
bundle: true,
platform: 'node',
format: 'esm',
write: false,
});
const { quoteTableReference } = await import(
`data:text/javascript;base64,${Buffer.from(outputFiles[0].contents).toString('base64')}`
);

test('DuckDB table references quote schema and table separately', () => {
assert.equal(quoteTableReference('archive.orders', 'DuckDb'), '"archive"."orders"');
assert.equal(quoteTableReference('main.orders', 'DuckDb'), '"main"."orders"');
});

test('other database table names retain their existing single-identifier quoting', () => {
assert.equal(quoteTableReference('orders', 'Postgres'), '"orders"');
assert.equal(quoteTableReference('orders', 'MySql'), '`orders`');
});
Loading
Loading