From 143ce8a98ce6dabe8fdb71377c351f4857314d36 Mon Sep 17 00:00:00 2001 From: goga-m Date: Mon, 14 Aug 2017 17:50:34 +0300 Subject: [PATCH] Changes on customers & compliance_authorization tables --- migrations/036-add_customers_table.js | 38 +++++++++---------- ...037-add_compliance_authorizations_table.js | 14 +++---- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/migrations/036-add_customers_table.js b/migrations/036-add_customers_table.js index 6cb2aaa3..445e9223 100644 --- a/migrations/036-add_customers_table.js +++ b/migrations/036-add_customers_table.js @@ -3,25 +3,25 @@ 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)' + `create table customers ( + id uuid PRIMARY KEY, + phone text unique, + phone_at timestamptz, + 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) diff --git a/migrations/037-add_compliance_authorizations_table.js b/migrations/037-add_compliance_authorizations_table.js index 7d0bf747..88f1e94d 100644 --- a/migrations/037-add_compliance_authorizations_table.js +++ b/migrations/037-add_compliance_authorizations_table.js @@ -2,13 +2,13 @@ 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) )' ] + [`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)