/[sudobot]/branches/2.x/src/cli-commands/db/SyncDBCommand.ts
ViewVC logotype

Annotation of /branches/2.x/src/cli-commands/db/SyncDBCommand.ts

Parent Directory Parent Directory | Revision Log Revision Log


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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26