import { MigrationInterface, QueryRunner } from 'typeorm';

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

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`CREATE TABLE \`announcements\` (
            \`id\` INT(11) NOT NULL AUTO_INCREMENT,
            \`content\` TEXT NOT NULL,
            \`section\` ENUM('home', 'shop', 'service', 'oil_government', 'rahvar') NULL DEFAULT NULL,
            \`link\` TEXT NULL,
            \`startDate\` DATETIME NULL,
            \`endDate\` DATETIME NULL,
            \`displayOrder\` INT(11) NOT NULL DEFAULT '1',
            \`isPublished\` TINYINT(1) NOT NULL DEFAULT '1',
            \`createdAt\` DATETIME NOT NULL,
            \`updatedAt\` DATETIME NULL,
            PRIMARY KEY (\`id\`)
        )
        ENGINE = InnoDB
        DEFAULT CHARACTER SET = utf8;`);
  }

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