1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-04 02:46:47 +01:00

fix(server): unique email database constraint (#1082)

This commit is contained in:
Jason Rasmussen 2022-12-09 22:16:25 -05:00 committed by GitHub
parent e6904ca884
commit 242165485d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -15,7 +15,7 @@ export class UserEntity {
@Column({ default: false })
isAdmin!: boolean;
@Column()
@Column({ unique: true })
email!: string;
@Column({ default: '', select: false })

View file

@ -0,0 +1,14 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddUserEmailUniqueConstraint1670633210032 implements MigrationInterface {
name = 'AddUserEmailUniqueConstraint1670633210032'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "users" ADD CONSTRAINT "UQ_97672ac88f789774dd47f7c8be3" UNIQUE ("email")`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "users" DROP CONSTRAINT "UQ_97672ac88f789774dd47f7c8be3"`);
}
}