/[sudobot]/trunk/src/cli-commands/db/SyncDBCommand.ts
ViewVC logotype

Contents of /trunk/src/cli-commands/db/SyncDBCommand.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 344 - (show annotations)
Mon Jul 29 17:29:40 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: application/typescript
File size: 828 byte(s)
chore: eslint autofix
1 import { readdir } from "fs/promises";
2 import path from "path";
3 import { exit } from "process";
4 import DiscordClient from "../../client/Client";
5 import BaseCLICommand from "../../utils/structures/BaseCLICommand";
6
7 export default class SyncDBCommand extends BaseCLICommand {
8 constructor() {
9 super('syncdb', 'guild');
10 }
11
12 async run(client: DiscordClient, argv: string[], args: string[]) {
13 const files = await readdir(path.join(__dirname, '/../../models'));
14
15 for await (const file of files) {
16 if (file === '..' || file === '.')
17 continue;
18
19 const { default: model } = await import(path.join(__dirname, '/../../models', file));
20 await model.sync({
21 logging: console.log
22 });
23 }
24
25 exit(0);
26 }
27 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26