0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-03-11 02:23:09 -05:00
immich/server/src/migrations/1711257900274-RenameWebpJpegPaths.ts
Mert 8edc2fb46f
refactor(server): decouple generated images from image formats (#8246)
* rename

thumbnail config

update target paths, fix tests

rename to image settings

replace legacy enum

better typing

update sql

update api

remove config option

fix

* update docs

* update other thumbnail configs in migration

* keep legacy enum for now

* fix jumbled job names

* fix jumbled job names in tests

* rename thumbhash job

* rename dto

* fix tests

* preserve order

* remove unused import

* keep old fields in dto, marked deprecated

* update sql

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
2024-04-02 04:56:56 +00:00

51 lines
1.6 KiB
TypeScript

import { MigrationInterface, QueryRunner } from 'typeorm';
export class RenameWebpJpegPaths1711257900274 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.renameColumn('assets', 'webpPath', 'thumbnailPath');
await queryRunner.renameColumn('assets', 'resizePath', 'previewPath');
await queryRunner.query(`
UPDATE system_config
SET key = 'image.previewSize'
WHERE key = 'thumbnail.jpegSize'`);
await queryRunner.query(
`UPDATE system_config
SET key = 'image.thumbnailSize'
WHERE key = 'thumbnail.webpSize'`,
);
await queryRunner.query(
`UPDATE system_config
SET key = 'image.quality'
WHERE key = 'thumbnail.quality'`,
);
await queryRunner.query(
`UPDATE system_config
SET key = 'image.colorspace'
WHERE key = 'thumbnail.colorspace'`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.renameColumn('assets', 'thumbnailPath', 'webpPath');
await queryRunner.renameColumn('assets', 'previewPath', 'resizePath');
await queryRunner.query(`
UPDATE system_config
SET key = 'thumbnail.jpegSize'
WHERE key = 'image.previewSize'`);
await queryRunner.query(
`UPDATE system_config
SET key = 'thumbnail.webpSize'
WHERE key = 'image.thumbnailSize'`,
);
await queryRunner.query(
`UPDATE system_config
SET key = 'thumbnail.quality'
WHERE key = 'image.quality'`,
);
await queryRunner.query(
`UPDATE system_config
SET key = 'thumbnail.colorspace'
WHERE key = 'image.colorspace'`,
);
}
}