mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
22 lines
862 B
TypeScript
22 lines
862 B
TypeScript
/* MIGRATION TO CLEAN PRODUCTION DATA
|
|
*
|
|
* cleanup the login_user_backups.
|
|
* Delete data with no reference in login_users table and
|
|
* delete the right one of the duplicate keys
|
|
*/
|
|
|
|
/* 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>>) {
|
|
// Delete data with no reference in login_users table
|
|
await queryFn(`DELETE FROM login_user_backups WHERE user_id NOT IN (SELECT id FROM login_users)`)
|
|
|
|
// Delete duplicates which have changed for some reasons
|
|
await queryFn(`DELETE FROM login_user_backups WHERE id IN (21, 103, 313, 325, 726, 750, 1098)`)
|
|
}
|
|
|
|
export async function downgrade(/* queryFn: (query: string, values?: any[]) => Promise<Array<any>> */) {
|
|
// cannot undelete things
|
|
}
|