mirror of
https://github.com/immich-app/immich
synced 2026-08-15 13:03:57 +00:00
fix(server): store null instead of empty string for person thumbnailPath
This commit is contained in:
parent
d7f46ccee3
commit
71a9070f4a
4 changed files with 17 additions and 4 deletions
|
|
@ -251,7 +251,7 @@ export type Person = {
|
|||
color: string | null;
|
||||
faceAssetId: string | null;
|
||||
isHidden: boolean;
|
||||
thumbnailPath: string;
|
||||
thumbnailPath: string | null;
|
||||
};
|
||||
|
||||
export type AssetFace = {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ export const PersonResponseSchema = z
|
|||
name: z.string().describe('Person name'),
|
||||
// TODO: use `isoDateToDate` when using `ZodSerializerDto` on the controllers.
|
||||
birthDate: z.string().meta({ format: 'date' }).describe('Person date of birth').nullable(),
|
||||
thumbnailPath: z.string().describe('Thumbnail path'),
|
||||
thumbnailPath: z.string().nullable().describe('Thumbnail path'),
|
||||
isHidden: z.boolean().describe('Is hidden'),
|
||||
// TODO: use `isoDatetimeToDate` when using `ZodSerializerDto` on the controllers.
|
||||
updatedAt: z
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
import { Kysely, sql } from 'kysely';
|
||||
|
||||
export async function up(db: Kysely<any>): Promise<void> {
|
||||
await sql`ALTER TABLE "person" ALTER COLUMN "thumbnailPath" DROP NOT NULL;`.execute(db);
|
||||
await sql`ALTER TABLE "person" ALTER COLUMN "thumbnailPath" SET DEFAULT NULL;`.execute(db);
|
||||
await sql`UPDATE "person" SET "thumbnailPath" = NULL WHERE "thumbnailPath" = '';`.execute(db);
|
||||
}
|
||||
|
||||
export async function down(): Promise<void> {
|
||||
await sql`UPDATE "person" SET "thumbnailPath" = '' WHERE "thumbnailPath" IS NULL;`.execute(db);
|
||||
await sql`ALTER TABLE "person" ALTER COLUMN "thumbnailPath" SET DEFAULT '';`.execute(db);
|
||||
await sql`ALTER TABLE "person" ALTER COLUMN "thumbnailPath" SET NOT NULL;`.execute(db);
|
||||
}
|
||||
|
|
@ -46,8 +46,8 @@ export class PersonTable {
|
|||
@Column({ default: '' })
|
||||
name!: Generated<string>;
|
||||
|
||||
@Column({ default: '' })
|
||||
thumbnailPath!: Generated<string>;
|
||||
@Column({ nullable: true, default: null })
|
||||
thumbnailPath!: string | null;
|
||||
|
||||
@Column({ type: 'boolean', default: false })
|
||||
isHidden!: Generated<boolean>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue