- [API] Finished the request to get all spells (associated tables for instance)

This commit is contained in:
Alexis
2020-03-28 20:45:44 +01:00
parent 481ed7507f
commit 27a1113bd2
5 changed files with 113 additions and 46 deletions

View File

@@ -13,4 +13,10 @@ const db = mysql.createConnection({
database: credentials.database,
})
db.on('error', err => {
if (err.errno == 'ECONNRESET') {
console.log("The connection was reset during your request. Please try again later.");
}
})
module.exports = { db }

7
database/querytests.sql Normal file
View File

@@ -0,0 +1,7 @@
USE spellsaurus;
/* Fetches a specific spell's school(s) */
SELECT school.name
FROM spells_schools AS sc
INNER JOIN school AS school ON sc.id_school = school.id
WHERE sc.id_spell = 1;

View File

@@ -1,14 +1,3 @@
DROP USER IF EXISTS 'archivist'@'%';
CREATE USER 'archivist'@'%'
IDENTIFIED BY 'root';
GRANT ALL
ON spellsaurus.*
TO 'archivist'@'%';
FLUSH PRIVILEGES;
DROP DATABASE IF EXISTS spellsaurus;
CREATE DATABASE spellsaurus;
USE spellsaurus;