Skip to content

Commit a880838

Browse files
committed
feat: modify createResource to return all tables and columns with process exit
1 parent 8569a35 commit a880838

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

adminforth/commands/createResource/main.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ export default async function createResource(args) {
1414
import { admin } from './${instance.file}.js';
1515
export async function exec() {
1616
await admin.discoverDatabases();
17-
return await admin.getAllTables();
17+
const allTables = await admin.getAllTables();
18+
setTimeout(process.exit);
19+
return allTables;
1820
}
1921
`);
2022

@@ -34,7 +36,9 @@ export default async function createResource(args) {
3436
import { admin } from './${instance.file}.js';
3537
export async function exec() {
3638
await admin.discoverDatabases();
37-
return await admin.getAllColumnsInTable("${table.table}");
39+
const columns = await admin.getAllColumnsInTable("${table.table}");
40+
setTimeout(process.exit);
41+
return columns;
3842
}
3943
`);
4044
console.log("🪲 Found columns:", columns);

adminforth/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,6 @@ class AdminForth implements IAdminForth {
391391
// console.log(`Connector ${dataSourceId} does not have getAllTables method`);
392392
results[dataSourceId] = [];
393393
}
394-
await connector.close();
395394
})
396395
);
397396

@@ -420,7 +419,6 @@ class AdminForth implements IAdminForth {
420419
} else {
421420
results[dataSourceId] = [];
422421
}
423-
await connector.close();
424422
})
425423
);
426424

0 commit comments

Comments
 (0)