Bug fixes

- Fixed: error caused during inputRupee
- Passing timezone UTC in DB connection for uniformity between main server and backups.
- Changed single-line comments to multi-line comments in schema.sql
- Addng truncateAll.sql: can be used to clear the database (data only).
This commit is contained in:
sairajzero 2021-10-21 21:08:12 +05:30
parent 5bfc62113f
commit f7584629b9
5 changed files with 20 additions and 6 deletions

View File

@ -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),

13
args/truncateAll.sql Normal file
View File

@ -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;

View File

@ -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),

View File

@ -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();

View File

@ -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]]);