High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(server): store null instead of empty string for user password (#30223)
Devesh Kolte9732bebb55ad
diff --git a/server/src/schema/migrations/1784986754473-ConvertUserPasswordEmptyStringToNull.ts b/server/src/schema/migrations/1784986754473-ConvertUserPasswordEmptyStringToNull.tsnew file mode 100644index 0000000000..82f742c90a--- /dev/null+++ b/server/src/schema/migrations/1784986754473-ConvertUserPasswordEmptyStringToNull.ts@@ -0,0 +1,13 @@+import { Kysely, sql } from 'kysely';++export async function up(db: Kysely<any>): Promise<void> {+ await sql`ALTER TABLE "user" ALTER COLUMN "password" DROP NOT NULL;`.execute(db);+ await sql`ALTER TABLE "user" ALTER COLUMN "password" SET DEFAULT NULL;`.execute(db);+ await sql`UPDATE "user" SET "password" = NULL WHERE "password" = '';`.execute(db);+}++export async function down(db: Kysely<any>): Promise<void> {+ await sql`UPDATE "user" SET "password" = '' WHERE "password" IS NULL;`.execute(db);+ await sql`ALTER TABLE "user" ALTER COLUMN "password" SET DEFAULT '';`.execute(db);+ await sql`ALTER TABLE "user" ALTER COLUMN "password" SET NOT NULL;`.execute(db);+}diff --git a/server/src/schema/tables/user.table.ts b/server/src/schema/tables/user.table.tsindex 0839924d2a..50d56d9067 100644--- a/server/src/schema/tables/user.table.ts+++ b/server/src/schema/tables/user.table.ts@@ -31,8 +31,8 @@ export class UserTable {@Column({ unique: true })email!: string;- @Column({ default: '' })- password!: Generated<string>;+ @Column({ nullable: true, default: null })+ password!: string | null;@Column({ nullable: true })pinCode!: string | null;