import { MigrationInterface, QueryRunner } from 'typeorm';

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

  async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query('ALTER TABLE "messages" ADD COLUMN "revision" integer NOT NULL DEFAULT 0');
    await queryRunner.query('ALTER TABLE "messages" ADD COLUMN "headHash" text');
  }

  async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query('ALTER TABLE "messages" DROP COLUMN "headHash"');
    await queryRunner.query('ALTER TABLE "messages" DROP COLUMN "revision"');
  }
}
