/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-empty-function */
import type { MigrationInterface, QueryRunner } from 'typeorm';

export class VoximplantCall1697019761609 implements MigrationInterface {
  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`
      create table voximplant_call (
        id integer generated by default as identity,
        external_id integer not null,
        user_id integer not null,
        entity_id integer,
        direction character varying not null,
        phone_number character varying not null,
        duration integer,
        status character varying,
        failure_reason character varying,
        record_url character varying,
        account_id integer not null,
        created_at timestamp without time zone not null,
        primary key (id),
        foreign key (user_id) references users(id) on delete cascade,
        foreign key (entity_id) references entity(id) on delete set null,
        foreign key (account_id) references account(id) on delete cascade
      );  
    `);
  }

  public async down(_queryRunner: QueryRunner): Promise<void> {}
}
