2022-09-06 02:45:38 +07:00
|
|
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
2022-08-31 21:27:17 +07:00
|
|
|
|
|
|
|
|
export class AddAssetChecksum1661881837496 implements MigrationInterface {
|
2022-10-23 16:54:54 -05:00
|
|
|
name = 'AddAssetChecksum1661881837496';
|
2022-08-31 21:27:17 +07:00
|
|
|
|
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
|
|
|
await queryRunner.query(`ALTER TABLE "assets" ADD "checksum" bytea`);
|
2022-10-23 16:54:54 -05:00
|
|
|
await queryRunner.query(
|
|
|
|
|
`CREATE INDEX "IDX_64c507300988dd1764f9a6530c" ON "assets" ("checksum") WHERE 'checksum' IS NOT NULL`,
|
|
|
|
|
);
|
2022-08-31 21:27:17 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
|
|
|
await queryRunner.query(`DROP INDEX "public"."IDX_64c507300988dd1764f9a6530c"`);
|
|
|
|
|
await queryRunner.query(`ALTER TABLE "assets" DROP COLUMN "checksum"`);
|
|
|
|
|
}
|
|
|
|
|
}
|