fix(server): store null instead of empty string for person thumbnailPath

This commit is contained in:
Devesh Kolte 2026-07-20 19:04:42 +05:30
parent d7f46ccee3
commit 71a9070f4a
4 changed files with 17 additions and 4 deletions

View file

@ -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);
}