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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 86 by rakin, Mon Jul 29 17:28:32 2024 UTC revision 329 by rakin, Mon Jul 29 17:29:34 2024 UTC
# Line 3  import path from "path"; Line 3  import path from "path";
3  import { exit } from "process";  import { exit } from "process";
4  import readline from "readline";  import readline from "readline";
5  import DiscordClient from "../../client/Client";  import DiscordClient from "../../client/Client";
 import BannedGuild from "../../models/BannedGuilds";  
6  import BaseCLICommand from "../../utils/structures/BaseCLICommand";  import BaseCLICommand from "../../utils/structures/BaseCLICommand";
7    
8  export default class SyncDBCommand extends BaseCLICommand {  export default class SyncDBCommand extends BaseCLICommand {
# Line 12  export default class SyncDBCommand exten Line 11  export default class SyncDBCommand exten
11      }      }
12    
13      async run(client: DiscordClient, argv: string[], args: string[]) {      async run(client: DiscordClient, argv: string[], args: string[]) {
14          const files = await readdir(path.join(client.rootdir, '/src/models'));          const files = await readdir(path.join(__dirname, '/../../models'));
15    
16          for await (const file of files) {          for await (const file of files) {
17              if (file === '..' || file === '.')              if (file === '..' || file === '.')
18                  continue;                  continue;
19                            
20              const { default: model } = await import(path.join(client.rootdir, '/src/models', file));              const { default: model } = await import(path.join(__dirname, '/../../models', file));
21              await model.sync({              await model.sync({
22                  logging: console.log                  logging: console.log
23              });              });

Legend:
Removed from v.86  
changed lines
  Added in v.329

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26