-
Notifications
You must be signed in to change notification settings - Fork 3
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
chore: update packages + migrate to prisma 5 #145
Conversation
TECH-47 Migrate to Prisma V5
There's a new major version of Prisma and there's performance improvements based on the change logs |
❌ Deploy Preview for profound-kringle-30b3e4 failed.
|
Co-authored-by: Krish <[email protected]>
This reverts commit 016efee.
WalkthroughThe changes primarily involve minor syntax adjustments, such as adding trailing commas and fixing minor typos. There are also significant changes to the Prisma schema file, including a change in the database provider and modifications to several models. Additionally, there are updates to the Node.js version in the GitHub Actions workflow and changes to the logic in some React components. Changes
Poem
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to filter (2)
- package-lock.json
- package.json
Files selected for processing (26)
- .github/workflows/PR-CI.yaml (1 hunks)
- prisma/schema.prisma (3 hunks)
- src/components/Applicant.tsx (2 hunks)
- src/components/QrScanner.tsx (1 hunks)
- src/components/QrScanner2.tsx (1 hunks)
- src/components/RBACWrapper.tsx (2 hunks)
- src/env/client.mjs (2 hunks)
- src/env/server.mjs (1 hunks)
- src/pages/admin.tsx (1 hunks)
- src/pages/api/cal.ts (1 hunks)
- src/pages/api/resumes/[...path].ts (1 hunks)
- src/pages/apply.tsx (1 hunks)
- src/pages/checkin.tsx (1 hunks)
- src/pages/dashboard.tsx (1 hunks)
- src/pages/grade.tsx (5 hunks)
- src/pages/me.tsx (1 hunks)
- src/pages/roles.tsx (1 hunks)
- src/pages/scanner.tsx (6 hunks)
- src/pages/welcome.tsx (1 hunks)
- src/server/router/application.ts (2 hunks)
- src/server/router/context.ts (1 hunks)
- src/server/router/events.ts (1 hunks)
- src/server/router/reviewers.ts (10 hunks)
- src/server/router/sponsors.ts (5 hunks)
- src/utils/parseIcsSchedule.ts (1 hunks)
- src/utils/parseTsvSchedule.ts (1 hunks)
Files skipped from review due to trivial changes (24)
- .github/workflows/PR-CI.yaml
- src/components/Applicant.tsx
- src/components/QrScanner.tsx
- src/components/QrScanner2.tsx
- src/components/RBACWrapper.tsx
- src/env/client.mjs
- src/env/server.mjs
- src/pages/admin.tsx
- src/pages/api/cal.ts
- src/pages/api/resumes/[...path].ts
- src/pages/apply.tsx
- src/pages/checkin.tsx
- src/pages/dashboard.tsx
- src/pages/grade.tsx
- src/pages/me.tsx
- src/pages/roles.tsx
- src/pages/welcome.tsx
- src/server/router/application.ts
- src/server/router/context.ts
- src/server/router/events.ts
- src/server/router/reviewers.ts
- src/server/router/sponsors.ts
- src/utils/parseIcsSchedule.ts
- src/utils/parseTsvSchedule.ts
Additional comments: 8
prisma/schema.prisma (2)
9-9: The database provider has been changed from "postgresql" to "cockroachdb". Ensure that the CockroachDB is set up correctly and all the necessary migrations have been performed. Also, verify that the application's database-related functionality works as expected with the new provider.
56-56: The
@db.Text
annotations have been commented out in theAccount
andUser
models. This change is likely due to the migration from PostgreSQL to CockroachDB, as the@db.Text
annotation is specific to PostgreSQL, MySQL, and SQL Server. Ensure that the data types of these fields in the CockroachDB schema match the expected data types in the application. Also, verify that the application's functionality related to these fields works as expected.src/pages/scanner.tsx (6)
25-25: The addition of a trailing comma in the object literal is a minor change that aligns with the ES6 standard for trailing commas in multiline object literals and arrays. This change improves code readability and makes future diffs cleaner.
66-66: The addition of a trailing comma in the dependency array of the
useCallback
hook is a minor change that aligns with the ES6 standard for trailing commas in multiline arrays. This change improves code readability and makes future diffs cleaner.169-169: The addition of a trailing comma in the options object passed to the
useQuery
hook is a minor change that aligns with the ES6 standard for trailing commas in multiline object literals. This change improves code readability and makes future diffs cleaner.271-271: The addition of a trailing comma in the options object passed to the
useQuery
hook is a minor change that aligns with the ES6 standard for trailing commas in multiline object literals. This change improves code readability and makes future diffs cleaner.311-311: The addition of a trailing comma in the arguments of the
replace
method is a minor change that aligns with the ES6 standard for trailing commas in multiline function arguments. This change improves code readability and makes future diffs cleaner.606-606: The addition of a trailing comma in the parameters of the
getServerSideProps
function is a minor change that aligns with the ES6 standard for trailing commas in multiline function parameters. This change improves code readability and makes future diffs cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- prisma/schema.prisma (2 hunks)
Additional comments: 8
prisma/schema.prisma (8)
1-8: The database provider has been changed from "postgresql" to "cockroachdb". Ensure that the CockroachDB is set up correctly and the DATABASE_URL environment variable is updated accordingly. Also, verify that all the database operations are compatible with CockroachDB.
10-30: The Account model remains largely unchanged, but the
user
field has been renamed toUser
to match the naming convention of other relation fields. This change should not affect the functionality, but make sure to update any references to this field in the codebase.32-38: The EventLog model remains unchanged. No action needed.
40-47: The Review model has been updated. The
hacker
andreviewer
fields have been replaced withUser_Review_hackerIdToUser
andUser_Review_reviewerIdToUser
respectively. These changes reflect the new relations between the User and Review models. Ensure that these changes are reflected in the application code where these fields are used.49-55: The Session model remains largely unchanged, but the
user
field has been renamed toUser
to match the naming convention of other relation fields. This change should not affect the functionality, but make sure to update any references to this field in the codebase.57-74: The User model has been updated. The
accounts
andsessions
fields have been renamed toAccount
andSession
respectively. Thehacker
andreviewer
fields have been replaced withReview_Review_hackerIdToUser
andReview_Review_reviewerIdToUser
respectively. These changes reflect the new relations between the User and other models. Ensure that these changes are reflected in the application code where these fields are used.76-81: The VerificationToken model remains unchanged. No action needed.
99-101: The Role enum remains unchanged. No action needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to filter (1)
- prisma/migrations/migration_lock.toml
Files selected for processing (1)
- prisma/migrations/0_init/migration.sql (1 hunks)
Files skipped from review due to trivial changes (1)
- prisma/migrations/0_init/migration.sql
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 2
Configuration used: CodeRabbit UI
Files selected for processing (1)
- prisma/schema.prisma (3 hunks)
Additional comments: 1
prisma/schema.prisma (1)
- 6-12: The database provider has been changed from "postgresql" to "cockroachdb". Ensure that the database connection string in the environment variables is updated accordingly and that the CockroachDB instance is properly set up.
type String | ||
provider String | ||
providerAccountId String | ||
refresh_token String? @db.Text | ||
refresh_token String? //@db.Text | ||
refresh_token_expires_in Int? | ||
access_token String? @db.Text | ||
access_token String? //@db.Text | ||
expires_at Int? | ||
ext_expires_in Int? | ||
oauth_token_secret String? @db.Text | ||
oauth_token String? @db.Text | ||
oauth_token_secret String? //@db.Text | ||
oauth_token String? //@db.Text | ||
token_type String? | ||
scope String? | ||
id_token String? @db.Text | ||
id_token String? //@db.Text | ||
session_state String? | ||
user User @relation(fields: [userId], references: [id], onDelete: Cascade) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The refresh_token
, access_token
, oauth_token_secret
, oauth_token
, and id_token
fields in the Account
model have been commented out. If these fields are not used, consider removing them entirely. If they are needed in the future, they can be added back. Leaving commented-out code can lead to confusion and clutter.
image String? | ||
accounts Account[] | ||
sessions Session[] | ||
typeform_response_id String? @db.Text | ||
typeform_response_id String? //@db.Text | ||
role Role[] @default([HACKER]) | ||
hacker Review[] @relation("hacker") | ||
reviewer Review[] @relation("reviewer") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The typeform_response_id
field in the User
model has been commented out. Similar to the previous comment, consider removing this field if it's not used. If it's needed in the future, it can be added back.
a1cf30f
to
e3cd7e3
Compare
…om/deltahacks/portal into arian/tech-47-migrate-to-prisma-v5
…om/deltahacks/portal into arian/tech-47-migrate-to-prisma-v5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files ignored due to filter (2)
- package-lock.json
- package.json
Files selected for processing (5)
- src/pages/checkin.tsx (1 hunks)
- src/pages/dashboard.tsx (1 hunks)
- src/pages/me.tsx (1 hunks)
- src/pages/scanner.tsx (6 hunks)
- src/pages/welcome.tsx (1 hunks)
Files skipped from review due to trivial changes (4)
- src/pages/checkin.tsx
- src/pages/dashboard.tsx
- src/pages/me.tsx
- src/pages/welcome.tsx
Additional comments: 5
src/pages/scanner.tsx (5)
22-26: The
ssr
property is set tofalse
for theConstantQRReaderDynamic
component. This means that the component will not be server-side rendered. This is typically done for components that rely on browser-specific APIs. Ensure that this is the intended behavior.63-67: The dependency array of the
useEffect
hook in theFoodManagerView
component is updated to includeutils
. This means that the effect will re-run wheneverutils
changes. Ensure that this is the intended behavior and thatutils
changes infrequently to avoid unnecessary re-renders.166-172: The dependency array of the
useEffect
hook in theSponsorView
component is updated to includeqrDefer
. This means that the effect will re-run wheneverqrDefer
changes. Ensure that this is the intended behavior and thatqrDefer
changes infrequently to avoid unnecessary re-renders.268-274: The dependency array of the
useEffect
hook in theHackerView
component is updated to includeqrDefer
. This means that the effect will re-run wheneverqrDefer
changes. Ensure that this is the intended behavior and thatqrDefer
changes infrequently to avoid unnecessary re-renders.308-314: The text "High Schooler" is replaced with "High Schooler" in the
socialInfo?.currentLevel
value. This seems to be a no-op change. If the intention was to change the text, please verify that the correct text was used.
export const getServerSideProps = async ( | ||
context: GetServerSidePropsContext | ||
context: GetServerSidePropsContext, | ||
) => { | ||
const session = await getServerAuthSession(context); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The getServerSideProps
function now includes a comma after the context
parameter. This is a syntax error and will cause the code to fail. If the intention was to add another parameter, please add it.
- context: GetServerSidePropsContext,
+ context: GetServerSidePropsContext
Commitable suggestion
[!IMPORTANT]
Carefully review the code before committing. Make sure it correctly replaces the highlighted code, has no missing lines and indentaion issues.
export const getServerSideProps = async ( | |
context: GetServerSidePropsContext | |
context: GetServerSidePropsContext, | |
) => { | |
const session = await getServerAuthSession(context); | |
export const getServerSideProps = async ( | |
context: GetServerSidePropsContext | |
) => { | |
const session = await getServerAuthSession(context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This branch is quite broken and outdated. Instead of running a script, packages need to be upgraded manually while making sure the application builds. Closing for now. |
Summary by CodeRabbit
alreadyReviewed
state based on certain conditions.parseTime
function inparseIcsSchedule.ts
for accurate date construction.prisma/schema.prisma
for better data handling.