fix: automatic media location migration without internal assets (#20489)

This commit is contained in:
Daniel Dietzler
2025-08-01 00:58:35 +02:00
committed by GitHub
parent c3263e50fc
commit 3cdc6844a1
4 changed files with 8 additions and 44 deletions

View File

@@ -1,6 +1,5 @@
import { Injectable } from '@nestjs/common';
import { Insertable, Kysely, NotNull, Selectable, UpdateResult, Updateable, sql } from 'kysely';
import { jsonArrayFrom } from 'kysely/helpers/postgres';
import { isEmpty, isUndefined, omitBy } from 'lodash';
import { InjectKysely } from 'nestjs-kysely';
import { Stack } from 'src/database';
@@ -338,20 +337,7 @@ export class AssetRepository {
@GenerateSql()
getFileSamples() {
return this.db
.selectFrom('asset')
.select((eb) => [
'asset.id',
'asset.originalPath',
'asset.sidecarPath',
'asset.encodedVideoPath',
jsonArrayFrom(eb.selectFrom('asset_file').select('path').whereRef('asset.id', '=', 'asset_file.assetId')).as(
'files',
),
])
.where('asset.libraryId', 'is', null)
.limit(sql.lit(3))
.execute();
return this.db.selectFrom('asset_file').select(['assetId', 'path']).limit(sql.lit(3)).execute();
}
@GenerateSql({ params: [DummyValue.UUID] })