import { MigrationInterface, QueryRunner } from 'typeorm';

export class Log1717560799195 implements MigrationInterface {
  name = 'Log1717560799195';

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `CREATE TABLE "logs" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "data_id" character varying, "module" character varying, "sub_module" character varying, "description" text, "process" character varying NOT NULL DEFAULT 'Create', "data" json, "old_data" json, "created_at" bigint, "creator_name" character varying, "creator_id" character varying, CONSTRAINT "PK_fb1b805f2f7795de79fa69340ba" PRIMARY KEY ("id"))`,
    );
    await queryRunner.query(
      `CREATE TABLE "log_errors" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "data_id" character varying, "module" character varying, "sub_module" character varying, "description" text, "message" json, "created_at" bigint, "creator_name" character varying, "creator_id" character varying, CONSTRAINT "PK_d268ea9ac1074d41949daaae79d" PRIMARY KEY ("id"))`,
    );
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`DROP TABLE "log_errors"`);
    await queryRunner.query(`DROP TABLE "logs"`);
  }
}
