Edit database.js

main
sudoer777 2021-11-20 16:51:49 -07:00
parent 8213729009
commit 6f4a41fbd7
1 changed files with 9 additions and 3 deletions

View File

@ -18,7 +18,7 @@ async function executeQuery(query, values = []) {
return result.rows;
}
async function InitializeDatabase() {
async function Initialize() {
console.log("Initializing database...")
const sql = fs.readFileSync('database/init_database.sql').toString();
await executeQuery(sql);
@ -35,7 +35,13 @@ async function checkForDatabaseInitialization() {
const scoresSchemaExists = result.length !== 0;
if(!scoresSchemaExists) {
InitializeDatabase();
Initialize();
}
}
checkForDatabaseInitialization();
exports.executeQuery = executeQuery;