]> git.r.bdr.sh - rbdr/lgtm/blame - scripts/setup_database.js
1.0.0 Release Updates
[rbdr/lgtm] / scripts / setup_database.js
CommitLineData
ead516a9
BB
1'use strict';
2
3const Config = require('../config/config');
4const Mysql = require('mysql2');
5
6const internals = {};
7
8internals.run = () => {
9
10 console.log(' .');
11 console.log(' /');
12 console.log(' +-----+');
13 console.log(' | o o | - Loading Good Things Momentarily');
14 console.log(' +-----+');
15 console.log(' +---------+');
16 console.log(' /| [][] |\\');
17 console.log(' || | |');
18 console.log(' || | \\c');
19 console.log(' ^+---------+');
20 console.log(' (.) ');
21
22 const connection = Mysql.createConnection(Config.mysql);
23
24 console.log(`> *BEEP* CREATING TABLE: ${Config.mysql.tableName}!`);
25 connection.query(`CREATE TABLE ${Config.mysql.tableName} (` +
26 'id SERIAL, ' +
27 'l VARCHAR(255), ' +
28 'g VARCHAR(255), ' +
29 't VARCHAR(255), ' +
30 'm VARCHAR(255), ' +
31 'emoji VARCHAR(255), ' +
32 'PRIMARY KEY (id) ' +
33 ') CHARACTER SET utf8mb4', (err) => {
34
35 if (err) {
36 console.error(`> *BWOOOP* ERROR DETECTED: ${err.message}!`);
37 process.exit(1);
38 }
39
40 console.log('> *BEEP BEEP* SUCCESS!');
41 process.exit(0);
42 });
43};
44
45internals.run();
46