import { MigrationInterface, QueryRunner } from "typeorm";

export class Migrations1733982737329 implements MigrationInterface {
    name = 'Migrations1733982737329'

    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`CREATE TABLE "brand_favorites" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "brandId" uuid, "influncerId" uuid, CONSTRAINT "PK_cfc30bb8535f6840c87661d529a" PRIMARY KEY ("id"))`);
        await queryRunner.query(`ALTER TABLE "brand_favorites" ADD CONSTRAINT "FK_0f996cee756fd27d0e84737bc06" FOREIGN KEY ("brandId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE "brand_favorites" ADD CONSTRAINT "FK_07538e142e190f54e993b610a02" FOREIGN KEY ("influncerId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
    }

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

}
