mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
27 lines
940 B
TypeScript
27 lines
940 B
TypeScript
/* MIGRATION TO CLEAN PRODUCTION DATA
|
|
*
|
|
* some entries in the state_users table do not have an email.
|
|
* this is required tho to work with the new environment.
|
|
* to mitigate 38 out of 50 emails could be restored from
|
|
* login_users.
|
|
*/
|
|
|
|
/* 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>>) {
|
|
// Fill in missing emails from login_users
|
|
await queryFn(
|
|
`UPDATE state_users
|
|
INNER JOIN login_users ON state_users.public_key = login_users.pubkey
|
|
SET state_users.email = login_users.email
|
|
WHERE state_users.email = '';`,
|
|
)
|
|
// Delete remaining ones
|
|
await queryFn(`DELETE FROM state_users WHERE email = ''`)
|
|
}
|
|
|
|
export async function downgrade(/* queryFn: (query: string, values?: any[]) => Promise<Array<any>> */) {
|
|
// cannot undelete things
|
|
}
|