mirror of
https://github.com/immich-app/immich.git
synced 2025-06-03 13:44:16 -04:00
* fix: remove config parameter from typeorm cli and update config the config parameter is no longer supported since version 0.3 the config now needs to export a DataSource object to work with the 0.3 cli * fix: update all typeorm entities and migrations to be aligned with database structure * Fixed test-util import databaseConfig * Fixed column mismatch in raw query with new migration * Remove dist build directory when starting dev server Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
|
|
export class DropExifTextSearchableColumns1656888918620 implements MigrationInterface {
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`ALTER TABLE "exif" DROP COLUMN "exif_text_searchable_column"`);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`
|
|
ALTER TABLE exif
|
|
DROP COLUMN IF EXISTS exif_text_searchable_column;
|
|
|
|
ALTER TABLE exif
|
|
ADD COLUMN IF NOT EXISTS exif_text_searchable_column tsvector
|
|
GENERATED ALWAYS AS (
|
|
TO_TSVECTOR('english',
|
|
COALESCE(make, '') || ' ' ||
|
|
COALESCE(model, '') || ' ' ||
|
|
COALESCE(orientation, '') || ' ' ||
|
|
COALESCE("lensModel", '') || ' ' ||
|
|
COALESCE("city", '') || ' ' ||
|
|
COALESCE("state", '') || ' ' ||
|
|
COALESCE("country", '')
|
|
)
|
|
) STORED;
|
|
|
|
CREATE INDEX exif_text_searchable_idx
|
|
ON exif
|
|
USING GIN (exif_text_searchable_column);
|
|
`);
|
|
}
|
|
|
|
}
|