immich/server/src/migrations/1658860470248-AddExifImageNameAsSearchableText.ts
Jason Rasmussen 844f5a16a1
chore(server): remove unused column (#9431)
* chore(server): remove unused column

* fix: broken migrations
2024-05-13 16:40:16 -04:00

23 lines
1.1 KiB
TypeScript

import { MigrationInterface, QueryRunner } from 'typeorm';
export class AddExifImageNameAsSearchableText1658860470248 implements MigrationInterface {
name = 'AddExifImageNameAsSearchableText1658860470248';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "exif" DROP COLUMN "exifTextSearchableColumn"`);
await queryRunner.query(`ALTER TABLE "exif" ADD "exifTextSearchableColumn" tsvector GENERATED ALWAYS AS (TO_TSVECTOR('english',
COALESCE(make, '') || ' ' ||
COALESCE(model, '') || ' ' ||
COALESCE(orientation, '') || ' ' ||
COALESCE("lensModel", '') || ' ' ||
COALESCE("imageName", '') || ' ' ||
COALESCE("city", '') || ' ' ||
COALESCE("state", '') || ' ' ||
COALESCE("country", ''))) STORED`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "exif" ADD "exifTextSearchableColumn" tsvector NOT NULL`);
}
}