import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm';

export class AlterUserStreaksTable1730883924628 implements MigrationInterface {
  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.addColumns('user_streaks', [
      new TableColumn({
        name: 'streak_count',
        type: 'varchar',
        isNullable: true,
      }),
      new TableColumn({
        name: 'updated_at',
        type: 'timestamp',
        default: 'CURRENT_TIMESTAMP',
      }),
      new TableColumn({
        name: 'deleted_at',
        type: 'timestamp',
        isNullable: true,
      }),
    ]);
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.dropColumn('user_streaks', 'streak_count');
    await queryRunner.dropColumn('user_streaks', 'updated_at');
    await queryRunner.dropColumn('user_streaks', 'deleted_at');
  }
}
