mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 09:57:29 -07:00
Create get-index-stats.ts
This commit is contained in:
parent
3ed3f208f2
commit
befe913517
1 changed files with 26 additions and 0 deletions
26
src/server/api/endpoints/admin/get-index-stats.ts
Normal file
26
src/server/api/endpoints/admin/get-index-stats.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
import define from '../../define';
|
||||
import { getConnection } from 'typeorm';
|
||||
|
||||
export const meta = {
|
||||
requireCredential: true as const,
|
||||
requireModerator: true,
|
||||
|
||||
tags: ['admin'],
|
||||
|
||||
params: {
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async () => {
|
||||
const stats = await
|
||||
getConnection().query(`SELECT * FROM pg_indexes;`)
|
||||
.then(recs => {
|
||||
const res = [] as { tablename: string; indexname: string; }[];
|
||||
for (const rec of recs) {
|
||||
res.push(rec);
|
||||
}
|
||||
return res;
|
||||
});
|
||||
|
||||
return stats;
|
||||
});
|
Loading…
Reference in a new issue