Merge branch 'dev' into feat/lam-1291/stress-testing
* dev: (85 commits) chore: console.log debug leftovers fix: third level navigation links fix: show subheader on refresh fix: machines/:id routing fix: customer route chore: update wallet nodes feat: shorten long addresses in funding page feat: shorten long addresses refactor: support copied text different from presented text chore: udpate react, downshift and routing refactor: use Wizard component on first route fix: autocomplete component rendering feat: skip2fa option on .env fix: drop contraint before dropping index chore: stop using alias imports fix: re-instate urlResolver chore: server code formatting chore: reformat code chore: adding eslint and prettier config chore: typo ...
This commit is contained in:
commit
e10493abc6
1398 changed files with 60329 additions and 157527 deletions
88
packages/server/migrations/004-transactions-reload.js
Normal file
88
packages/server/migrations/004-transactions-reload.js
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
var db = require('./db')
|
||||
|
||||
function singleQuotify(item) {
|
||||
return "'" + item + "'"
|
||||
}
|
||||
|
||||
exports.up = function (next) {
|
||||
var stages = [
|
||||
'initial_request',
|
||||
'partial_request',
|
||||
'final_request',
|
||||
'partial_send',
|
||||
'deposit',
|
||||
'dispense_request',
|
||||
'dispense',
|
||||
]
|
||||
.map(singleQuotify)
|
||||
.join(',')
|
||||
|
||||
var authorizations = [
|
||||
'timeout',
|
||||
'machine',
|
||||
'pending',
|
||||
'rejected',
|
||||
'published',
|
||||
'authorized',
|
||||
'confirmed',
|
||||
]
|
||||
.map(singleQuotify)
|
||||
.join(',')
|
||||
|
||||
var sqls = [
|
||||
'CREATE TYPE transaction_stage AS ENUM (' + stages + ')',
|
||||
'CREATE TYPE transaction_authority AS ENUM (' + authorizations + ')',
|
||||
|
||||
'CREATE TABLE transactions ( ' +
|
||||
'id serial PRIMARY KEY, ' +
|
||||
'session_id uuid NOT NULL, ' +
|
||||
'device_fingerprint text, ' +
|
||||
'to_address text NOT NULL, ' +
|
||||
'satoshis integer NOT NULL DEFAULT 0, ' +
|
||||
'fiat integer NOT NULL DEFAULT 0, ' +
|
||||
'currency_code text NOT NULL, ' +
|
||||
'fee integer NOT NULL DEFAULT 0, ' +
|
||||
'incoming boolean NOT NULL, ' +
|
||||
'stage transaction_stage NOT NULL, ' +
|
||||
'authority transaction_authority NOT NULL, ' +
|
||||
'tx_hash text, ' +
|
||||
'error text, ' +
|
||||
'created timestamp NOT NULL DEFAULT now(), ' +
|
||||
'UNIQUE (session_id, to_address, stage, authority) ' +
|
||||
')',
|
||||
'CREATE INDEX ON transactions (session_id)',
|
||||
|
||||
'CREATE TABLE pending_transactions ( ' +
|
||||
'id serial PRIMARY KEY, ' +
|
||||
'device_fingerprint text NOT NULL, ' +
|
||||
'session_id uuid UNIQUE NOT NULL, ' +
|
||||
'incoming boolean NOT NULL, ' +
|
||||
'currency_code text NOT NULL, ' +
|
||||
'to_address text NOT NULL, ' +
|
||||
'satoshis integer NOT NULL, ' +
|
||||
'updated timestamp NOT NULL DEFAULT now() ' +
|
||||
')',
|
||||
|
||||
'CREATE TABLE dispenses ( ' +
|
||||
'id serial PRIMARY KEY, ' +
|
||||
'device_fingerprint text NOT NULL, ' +
|
||||
'transaction_id integer UNIQUE REFERENCES transactions(id), ' +
|
||||
'dispense1 integer NOT NULL, ' +
|
||||
'reject1 integer NOT NULL, ' +
|
||||
'count1 integer NOT NULL, ' +
|
||||
'dispense2 integer NOT NULL, ' +
|
||||
'reject2 integer NOT NULL, ' +
|
||||
'count2 integer NOT NULL, ' +
|
||||
'refill boolean NOT NULL, ' +
|
||||
'error text, ' +
|
||||
'created timestamp NOT NULL DEFAULT now() ' +
|
||||
')',
|
||||
'CREATE INDEX ON dispenses (device_fingerprint)',
|
||||
]
|
||||
|
||||
db.multi(sqls, next)
|
||||
}
|
||||
|
||||
exports.down = function (next) {
|
||||
next()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue