mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
* 🚧 lowercasing email * ✅ add tests for case insensitive email * 🐘 add migration to lowercase email * 🚚 rename migration * 🐛 fix package.lock * 🐛 fix double import * 📋 add todo
22 lines
630 B
TypeScript
22 lines
630 B
TypeScript
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
import config = require('../../../../config');
|
|
|
|
export class LowerCaseUserEmail1648740597343 implements MigrationInterface {
|
|
name = 'LowerCaseUserEmail1648740597343';
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
let tablePrefix = config.get('database.tablePrefix');
|
|
const schema = config.get('database.postgresdb.schema');
|
|
if (schema) {
|
|
tablePrefix = schema + '.' + tablePrefix;
|
|
}
|
|
|
|
await queryRunner.query(`
|
|
UPDATE ${tablePrefix}user
|
|
SET email = LOWER(email);
|
|
`);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {}
|
|
}
|