mirror of
https://github.com/immich-app/immich.git
synced 2026-01-18 15:55:56 -08:00
* chore(server): save original file name with extension * extract extension * update e2e test * update e2e test * download archive * fix download archive appending name * pr feedback * remove unused code * test * unit test * remove unused code * migration * noops * pr feedback * Update server/src/domain/download/download.service.ts Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com> --------- Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com>
21 lines
691 B
TypeScript
21 lines
691 B
TypeScript
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
|
|
export class AddExtensionToOriginalFileName1709763765506 implements MigrationInterface {
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`
|
|
WITH extension AS (WITH cte AS (SELECT a.id, STRING_TO_ARRAY(a."originalPath", '.')::TEXT[] AS arr
|
|
FROM assets a)
|
|
SELECT cte.id, cte.arr[ARRAY_UPPER(cte.arr, 1)] AS "ext"
|
|
FROM cte)
|
|
UPDATE assets
|
|
SET "originalFileName" = assets."originalFileName" || '.' || extension."ext"
|
|
FROM extension
|
|
INNER JOIN assets a ON a.id = extension.id;
|
|
`);
|
|
}
|
|
|
|
public async down(): Promise<void> {
|
|
// noop
|
|
}
|
|
}
|