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

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

      create table field_stage_settings (
        id integer generated by default as identity,
        account_id integer not null,
        field_id integer not null,
        stage_id integer not null,
        access character varying not null,
        exclude_user_ids character varying,
        primary key (id),
        foreign key (account_id) references account(id) on delete cascade,
        foreign key (field_id) references field(id) on delete cascade,
        foreign key (stage_id) references stage(id) on delete cascade
      );
    `);
  }

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