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

export class AddProductPermissions1690469860109 implements MigrationInterface {
  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`
      create table product_permissions (
        id integer generated by default as identity,
        account_id integer not null,
        user_id integer not null,
        module_id integer not null,
        view_product boolean not null,
        create_product boolean not null,
        edit_product boolean not null,
        create_order boolean not null,
        manage_shipping boolean not null,
        delete_product boolean not null,
        primary key (id),
        foreign key (account_id) references account(id) on delete cascade,
        foreign key (user_id) references users(id) on delete cascade,
        foreign key (module_id) references product_module(id) on delete cascade
      );  
    `);
  }

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