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

export class VoximplantNumber1716299180820 implements MigrationInterface {
  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`
      create table voximplant_number (
        id integer generated by default as identity,
        account_id integer not null,
        number character varying not null,
        external_id character varying,
        primary key (id),
        foreign key (account_id) references account(id) on delete cascade
      );

      create table voximplant_number_user (
        number_id integer,
        user_id integer,
        account_id integer not null,
        primary key (number_id, user_id),
        foreign key (number_id) references voximplant_number(id) on delete cascade,
        foreign key (user_id) references users(id) on delete cascade,
        foreign key (account_id) references account(id) on delete cascade
      );
    `);
  }

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