From d3029cd2cc24beec8d385f680e335f073f037f2c Mon Sep 17 00:00:00 2001 From: Nick O'Ferrall Date: Thu, 30 May 2024 16:42:35 +0100 Subject: [PATCH 1/2] fix: clear kudos received notifications --- .../1717083323369_removeKudosNotifications.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 packages/server/postgres/migrations/1717083323369_removeKudosNotifications.ts diff --git a/packages/server/postgres/migrations/1717083323369_removeKudosNotifications.ts b/packages/server/postgres/migrations/1717083323369_removeKudosNotifications.ts new file mode 100644 index 00000000000..545e49efc85 --- /dev/null +++ b/packages/server/postgres/migrations/1717083323369_removeKudosNotifications.ts @@ -0,0 +1,16 @@ +import {Kysely, PostgresDialect} from 'kysely' +import getPg from '../getPg' + +export async function up() { + const pg = new Kysely({ + dialect: new PostgresDialect({ + pool: getPg() + }) + }) + + await pg.deleteFrom('Notification').where('type', '=', 'KUDOS_RECEIVED').execute() +} + +export async function down() { + // noop +} From 78837ce1b8c660ecae124122097dd3a73953532b Mon Sep 17 00:00:00 2001 From: Nick O'Ferrall Date: Thu, 30 May 2024 16:54:43 +0100 Subject: [PATCH 2/2] remove from rethink --- .../1717083323369_removeKudosNotifications.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/server/postgres/migrations/1717083323369_removeKudosNotifications.ts b/packages/server/postgres/migrations/1717083323369_removeKudosNotifications.ts index 545e49efc85..2607568be0b 100644 --- a/packages/server/postgres/migrations/1717083323369_removeKudosNotifications.ts +++ b/packages/server/postgres/migrations/1717083323369_removeKudosNotifications.ts @@ -1,14 +1,14 @@ -import {Kysely, PostgresDialect} from 'kysely' -import getPg from '../getPg' +import {r} from 'rethinkdb-ts' +import connectRethinkDB from '../../database/connectRethinkDB' export async function up() { - const pg = new Kysely({ - dialect: new PostgresDialect({ - pool: getPg() - }) - }) - - await pg.deleteFrom('Notification').where('type', '=', 'KUDOS_RECEIVED').execute() + try { + await connectRethinkDB() + await r.table('Notification').filter(r.row('type').eq('KUDOS_RECEIVED')).delete().run() + await r.getPoolMaster()?.drain() + } catch (e) { + console.log(e) + } } export async function down() {