ekyc

Electronic KYC process with uploading ID document using OAuth 2.1 (experimental)
Log | Files | Refs | README | LICENSE

20240606001232_create_phone.ts (1158B)


      1 import {
      2   AbstractMigration,
      3   ClientPostgreSQL,
      4   Info,
      5 } from "https://deno.land/x/nessie@2.0.11/mod.ts";
      6 
      7 export default class extends AbstractMigration<ClientPostgreSQL> {
      8   /** Runs on migrate */
      9   async up(_info: Info): Promise<void> {
     10     await this.client.queryArray`create table "phone" (
     11       "uuid" uuid not null,
     12       "phoneNumber" varchar not null unique,
     13       "phoneNumberVerified" boolean not null default false,
     14       "phoneNumberCode" varchar null,
     15       "phoneNumberCodeExpire" timestamp not null default ('1970-01-01 00:00:00'),
     16       "phoneNumberChallengeRequest" int4 not null default 0,
     17       "phoneNumberChallengeRequestExpire" timestamp not null default ('1970-01-01 00:00:00'),
     18       "phoneNumberChallengeAttempt" int4 not null default 0,
     19       "phoneNumberChallengeAttemptExpire" timestamp not null default ('1970-01-01 00:00:00'),
     20       "version" int4 not null default 0,
     21       constraint phone_pk primary key("uuid"),
     22       constraint phone_number_uk unique ("phoneNumber")
     23     );`;
     24   }
     25 
     26   /** Runs on rollback */
     27   async down(_info: Info): Promise<void> {
     28     await this.client.queryArray`drop table "phone" cascade;`;
     29   }
     30 }