dbcat 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +6 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dbcat",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "A simple CLI to view database tables. Supports PostgreSQL, MySQL, and SQLite.",
5
5
  "author": "RiskyMH",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -53,11 +53,14 @@ export function getAllTables(sql: InstanceType<typeof Bun.SQL>) {
53
53
  switch (adapter) {
54
54
  case "postgres":
55
55
  return sql`
56
- SELECT table_name as name
56
+ SELECT CASE
57
+ WHEN table_schema = 'public' THEN table_name
58
+ ELSE table_schema || '.' || table_name
59
+ END as name
57
60
  FROM information_schema.tables
58
- WHERE table_schema = 'public'
61
+ WHERE table_schema NOT IN ('pg_catalog', 'information_schema')
59
62
  AND table_type = 'BASE TABLE'
60
- ORDER BY table_name
63
+ ORDER BY table_schema, table_name
61
64
  ` as Promise<{ name: string }[]>;
62
65
  case "mysql":
63
66
  case "mariadb":