import { MigrationInterface, QueryRunner } from "typeorm";

export class Migrations1749646303554 implements MigrationInterface {
    name = 'Migrations1749646303554'

    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`CREATE INDEX "idx_social_medias_user" ON "social_medias" ("users") WHERE "deleted_at" IS NULL`);
        await queryRunner.query(`CREATE INDEX "idx_users_engagement_ratio" ON "users" ("engagement_ratio") WHERE "deleted_at" IS NULL`);
        await queryRunner.query(`CREATE INDEX "idx_users_role_active_followers" ON "users" ("role", "is_active", "total_followers") WHERE "deleted_at" IS NULL`);
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`DROP INDEX "public"."idx_users_role_active_followers"`);
        await queryRunner.query(`DROP INDEX "public"."idx_users_engagement_ratio"`);
        await queryRunner.query(`DROP INDEX "public"."idx_social_medias_user"`);
    }

}
