import { MigrationInterface, QueryRunner } from "typeorm";

export class Migrations1731667485294 implements MigrationInterface {
    name = 'Migrations1731667485294'

    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`CREATE TABLE "file_logs" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "row_number" integer NOT NULL DEFAULT '0', "error_message" text DEFAULT '', "created_at" TIMESTAMP(0) NOT NULL DEFAULT now(), "updated_at" TIMESTAMP(0) NOT NULL DEFAULT now(), "deleted_at" TIMESTAMP(0), "file_manager_id" uuid, CONSTRAINT "PK_f2e995ff9aa76e669bb6696c05a" PRIMARY KEY ("id"))`);
        await queryRunner.query(`ALTER TABLE "file_logs" ADD CONSTRAINT "FK_c7bcf14e27dcebcd11fc2f73c13" FOREIGN KEY ("file_manager_id") REFERENCES "file_managers"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`ALTER TABLE "file_logs" DROP CONSTRAINT "FK_c7bcf14e27dcebcd11fc2f73c13"`);
        await queryRunner.query(`DROP TABLE "file_logs"`);
    }

}
