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 user password (#30223)
This commit is contained in:
parent
56fbca910e
commit
9732bebb55
2 changed files with 15 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue