2021-08-19 12:55:45 +00:00
|
|
|
import define from '../../define';
|
2021-05-08 03:51:23 +00:00
|
|
|
import { getConnection } from 'typeorm';
|
|
|
|
|
|
|
|
export const meta = {
|
|
|
|
requireCredential: true as const,
|
|
|
|
requireModerator: true,
|
|
|
|
|
|
|
|
tags: ['admin'],
|
|
|
|
|
|
|
|
params: {
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2022-01-02 17:12:50 +00:00
|
|
|
// eslint-disable-next-line import/no-default-export
|
2021-05-08 03:51:23 +00:00
|
|
|
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;
|
|
|
|
});
|