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

52 lines
1.6 KiB
TypeScript
Raw Normal View History

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'`,
);
}
}