migration to convert all emails to lowercase

This commit is contained in:
Ulf Gebhardt 2022-02-28 01:57:21 +01:00
parent a837fd5f60
commit 7af33a5c9f
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9

View File

@ -0,0 +1,16 @@
/* MIGRATION TO MAKE ALL EMAILS LOWERCASE
*
* Make all `email` values in `users` lowercase.
* This allows safe queries without any modificators
*/
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/* eslint-disable @typescript-eslint/no-explicit-any */
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
await queryFn('UPDATE `users` SET `email` = LOWER(`email`);')
}
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
// This migration cannot be revered
}