diff --git a/args/schema.sql b/args/schema.sql index fcd8f52..055e8e6 100644 --- a/args/schema.sql +++ b/args/schema.sql @@ -1,4 +1,4 @@ --- Main Tables +/* Main Tables */ CREATE TABLE Users ( floID CHAR(34) NOT NULL, @@ -100,7 +100,7 @@ status VARCHAR(50) NOT NULL, PRIMARY KEY(id) ); --- Backup feature (Table and Triggers) +/* Backup feature (Table and Triggers) */ CREATE TABLE _backup ( t_name VARCHAR(20), diff --git a/args/truncateAll.sql b/args/truncateAll.sql new file mode 100644 index 0000000..d59cf0d --- /dev/null +++ b/args/truncateAll.sql @@ -0,0 +1,13 @@ +TRUNCATE _backup; +TRUNCATE buyorder; +TRUNCATE cash; +TRUNCATE inputflo; +TRUNCATE inputrupee; +TRUNCATE outputflo; +TRUNCATE outputrupee; +TRUNCATE request_log; +TRUNCATE sellorder; +TRUNCATE sessions; +TRUNCATE transactions; +TRUNCATE users; +TRUNCATE vault; \ No newline at end of file diff --git a/src/backup/storage.js b/src/backup/storage.js index f3d8e9a..1c1d085 100644 --- a/src/backup/storage.js +++ b/src/backup/storage.js @@ -5,8 +5,8 @@ require('../lib'); require('../floCrypto'); const WebSocket = require('ws'); -const WAIT_TIME = 5 * 60 * 1000, - BACKUP_INTERVAL = 5 * 60 * 1000; +const WAIT_TIME = 1 * 60 * 1000, + BACKUP_INTERVAL = 1 * 60 * 1000; const myPrivKey = config.private_key, myPubKey = floCrypto.getPubKeyHex(config.private_key), diff --git a/src/database.js b/src/database.js index d5b35fd..951e2c4 100644 --- a/src/database.js +++ b/src/database.js @@ -85,7 +85,8 @@ function Database(user, password, dbname, host = 'localhost') { host: host, user: user, password: password, - database: dbname + database: dbname, + timezone: 'UTC' }); db.connect.then(conn => { conn.release(); diff --git a/src/market.js b/src/market.js index da263a8..8fa2044 100644 --- a/src/market.js +++ b/src/market.js @@ -512,7 +512,7 @@ function confirmDepositRupee() { if (!result.length) { let amount_flo = amounts[1]; txQueries.push(["INSERT INTO Vault(floID, quantity) VALUES (?, ?)", [req.floID, amount_flo]]); - txQueries.push(["INSERT INTO inputFLO(txid, floID, amount, status) VALUES (?, ?, ?)", [req.txid, req.floID, amount_flo, "SUCCESS"]]); + txQueries.push(["INSERT INTO inputFLO(txid, floID, amount, status) VALUES (?, ?, ?, ?)", [req.txid, req.floID, amount_flo, "SUCCESS"]]); } txQueries.push(["UPDATE inputRupee SET status=? WHERE id=?", ["SUCCESS", req.id]]); txQueries.push(["UPDATE Cash SET rupeeBalance=rupeeBalance+? WHERE floID=?", [amount_rupee, req.floID]]);