lamassu-server/packages/server/migrations/1505296896905-manual-override.js
siiky e10493abc6 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
  ...
2025-05-20 11:59:44 +01:00

55 lines
3.1 KiB
JavaScript

'use strict'
const db = require('./db')
exports.up = function (next) {
const sql = [
/**
* Replace all compliance_types enum values
*
* There is no ALTER TYPE name DROP/RENAME VALUE ... in psql
* This is a way to update all the existing enum values of an existing type
*
* @see {@link http://blog.yo1.dog/updating-enum-values-in-postgresql-the-safe-and-easy-way/}
*/
`create type compliance_type as enum
('authorized', 'sms', 'id_card_data', 'id_card_photo', 'sanctions_check', 'front_facing_cam', 'hard_limit')`,
'alter table compliance_authorizations alter column compliance_type set data type compliance_type using compliance_type::text::compliance_type',
'drop type compliance_types',
"create type verification_type as enum ('verified', 'blocked', 'automatic')",
'alter table customers drop column manually_verified ',
"alter table customers add column sms_override verification_type not null default 'automatic'",
'alter table customers add column sms_override_by text references user_tokens (token)',
'alter table customers add column sms_override_at timestamptz',
"alter table customers add column id_card_data_override verification_type not null default 'automatic'",
'alter table customers add column id_card_data_override_by text references user_tokens (token)',
'alter table customers add column id_card_data_override_at timestamptz',
"alter table customers add column id_card_photo_override verification_type not null default 'automatic'",
'alter table customers add column id_card_photo_override_by text references user_tokens (token)',
'alter table customers add column id_card_photo_override_at timestamptz',
"alter table customers add column front_facing_cam_override verification_type not null default 'automatic'",
'alter table customers add column front_facing_cam_override_by text references user_tokens (token)',
'alter table customers add column front_facing_cam_override_at timestamptz',
"alter table customers add column sanctions_check_override verification_type not null default 'automatic'",
'alter table customers add column sanctions_check_override_by text references user_tokens (token)',
'alter table customers add column sanctions_check_override_at timestamptz',
"alter table customers add column authorized_override verification_type not null default 'automatic'",
'alter table customers add column authorized_override_by text references user_tokens (token)',
'alter table customers add column authorized_override_at timestamptz',
'alter table customers add column authorized_at timestamptz',
'alter table customers add column sanctions_check_at timestamptz',
'alter table compliance_authorizations rename to compliance_overrides',
'alter table compliance_overrides add column verification verification_type not null',
'alter table compliance_overrides rename column authorized_at to override_at',
'alter table compliance_overrides rename column authorized_by to override_by',
]
db.multi(sql, next)
}
exports.down = function (next) {
next()
}