-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathlisting-3.26.js
More file actions
29 lines (24 loc) · 694 Bytes
/
listing-3.26.js
File metadata and controls
29 lines (24 loc) · 694 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"use strict";
const mysql = require('nodejs-mysql').default;
const config = {
host: "localhost",
port: 5000,
user: "root",
password: "root",
database: "earthquakes",
dateStrings: true,
debug: true,
acquireTimeout: 0,
connectTimeout: 0,
};
const db = mysql.getInstance(config);
const createDbCmd =
"create table largest_earthquakes_export ( Magnitude double, Time datetime, Latitude double, Longitude double, `Depth/Km` double )";
db.exec(createDbCmd)
.then(() => {
console.log("Database table created!");
})
.catch(err => {
console.error("Failed to create the database table.");
console.error(err.stack);
});