create table

This commit is contained in:
Mylloon 2022-11-03 17:21:27 +01:00
parent b83a1d3053
commit 0bdd2af66e
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -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 \
);');
};