immich/server/src/migrations/1715623169039-RemoveTextSearchColumn.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

22 lines
979 B
TypeScript

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