mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge pull request #2451 from gradido/consistent-user-contacts-table
fix(database): consistent deleted at bewteen users and user contacts
This commit is contained in:
commit
907cd03ab8
@ -10,7 +10,7 @@ Decimal.set({
|
||||
})
|
||||
|
||||
const constants = {
|
||||
DB_VERSION: '0054-recalculate_balance_and_decay',
|
||||
DB_VERSION: '0055-consistent_deleted_users',
|
||||
DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0
|
||||
LOG4JS_CONFIG: 'log4js-config.json',
|
||||
// default log level on production should be info
|
||||
|
||||
16
database/migrations/0055-consistent_deleted_users.ts
Normal file
16
database/migrations/0055-consistent_deleted_users.ts
Normal file
@ -0,0 +1,16 @@
|
||||
/* MIGRATION TO soft delete user contacts of soft deleted 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>>) {
|
||||
await queryFn(`
|
||||
UPDATE user_contacts LEFT JOIN users ON users.email_id = user_contacts.id
|
||||
SET user_contacts.deleted_at = users.deleted_at
|
||||
WHERE user_contacts.deleted_at IS NULL
|
||||
AND users.deleted_at IS NOT NULL;`)
|
||||
}
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
||||
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {}
|
||||
Loading…
x
Reference in New Issue
Block a user