import * as bcrypt from 'bcrypt';
import { MigrationInterface, QueryRunner } from 'typeorm';

export class CreateAdmin1751357195319 implements MigrationInterface {
  public async up(queryRunner: QueryRunner): Promise<void> {
    const hash = await bcrypt.hash('Admin@123', 10);

    await queryRunner.query(`
        INSERT INTO users (email, username, first_name, last_name, password)
        VALUES (
            'admin@example.com',
            'admin',
            'Admin',
            'User',
            '${hash}' -- bcrypt hashed
        )
    `);
  }

  public async down(queryRunner: QueryRunner): Promise<void> {}
}
