/[sudobot]/trunk/src/client/Database.ts
ViewVC logotype

Diff of /trunk/src/client/Database.ts

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

revision 51 by rakin, Mon Jul 29 17:28:23 2024 UTC revision 59 by rakin, Mon Jul 29 17:28:25 2024 UTC
# Line 1  Line 1 
1    import { Sequelize } from 'sequelize';
2  import { Database as DB } from 'sqlite3';  import { Database as DB } from 'sqlite3';
3  import DiscordClient from './Client';  import DiscordClient from './Client';
4    
# Line 5  export default class Database { Line 6  export default class Database {
6      client: DiscordClient;      client: DiscordClient;
7      dbpath: string;      dbpath: string;
8      db: DB;      db: DB;
9        sequelize: Sequelize;
10    
11      constructor(dbpath: string, client: DiscordClient) {      constructor(dbpath: string, client: DiscordClient) {
12          this.client = client;          this.client = client;
13          this.dbpath = dbpath;          this.dbpath = dbpath;
14    
15            this.sequelize = new Sequelize({
16                dialect: 'sqlite',
17                storage: dbpath
18            });
19    
20          this.db = new DB(dbpath, (err) => {          this.db = new DB(dbpath, (err) => {
21              if (err) {              if (err) {
22                  console.log(err);                  console.log(err);
# Line 62  export default class Database { Line 70  export default class Database {
70              });              });
71          });          });
72      }      }
73    
74        get s(): Sequelize {
75            return this.sequelize;
76        }
77  };  };

Legend:
Removed from v.51  
changed lines
  Added in v.59

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26