Add customers & compliance_authorizations tables
This commit is contained in:
parent
0d3614fe73
commit
ecdef92f82
3 changed files with 537 additions and 103 deletions
32
migrations/036-add_customers_table.js
Normal file
32
migrations/036-add_customers_table.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
var db = require('./db')
|
||||
|
||||
exports.up = function(next) {
|
||||
const sql =
|
||||
[
|
||||
'CREATE TABLE customers ( ' +
|
||||
'id uuid PRIMARY KEY,' +
|
||||
'phone text unique NOT NULL,' +
|
||||
'phone_at timestamptz NOT NULL,' +
|
||||
'id_card_number text,' +
|
||||
'id_card_expiration date,' +
|
||||
'id_card_data json,' +
|
||||
'id_card_at timestamptz,' +
|
||||
'name text,' +
|
||||
'address text,' +
|
||||
'manually_verified boolean,' +
|
||||
'sanctions_check boolean,' +
|
||||
'front_facing_cam_path text,' +
|
||||
'front_facing_cam_at timestamptz,' +
|
||||
'id_card_image_path text,' +
|
||||
'id_card_image_at timestamptz,' +
|
||||
'created timestamptz NOT NULL DEFAULT now() )',
|
||||
'ALTER TABLE cash_in_txs add column customer_id uuid REFERENCES customers (id)',
|
||||
'ALTER TABLE cash_out_txs add column customer_id uuid REFERENCES customers (id)'
|
||||
]
|
||||
|
||||
db.multi(sql, next)
|
||||
};
|
||||
|
||||
exports.down = function(next) {
|
||||
next();
|
||||
};
|
||||
19
migrations/040-add_compliance_authorizations_table.js
Normal file
19
migrations/040-add_compliance_authorizations_table.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
var db = require('./db')
|
||||
|
||||
exports.up = function(next) {
|
||||
const sql =
|
||||
["CREATE TYPE compliance_types as enum ('manual', 'sanctions', 'sanctions_override') ",
|
||||
'CREATE TABLE compliance_authorizations ( ' +
|
||||
'id uuid PRIMARY KEY, ' +
|
||||
'customer_id uuid REFERENCES customers (id), ' +
|
||||
'compliance_type compliance_types NOT NULL,' +
|
||||
'authorized_at timestamptz NOT NULL,' +
|
||||
'authorized_by text REFERENCES user_tokens (token) )' ]
|
||||
|
||||
|
||||
db.multi(sql, next)
|
||||
};
|
||||
|
||||
exports.down = function(next) {
|
||||
next();
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue