import { MigrationInterface, QueryRunner } from "typeorm";

export class UpdateComment1744127820030 implements MigrationInterface {
    name = 'UpdateComment1744127820030'

    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`ALTER TABLE \`comments\` ADD \`is_seen\` tinyint NOT NULL DEFAULT 0`);
        await queryRunner.query(`ALTER TABLE \`comments\` ADD \`seen_at\` timestamp NULL`);
        await queryRunner.query(`ALTER TABLE \`comments\` ADD \`edited\` tinyint NOT NULL DEFAULT 0`);
        await queryRunner.query(`ALTER TABLE \`comments\` ADD \`edited_at\` timestamp NULL`);
        await queryRunner.query(`ALTER TABLE \`comments\` ADD \`deleted\` tinyint NOT NULL DEFAULT 0`);
        await queryRunner.query(`ALTER TABLE \`comments\` ADD \`deleted_at\` timestamp NULL`);
        await queryRunner.query(`ALTER TABLE \`comments\` ADD \`reply_to_id\` int NULL`);
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`ALTER TABLE \`comments\` DROP COLUMN \`reply_to_id\``);
        await queryRunner.query(`ALTER TABLE \`comments\` DROP COLUMN \`deleted_at\``);
        await queryRunner.query(`ALTER TABLE \`comments\` DROP COLUMN \`deleted\``);
        await queryRunner.query(`ALTER TABLE \`comments\` DROP COLUMN \`edited_at\``);
        await queryRunner.query(`ALTER TABLE \`comments\` DROP COLUMN \`edited\``);
        await queryRunner.query(`ALTER TABLE \`comments\` DROP COLUMN \`seen_at\``);
        await queryRunner.query(`ALTER TABLE \`comments\` DROP COLUMN \`is_seen\``);
    }

}
