gradido/database/migrations/0025-emails_to_lower.ts
2022-02-28 11:49:06 +01:00

18 lines
645 B
TypeScript

/* 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`);')
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
// This migration cannot be revered
}