Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add teamId index on VerificationToken #12339

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

ThyMinimalDev
Copy link
Contributor

@ThyMinimalDev ThyMinimalDev commented Nov 13, 2023

What does this PR do?

Fixes # CAL-2696

Add missing index TeamId on VerificationToken

Requirement/Documentation

  • If there is a requirement document, please, share it here.
  • If there is ab UI/UX design document, please, share it here.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How should this be tested?

  • Are there environment variables that should be set?
  • What are the minimal test data to have?
  • What is expected (happy path) to have (input and output)?
  • Any other important info that could help to test that PR

Mandatory Tasks

  • Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.

Checklist

  • I haven't added tests that prove my fix is effective or that my feature works
  • I haven't checked if new and existing unit tests pass locally with my changes

Copy link

linear bot commented Nov 13, 2023

CAL-2696 Index missing on InvitationToken table (TeamId)

Fetching a TeamById triggers a number of Select queries on multiple tables in the database, including on InvitationToken where we don't have an index on TeamId, making this query extremely intense for the database.

  • SQL: SELECT "public"."VerificationToken"."id", "public"."VerificationToken"."token", "public"."VerificationToken"."expires", "public"."VerificationToken"."expiresInDays", "public"."VerificationToken"."identifier", "public"."VerificationToken"."teamId" FROM "public"."VerificationToken" WHERE "public"."VerificationToken"."teamId" IN ($1) OFFSET $2

  • trpc call in the frontend:

const teamQuery = trpc.viewer.teams.get.useQuery(
{ teamId },
{ enabled: session.status === "authenticated" }
);

Copy link

vercel bot commented Nov 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ai ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 13, 2023 1:35pm
api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 13, 2023 1:35pm
dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 13, 2023 1:35pm
4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Nov 13, 2023 1:35pm
cal-demo ⬜️ Ignored (Inspect) Nov 13, 2023 1:35pm
qa ⬜️ Ignored (Inspect) Nov 13, 2023 1:35pm
ui ⬜️ Ignored (Inspect) Visit Preview Nov 13, 2023 1:35pm

Copy link
Contributor

github-actions bot commented Nov 13, 2023

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link to collect XP and win prizes!

@zomars zomars added admin core area: core, team members only devops labels Nov 13, 2023
@ThyMinimalDev ThyMinimalDev changed the title fix: add teamId index on InvitationToken fix: add teamId index on VerificationToken Nov 13, 2023
@ThyMinimalDev ThyMinimalDev marked this pull request as ready for review November 13, 2023 13:17
keithwillcode
keithwillcode previously approved these changes Nov 13, 2023
Copy link
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending migrations.

@keithwillcode
Copy link
Contributor

Pending migrations.

Oh duh, good call. Sorry for the approval.

@github-actions github-actions bot added the ❗️ migrations contains migration files label Nov 13, 2023
@ThyMinimalDev
Copy link
Contributor Author

done

Copy link
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@emrysal emrysal enabled auto-merge (squash) November 13, 2023 13:20
Copy link

deploysentinel bot commented Nov 13, 2023

Current Playwright Test Results Summary

✅ 313 Passing - ⚠️ 7 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 11/13/2023 01:40:16pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: a0d0738

Started: 11/13/2023 01:29:17pm UTC

⚠️ Flakes

📄   apps/web/playwright/login.2fa.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
2FA Tests should allow a user to enable 2FA and login using 2FA
Retry 1Initial Attempt
0.38% (1) 1 / 260 run
failed over last 7 days
31.54% (82) 82 / 260 runs
flaked over last 7 days

📄   apps/web/playwright/booking/multipleEmailQuestion.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking With Multiple Email Question and Each Other Question Booking With Multiple Email Question and Long text Question Multiple Email and Long text not required
Retry 1Initial Attempt
0% (0) 0 / 249 runs
failed over last 7 days
1.61% (4) 4 / 249 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 2 Flakes

Top 1 Common Error Messages

null

2 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Popup Tests should open embed iframe on click - Configured with light theme
Retry 1Initial Attempt
1.09% (3) 3 / 274 runs
failed over last 7 days
55.47% (152) 152 / 274 runs
flaked over last 7 days
Popup Tests should be able to reschedule
Retry 2Retry 1Initial Attempt
17.22% (47) 47 / 273 runs
failed over last 7 days
76.56% (209) 209 / 273 runs
flaked over last 7 days

📄   apps/web/playwright/insights.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Insights should test download button
Retry 1Initial Attempt
0% (0) 0 / 261 runs
failed over last 7 days
11.11% (29) 29 / 261 runs
flaked over last 7 days

📄   apps/web/playwright/teams.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Teams - NonOrg Non admin team members cannot create team in org
Retry 1Initial Attempt
0% (0) 0 / 265 runs
failed over last 7 days
35.09% (93) 93 / 265 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/inline.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Inline Iframe Inline Iframe - Configured with Dark Theme
Retry 1Initial Attempt
0.75% (2) 2 / 265 runs
failed over last 7 days
37.74% (100) 100 / 265 runs
flaked over last 7 days

View Detailed Build Results


Copy link
Contributor

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@emrysal emrysal merged commit 199f41f into main Nov 13, 2023
36 of 37 checks passed
@emrysal emrysal deleted the cal-2696-index-missing-on-invitationtoken-table-teamid branch November 13, 2023 13:42
hbjORbj pushed a commit to codemod-com/cal.com-demo that referenced this pull request Nov 28, 2023
* fix: add teamId index on InvitationToken

* fix: add migration
hbjORbj pushed a commit to codemod-com/cal.com-demo that referenced this pull request Dec 21, 2023
* fix: add teamId index on InvitationToken

* fix: add migration
zomars pushed a commit that referenced this pull request Jan 29, 2024
* fix: add teamId index on InvitationToken

* fix: add migration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
admin core area: core, team members only devops ❗️ migrations contains migration files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants