create table
This commit is contained in:
parent
b83a1d3053
commit
0bdd2af66e
1 changed files with 19 additions and 3 deletions
|
@ -27,9 +27,9 @@ export default async () => {
|
||||||
console.log('Translations progression :');
|
console.log('Translations progression :');
|
||||||
client.locales = await loadLocales(client.config.default_lang);
|
client.locales = await loadLocales(client.config.default_lang);
|
||||||
|
|
||||||
client.db = new Database(`${
|
client.db = new Database(`${process.env.DOCKERIZED === '1' ? '/config' : './config'}/db.sqlite3`);
|
||||||
process.env.DOCKERIZED === '1' ? '/config' : './config'
|
|
||||||
}/db.sqlite3`);
|
initDatabase(client.db);
|
||||||
|
|
||||||
return client;
|
return client;
|
||||||
};
|
};
|
||||||
|
@ -41,3 +41,19 @@ export const quit = (client: Client) => {
|
||||||
// Close client
|
// Close client
|
||||||
client.destroy();
|
client.destroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const initDatabase = (db: Database) => {
|
||||||
|
// Table for reminders
|
||||||
|
db.run('CREATE TABLE IF NOT EXISTS reminder ( \
|
||||||
|
id INTEGER PRIMARY KEY, \
|
||||||
|
data TEXT, \
|
||||||
|
expiration_date INTEGER, \
|
||||||
|
message_id INTEGER, \
|
||||||
|
option_id INTEGER, \
|
||||||
|
channel_id INTEGER, \
|
||||||
|
creation_date INTEGER, \
|
||||||
|
user_id INTEGER, \
|
||||||
|
guild_id INTEGER \
|
||||||
|
);');
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in a new issue