mirror of
https://github.com/immich-app/immich.git
synced 2026-07-30 23:50:36 -07:00
fix(server): store null instead of empty string for user password (#30223)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user