import { MigrationInterface, QueryRunner } from 'typeorm';

export class AddProfileAvatarMetadata1000000000006 implements MigrationInterface {
  name = 'AddProfileAvatarMetadata1000000000006';

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`ALTER TABLE "users" ADD COLUMN "avatarHash" TEXT`);
    await queryRunner.query(`ALTER TABLE "users" ADD COLUMN "avatarMime" TEXT`);
    await queryRunner.query(`ALTER TABLE "users" ADD COLUMN "avatarUpdatedAt" INTEGER`);
    await queryRunner.query(`ALTER TABLE "room_members" ADD COLUMN "avatarHash" TEXT`);
    await queryRunner.query(`ALTER TABLE "room_members" ADD COLUMN "avatarMime" TEXT`);
    await queryRunner.query(`ALTER TABLE "room_members" ADD COLUMN "avatarUpdatedAt" INTEGER`);
  }

  public async down(): Promise<void> {
    // SQLite column removal requires table rebuilds. Keep rollback no-op.
  }
}
