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

export class AddMailMessageScheduled1723373462514 implements MigrationInterface {
  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`
      create table mail_message_scheduled (
        id integer generated by default as identity,
        account_id integer not null,
        created_by integer not null,
        created_at timestamp not null default now(),
        mailbox_id integer not null,
        subject text not null,
        content text not null,
        send_to text not null,
        send_as_html boolean not null,
        entity_id integer,
        sent_at timestamp,
        primary key (id),
        foreign key (account_id) references account(id) on delete cascade,
        foreign key (created_by) references users(id),
        foreign key (mailbox_id) references mailbox(id) on delete cascade,
        foreign key (entity_id) references entity(id) on delete set null
      );
    `);
  }

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