1
1
mirror of https://github.com/Burn-E99/GroupUp.git synced 2026-01-06 11:27:54 -05:00

Add DB audit command

This commit is contained in:
Ean Milligan (Bastion)
2023-04-30 00:27:15 -04:00
parent 022170a230
commit e26771f24e
5 changed files with 109 additions and 3 deletions

View File

@ -93,5 +93,20 @@ await dbClient.execute(`
`);
console.log('Table created');
// Database sizes view
console.log('Attempting to create view db_size');
await dbClient.execute(`
CREATE VIEW db_size AS
SELECT
table_name AS "table",
ROUND(((data_length + index_length) / 1024 / 1024), 3) AS "size",
table_rows AS "rows"
FROM information_schema.TABLES
WHERE
table_schema = "${config.db.name}"
AND table_name <> "db_size";
`);
console.log('View Created');
await dbClient.close();
console.log('Done!');

View File

@ -4,6 +4,7 @@ import { dbClient } from '../src/db.ts';
console.log('Attempting to insert default actions into command_cnt');
const actions = [
'msg-mention',
'cmd-audit',
'cmd-delete',
'cmd-help',
'cmd-info',