Skip to content

Commit 718b624

Browse files
committed
fix: return empty array if no tables
1 parent 62d8c5a commit 718b624

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

server/api/_hub/database/tables.get.ts

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ export default eventHandler(async () => {
2020
return !isInternal
2121
})
2222

23+
if (!tables.length) {
24+
return []
25+
}
2326
const [columns, count, primaryKeys, indexes] = await Promise.all([
2427
db.batch(tables.map(({ name }) => db.prepare(`PRAGMA table_info("${name}")`)))
2528
.then(res => res.map(({ results }) => results as { name: string; type: string, notnull: number, dflt_value: null | string, pk: number }[])),

0 commit comments

Comments
 (0)