mirror of
https://github.com/immich-app/immich.git
synced 2025-01-06 03:46:47 +01:00
fix(server): unique email database constraint (#1082)
This commit is contained in:
parent
e6904ca884
commit
242165485d
2 changed files with 15 additions and 1 deletions
|
@ -15,7 +15,7 @@ export class UserEntity {
|
||||||
@Column({ default: false })
|
@Column({ default: false })
|
||||||
isAdmin!: boolean;
|
isAdmin!: boolean;
|
||||||
|
|
||||||
@Column()
|
@Column({ unique: true })
|
||||||
email!: string;
|
email!: string;
|
||||||
|
|
||||||
@Column({ default: '', select: false })
|
@Column({ default: '', select: false })
|
||||||
|
|
|
@ -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"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue