forked from oceanprotocol/df-sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit_tables.js
More file actions
36 lines (33 loc) · 918 Bytes
/
init_tables.js
File metadata and controls
36 lines (33 loc) · 918 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
30
31
32
33
34
35
36
require("dotenv").config();
const mysql = require("mysql2");
const {
poolInfoTable,
poolVolsTable,
stakesChain,
rewardsInfo,
} = require("./db/structure");
const con = mysql.createConnection({
host: process.env["MYSQL_HOST"],
user: process.env["MYSQL_USERNAME"],
password: process.env["MYSQL_PASS"],
database: process.env["MYSQL_DB"],
});
con.connect(function (err) {
if (err) throw err;
con.query(poolInfoTable, function (err, result) {
if (err) throw err;
console.log("Table pool_info created");
});
con.query(poolVolsTable, function (err, result) {
if (err) throw err;
console.log("Table pool_vols created");
});
con.query(stakesChain, function (err, result) {
if (err) throw err;
console.log("Table pool_stakes created");
});
con.query(rewardsInfo, function (err, result) {
if (err) throw err;
console.log("Table rewards_info created");
});
});