import { MigrationInterface, QueryRunner } from "typeorm";

export class Migrations1741153965329 implements MigrationInterface {
    name = 'Migrations1741153965329'

    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`CREATE TABLE "bank_details" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "holder_name" character varying(255) NOT NULL, "account_number" character varying(255) NOT NULL, "qr_code" character varying(255) NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "influencer_id" uuid, CONSTRAINT "REL_1d24cefafa1f684894ac0314e3" UNIQUE ("influencer_id"), CONSTRAINT "PK_ddbbcb9586b7f4d6124fe58f257" PRIMARY KEY ("id"))`);
        await queryRunner.query(`ALTER TABLE "bank_details" ADD CONSTRAINT "FK_1d24cefafa1f684894ac0314e34" FOREIGN KEY ("influencer_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
    }

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

}
