mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
@@ -6,10 +6,14 @@ export default async function count(collection: string) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const records = await database(collection).count('*', { as: 'count' });
|
||||
const count = Number(records[0].count);
|
||||
try {
|
||||
const records = await database(collection).count('*', { as: 'count' });
|
||||
const count = Number(records[0].count);
|
||||
|
||||
console.log(count);
|
||||
|
||||
database.destroy();
|
||||
console.log(count);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
} finally {
|
||||
database.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user