fix(core): Make email for UM case insensitive (#3078)

* 🚧 lowercasing email

*  add tests for case insensitive email

* 🐘 add migration to lowercase email

* 🚚 rename migration

* 🐛 fix package.lock

* 🐛 fix double import

* 📋 add todo
This commit is contained in:
Ben Hesseldieck
2022-04-15 08:11:35 +02:00
committed by GitHub
parent d3fecb9f6d
commit 8532b0030d
15 changed files with 197 additions and 74 deletions

View File

@@ -0,0 +1,17 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import config = require('../../../../config');
export class LowerCaseUserEmail1648740597343 implements MigrationInterface {
name = 'LowerCaseUserEmail1648740597343';
public async up(queryRunner: QueryRunner): Promise<void> {
const tablePrefix = config.get('database.tablePrefix');
await queryRunner.query(`
UPDATE ${tablePrefix}user
SET email = LOWER(email);
`);
}
public async down(queryRunner: QueryRunner): Promise<void> {}
}