lowercased column names

This commit is contained in:
Josh Harvey 2014-04-23 09:52:54 -04:00
parent 7464b93d7b
commit e1c6d3a05f

View file

@ -26,8 +26,8 @@ PostgresqlInterface.prototype.summonTransaction =
// If it worked, go ahead with transaction
// If duplicate, fetch status and return
var self = this;
this.client.query('INSERT INTO transactions (id, status, "deviceFingerprint", ' +
'"toAddress", satoshis, "currencyCode", fiat) ' +
this.client.query('INSERT INTO transactions (id, status, device_fingerprint, ' +
'to_address, satoshis, currency_code, fiat) ' +
'VALUES ($1, $2, $3, $4, $5, $6, $7)', [tx.txId, 'pending', deviceFingerprint,
tx.toAddress, tx.satoshis, tx.currencyCode, tx.fiat],
function (err) {
@ -47,7 +47,7 @@ PostgresqlInterface.prototype.reportTransactionError =
PostgresqlInterface.prototype.completeTransaction =
function completeTransaction(tx, txHash) {
if (txHash)
this.client.query('UPDATE transactions SET "txHash"=$1, status=$2, completed=now() WHERE id=$3',
this.client.query('UPDATE transactions SET tx_hash=$1, status=$2, completed=now() WHERE id=$3',
[txHash, 'completed', tx.txId]);
else
this.client.query('UPDATE transactions SET status=$1, error=$2 WHERE id=$3',
@ -56,7 +56,7 @@ PostgresqlInterface.prototype.completeTransaction =
PostgresqlInterface.prototype._fetchTransaction =
function _fetchTransaction(txId, cb) {
this.client.query('SELECT status, "txHash" FROM transactions WHERE id=$1',
this.client.query('SELECT status, tx_hash FROM transactions WHERE id=$1',
[txId], function (err, results) {
if (err) return cb(err);
@ -64,6 +64,6 @@ PostgresqlInterface.prototype._fetchTransaction =
if (results.rows.length === 0) return cb(new Error('Couldn\'t find transaction.'));
var result = results.rows[0];
cb(null, false, result.txHash);
cb(null, false, result.tx_hash);
});
};