From f3f35197c95bb443601813abdcf54d013363557a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 17:41:39 -0700 Subject: [PATCH] chore(release): Test v7.50.8 (#10334) Signed-off-by: Matt Krick Signed-off-by: dependabot[bot] Co-authored-by: Georg Bremer Co-authored-by: Nick O'Ferrall Co-authored-by: parabol-release-bot[bot] <150284312+parabol-release-bot[bot]@users.noreply.github.com> Co-authored-by: Matt Krick Co-authored-by: Rafael Romero Co-authored-by: Rafa <101704572+rafaelromcar-parabol@users.noreply.github.com> Co-authored-by: Jordan Husney Co-authored-by: Bruce Tian Co-authored-by: Terry Acker Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: snyk-bot Co-authored-by: GitHub Action Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Dale Bumblis <135627447+dbumblis-parabol@users.noreply.github.com> Co-authored-by: github-actions --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 + package.json | 2 +- packages/chronos/package.json | 4 +- packages/client/package.json | 2 +- packages/embedder/package.json | 2 +- packages/gql-executor/package.json | 6 +- packages/integration-tests/package.json | 2 +- packages/server/package.json | 4 +- .../1728496970486_TeamInvitation-phase2.ts | 134 ++++++++++++++++++ 10 files changed, 153 insertions(+), 12 deletions(-) create mode 100644 packages/server/postgres/migrations/1728496970486_TeamInvitation-phase2.ts diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a4bad28fe0d..7568c2e9275 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "7.50.7" + ".": "7.50.8" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d14d34f5b6..818f6408ed9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ This project adheres to [Semantic Versioning](http://semver.org/). This CHANGELOG follows conventions [outlined here](http://keepachangelog.com/). +## [7.50.8](https://github.com/ParabolInc/parabol/compare/v7.50.7...v7.50.8) (2024-10-10) + + +### Changed + +* **rethinkdb:** TeamInvitation: Phase 2 ([#10326](https://github.com/ParabolInc/parabol/issues/10326)) ([f8486ba](https://github.com/ParabolInc/parabol/commit/f8486bae6feeeb7a69088a864e8277c53d052061)) + ## [7.50.7](https://github.com/ParabolInc/parabol/compare/v7.50.6...v7.50.7) (2024-10-10) diff --git a/package.json b/package.json index 8571d7491ae..b2743425d01 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "An open-source app for building smarter, more agile teams.", "author": "Parabol Inc. (http://github.com/ParabolInc)", "license": "AGPL-3.0", - "version": "7.50.7", + "version": "7.50.8", "repository": { "type": "git", "url": "https://github.com/ParabolInc/parabol" diff --git a/packages/chronos/package.json b/packages/chronos/package.json index 01a3e27b0db..77138df621c 100644 --- a/packages/chronos/package.json +++ b/packages/chronos/package.json @@ -1,6 +1,6 @@ { "name": "chronos", - "version": "7.50.7", + "version": "7.50.8", "description": "A cron job scheduler", "author": "Matt Krick ", "homepage": "https://github.com/ParabolInc/parabol/tree/master/packages/chronos#readme", @@ -25,6 +25,6 @@ }, "dependencies": { "cron": "^2.3.1", - "parabol-server": "7.50.7" + "parabol-server": "7.50.8" } } diff --git a/packages/client/package.json b/packages/client/package.json index 413b2d7217a..0022e0094f6 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -3,7 +3,7 @@ "description": "An open-source app for building smarter, more agile teams.", "author": "Parabol Inc. (http://github.com/ParabolInc)", "license": "AGPL-3.0", - "version": "7.50.7", + "version": "7.50.8", "repository": { "type": "git", "url": "https://github.com/ParabolInc/parabol" diff --git a/packages/embedder/package.json b/packages/embedder/package.json index 6be11f0574c..4eec50e308b 100644 --- a/packages/embedder/package.json +++ b/packages/embedder/package.json @@ -1,6 +1,6 @@ { "name": "parabol-embedder", - "version": "7.50.7", + "version": "7.50.8", "description": "A service that computes embedding vectors from Parabol objects", "author": "Jordan Husney ", "homepage": "https://github.com/ParabolInc/parabol/tree/master/packages/embedder#readme", diff --git a/packages/gql-executor/package.json b/packages/gql-executor/package.json index 8324ce6fc1a..1caf2edbeda 100644 --- a/packages/gql-executor/package.json +++ b/packages/gql-executor/package.json @@ -1,6 +1,6 @@ { "name": "gql-executor", - "version": "7.50.7", + "version": "7.50.8", "description": "A Stateless GraphQL Executor", "author": "Matt Krick ", "homepage": "https://github.com/ParabolInc/parabol/tree/master/packages/gqlExecutor#readme", @@ -26,8 +26,8 @@ }, "dependencies": { "dd-trace": "^4.2.0", - "parabol-client": "7.50.7", - "parabol-server": "7.50.7", + "parabol-client": "7.50.8", + "parabol-server": "7.50.8", "undici": "^5.26.2" } } diff --git a/packages/integration-tests/package.json b/packages/integration-tests/package.json index c38c25f69f1..e35f9ef7062 100644 --- a/packages/integration-tests/package.json +++ b/packages/integration-tests/package.json @@ -2,7 +2,7 @@ "name": "integration-tests", "author": "Parabol Inc. (http://github.com/ParabolInc)", "license": "AGPL-3.0", - "version": "7.50.7", + "version": "7.50.8", "description": "", "main": "index.js", "scripts": { diff --git a/packages/server/package.json b/packages/server/package.json index 93f878bdff9..2e677fa2099 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -3,7 +3,7 @@ "description": "An open-source app for building smarter, more agile teams.", "author": "Parabol Inc. (http://github.com/ParabolInc)", "license": "AGPL-3.0", - "version": "7.50.7", + "version": "7.50.8", "repository": { "type": "git", "url": "https://github.com/ParabolInc/parabol" @@ -122,7 +122,7 @@ "oauth-1.0a": "^2.2.6", "openai": "^4.53.0", "oy-vey": "^0.12.1", - "parabol-client": "7.50.7", + "parabol-client": "7.50.8", "pg": "^8.5.1", "react": "^17.0.2", "react-dom": "^17.0.2", diff --git a/packages/server/postgres/migrations/1728496970486_TeamInvitation-phase2.ts b/packages/server/postgres/migrations/1728496970486_TeamInvitation-phase2.ts new file mode 100644 index 00000000000..54271a6721e --- /dev/null +++ b/packages/server/postgres/migrations/1728496970486_TeamInvitation-phase2.ts @@ -0,0 +1,134 @@ +import {Kysely, PostgresDialect, sql} from 'kysely' +import {r} from 'rethinkdb-ts' +import connectRethinkDB from '../../database/connectRethinkDB' +import getPg from '../getPg' + +export async function up() { + await connectRethinkDB() + const pg = new Kysely({ + dialect: new PostgresDialect({ + pool: getPg() + }) + }) + + try { + console.log('Adding index') + await r + .table('TeamInvitation') + .indexCreate('updatedAtId', (row: any) => [row('expiresAt'), row('id')]) + .run() + await r.table('TeamInvitation').indexWait().run() + } catch { + // index already exists + } + + console.log('Adding index complete') + + const MAX_PG_PARAMS = 65545 + const PG_COLS = [ + 'id', + 'acceptedAt', + 'acceptedBy', + 'createdAt', + 'expiresAt', + 'email', + 'invitedBy', + 'isMassInvite', + 'meetingId', + 'teamId', + 'token' + ] as const + type TeamInvitation = { + [K in (typeof PG_COLS)[number]]: any + } + const BATCH_SIZE = Math.trunc(MAX_PG_PARAMS / PG_COLS.length) + + let curUpdatedAt = new Date() + let curId = r.minval + + const insertRow = async (row) => { + try { + await pg + .insertInto('TeamInvitation') + .values(row) + .onConflict((oc) => oc.doNothing()) + .execute() + } catch (e) { + if (e.constraint === 'fk_teamId') { + console.log('TeamInvitation has no team, skipping insert', row.id) + return + } + if (e.constraint === 'fk_meetingId') { + console.log('TeamInvitation has no meeting, skipping insert', row.id) + return + } + if (e.constraint === 'fk_acceptedBy') { + console.log('TeamInvitation has no acceptedBy user, skipping insert', row.id) + return + } + if (e.constraint === 'fk_invitedBy') { + console.log('TeamInvitation has no invitedBy user, skipping insert', row.id) + return + } + throw e + } + } + for (let i = 0; i < 1e6; i++) { + console.log('inserting row', i * BATCH_SIZE, String(curUpdatedAt), String(curId)) + const rawRowsToInsert = (await r + .table('TeamInvitation') + .between([curUpdatedAt, curId], [r.maxval, r.maxval], { + index: 'updatedAtId', + leftBound: 'open', + rightBound: 'closed' + }) + .orderBy({index: 'updatedAtId'}) + .limit(BATCH_SIZE) + .pluck(...PG_COLS) + .run()) as TeamInvitation[] + + const rowsToInsert = rawRowsToInsert.map((row) => { + const { + id, + acceptedAt, + acceptedBy, + createdAt, + expiresAt, + email, + invitedBy, + isMassInvite, + meetingId, + teamId, + token + } = row as any + return { + id, + acceptedAt, + acceptedBy, + createdAt, + expiresAt, + email, + invitedBy, + isMassInvite, + meetingId, + teamId, + token + } + }) + + if (rowsToInsert.length === 0) break + const lastRow = rowsToInsert[rowsToInsert.length - 1] + curUpdatedAt = lastRow.expiresAt + curId = lastRow.id + await Promise.all(rowsToInsert.map(async (row) => insertRow(row))) + } +} + +export async function down() { + const pg = new Kysely({ + dialect: new PostgresDialect({ + pool: getPg() + }) + }) + await sql`TRUNCATE TABLE "TeamInvitation" CASCADE`.execute(pg) +}