Add conversion of custom commands to SQL
This commit is contained in:
parent
904fa25a6d
commit
c63c2ab42c
3 changed files with 111 additions and 11 deletions
24
server/createDatabaseTables/createCustomCommandsTable.js
Normal file
24
server/createDatabaseTables/createCustomCommandsTable.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
const sqlite3 = require('sqlite3').verbose();
|
||||
|
||||
module.exports = async function () {
|
||||
const db = new sqlite3.Database('data/database.db');
|
||||
return new Promise ((resolve, reject)=>{
|
||||
db.run(
|
||||
`CREATE TABLE IF NOT EXISTS customCommands (
|
||||
customName TEXT PRIMARY KEY,
|
||||
customMessage TEXT,
|
||||
author TEXT,
|
||||
isDeleted INTEGER)`,
|
||||
(err) => {
|
||||
if (err) {
|
||||
console.error(`Error while creating table 'customCommands': ${err}`);
|
||||
reject(err);
|
||||
} else {
|
||||
console.log("Table 'customCommands' created successfully.");
|
||||
resolve();
|
||||
}
|
||||
db.close();
|
||||
}
|
||||
);
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue