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

chore: upgrade to prisma v5 #150

Merged
merged 3 commits into from
Nov 4, 2023
Merged

chore: upgrade to prisma v5 #150

merged 3 commits into from
Nov 4, 2023

Conversation

Krish120003
Copy link
Member

@Krish120003 Krish120003 commented Nov 4, 2023

Summary by CodeRabbit

  • New Features
    • Introduced new user roles and statuses.
    • Added new tables for account management, user reviews, and session tracking.
    • Implemented event logging and verification token systems.
  • Refactor
    • Switched database provider from PostgreSQL to CockroachDB.
    • Updated data annotations in Account and User models for better data management.
    • Enhanced Review model with explicit hacker and reviewer fields.

@Krish120003 Krish120003 requested a review from arian81 November 4, 2023 06:24
Copy link
Contributor

coderabbitai bot commented Nov 4, 2023

Walkthrough

The recent changes encompass the creation of new ENUM types, tables, and unique indexes in the SQL migration file. The Prisma schema has been updated with changes in the datasource provider, removal of certain annotations, addition of new fields, and a new model.

Changes

File Summary
prisma/migrations/0_init/migration.sql Introduced two ENUM types, "Role" and "Status". Created five new tables: "Account", "Session", "User", "Review", "EventLog", and "VerificationToken". Added unique indexes and foreign key constraints.
prisma/schema.prisma Changed datasource provider from "postgresql" to "cockroachdb". Removed @db.Text annotation from several fields in the Account and User models. Added hacker and reviewer fields to the Review model. Introduced the VerificationToken model.

Poem

🍂 As the autumn leaves fall, we code with glee, 🍁

Changes abound, as you can clearly see. 🖥️

New tables and types, a schema so fine, 📚

In the world of Prisma, everything's divine. 🌐

From Postgres to Cockroach, a leap we've made, 🐇

Fear not, for our code is grade-A grade. 🏆

So here's to the changes, big and small, 🥂

In the world of code, we stand tall. 🌟


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai help to get help.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Copy link

netlify bot commented Nov 4, 2023

Deploy Preview for profound-kringle-30b3e4 ready!

Name Link
🔨 Latest commit 508873b
🔍 Latest deploy log https://app.netlify.com/sites/profound-kringle-30b3e4/deploys/6545e3ae5771c30008c4e91b
😎 Deploy Preview https://deploy-preview-150--profound-kringle-30b3e4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between aff79ff and 508873b.
Files ignored due to filter (3)
  • package-lock.json
  • package.json
  • prisma/migrations/migration_lock.toml
Files selected for processing (2)
  • prisma/migrations/0_init/migration.sql (1 hunks)
  • prisma/schema.prisma (6 hunks)
Additional comments: 10
prisma/migrations/0_init/migration.sql (4)
  • 1-6: The creation of new ENUM types "Role" and "Status" is a good practice for maintaining data integrity and consistency. Ensure that the values of these ENUMs are used consistently throughout the application.

  • 77-81: The creation of new tables "Account", "Session", "User", "Review", "EventLog", and "VerificationToken" is a significant change. Ensure that these tables are properly integrated into the application and that all necessary relationships are established.

  • 84-99: The creation of unique indexes is a good practice for optimizing database performance and ensuring data integrity. Ensure that these indexes are used correctly in the application.

  • 102-114: The addition of foreign key constraints is a good practice for maintaining data integrity and consistency. Ensure that these constraints are handled correctly in the application, especially in the case of cascading deletes or updates.

prisma/schema.prisma (6)
  • 1-8: The datasource 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.

  • 14-28: The @db.Text annotations have been removed from several fields in the Account model. This could potentially affect the way data is stored and retrieved. Ensure that this change is compatible with the data types of the corresponding columns in the database.

  • 46-52: The User model has been updated with new relation fields hacker and reviewer for the Review model. Ensure that these changes are reflected in the corresponding database schema and that the relations are set up correctly.

  • 60-68: The Review model has been updated with explicit hacker and reviewer fields with @relation annotations. Ensure that these changes are reflected in the corresponding database schema and that the relations are set up correctly.

  • 78-84: A new VerificationToken model has been added. Ensure that this model is reflected in the corresponding database schema and that the unique constraints are set up correctly.

  • 101-103: New ENUM values have been added to the Status ENUM. Ensure that these changes are reflected in the corresponding database schema.

@Krish120003 Krish120003 merged commit d051dab into main Nov 4, 2023
5 checks passed
@Krish120003 Krish120003 deleted the package-upgrade branch November 4, 2023 06:30
Krish120003 added a commit that referenced this pull request Nov 17, 2023
* Update README.md (#138)

* feat: MacID auth (#137)

* fix: updated dependencies

* feat: MacID login

* fix: deprecated property

* fix: lint and prettier

---------

Co-authored-by: Krish <[email protected]>

* feat: add prisma migration for nextauth ext_expires_in

* chore: Migrate trpc v9 to v10 (#140)

* init

* run codemod

* more

* lint

* chore: fix useQuery in grade endpoint

* chore: update naming

* chore: lint

* chore: use better logic for priority query

* chore: lint

---------

Co-authored-by: Arian Ahmadinejad <[email protected]>

* chore: add format on save as a config (#142)

Co-authored-by: Krish <[email protected]>

* fix: Changed date of hackathon and version TECH-43 (#141)

* changed date of hackathon and version number

* format

* changed all occurences of DeltaHacks IX -> X

* format

* added s by accident

* chore: upgrade to node 20 (#148)

* chore: add nvmrc

* feat: .nvmrc to v20

* chore: upgrade to prisma v5 (#150)

* chore: upgrade prisma packages

* chore: adjust schema for v5

* chore: baseline db

* fix(TS): warnings/errors messages (#146)

* fixed QRScanner warnings

* fixed QRScanner2.tsx warnings and fixed bug with QRScanner.tsx

* commented everything out of middleware.ts

* removed router from admin.tsx

* fixed error on middleware.ts that dissallowed not having an export keyword

* fixed scanner.tsx warnings and errors

---------

Co-authored-by: Felix Fong <[email protected]>
Co-authored-by: Krish <[email protected]>

* feat: create custom application form (#149)

* feat: init react form hook

* chore: run prettier

* feat: add schema for dh10 applications

* chore: worked on basics of forms

* poc form element component

* ...

* fix: cleanup social buttons

* fix: update faq link

* feat: add layout

* fix: remove for now because we need to migrate away from typeform

* feat: add zod schema for prisma make easy types

* feat: add zod generation from schema

* feat: use DH10 Application zod type

* feat: add form

* chore: migrate to pnpm

* chore: fix CI for pnpm

* lint

* feat: add basic styling

* feat: add more styling

* fix: remove zod prisma

* fix: remove generated zod types

* feat: add questions, update schema

* feat: university select

* chore: print errors for now

* feat: add og

* feat: add autofill, application submission route, and more select stuff

* fix: university select width

* fix: add light mode

* feat: allow for collapsable university section

* feat: multiselect component

* chore: cleanup unused code

* feat: add appropirate select components

* Update src/schemas/application.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* feat: show when form was autofilled

* Update apply.tsx

* fix: build error, add apostrophe

* fix: update workshop type to array

* fix: make fields optional

* Update src/pages/apply.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: update question text

* fix: pass field prop to component

* corrected wasAuoFilled -> wasAutoFilled

* fix: can scroll on side of forums

* fix: application.getPrevAutofill no more exceptions if the user has no autofill information

* fix: adjusted first and last name boxes to flex-row for smaller form factors

* fix: make previous hackathon count always positive

* add: react-hook-form-persist for localStorage

* fix: limited the year field in dates to 4 digits

* feat: added localstorage to everything except date fields

* added link to resume field on application FE

* fixed page

* chore: form mostly done 😭

Co-authored-by: Krish <[email protected]>

* chore: cleanup code, add errors

* feat: significantly improve dashboard speed by prefetching status

* fix: date autofill

* feat: upgrade to daisyui v4, responsive form

* feat: light mode. redefined. (I redid everything)

* fix: add back commented gssp

* chore: cleanup

* chore: better error messags

* feat: add word limit indicators

* chore: migrate database

* chore: remove random gitignore

* chore: add bg animation back

* chore: remove unused component

* fix: remove race condition

---------

Co-authored-by: Krish120003 <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Felix Fong <[email protected]>
Co-authored-by: jeffreychan <[email protected]>
Co-authored-by: Krish <[email protected]>

* chore: downgrade next version

* fix: multi select vertical spacing (#152)

* feat: mobile phone validation (#153)

* fix: save forms with persist ids, and remove on load (#151)

* fix: detect invalid dates (#154)

* fix: detect invalid dates

* fix: set possible as const

* feat: show submission error

* fix: use use effect for local storage manipulation

* fix: remove extra type

* chore: remove unnecessary type def

---------

Co-authored-by: Arian Ahmadinejad <[email protected]>

* fix: og image (#155)

* fix: change image

* feat: add meta tags

* fix: title

* feat: add theme colors

---------

Co-authored-by: Krish120003 <[email protected]>

* fix: fix faq link

* feat: collect mcmaster EV information (#156)

* feat: collect mcmaster EV information

* feat: collect mcmaster EV information

* chore: update text

* fix: typo

* feat: install logrocket (#157)

* feat: install logrocket

* fix: update id

* feat: add logrocket identification

* fix: identity tracking from session

* feat: disable tracking in dev

* feat: add an application killswitch (#158)

* chore: scaffold page

* chore: prelimnary setup for killswitch feature

Co-authored-by: Krish <[email protected]>

* feat: add config for killswitch

* feat: addd killswitch buttons

---------

Co-authored-by: Arian Ahmadinejad <[email protected]>

---------

Co-authored-by: Arian Ahmadinejad <[email protected]>
Co-authored-by: Julius Marminge <[email protected]>
Co-authored-by: Jeffrey Chan <[email protected]>
Co-authored-by: Felix Fong <[email protected]>
Co-authored-by: Felix Fong <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: jeffreychan <[email protected]>
Co-authored-by: Rachelle DeMan <[email protected]>
arian81 added a commit that referenced this pull request Nov 21, 2023
* Update README.md (#138)

* feat: MacID auth (#137)

* fix: updated dependencies

* feat: MacID login

* fix: deprecated property

* fix: lint and prettier

---------

Co-authored-by: Krish <[email protected]>

* feat: add prisma migration for nextauth ext_expires_in

* chore: Migrate trpc v9 to v10 (#140)

* init

* run codemod

* more

* lint

* chore: fix useQuery in grade endpoint

* chore: update naming

* chore: lint

* chore: use better logic for priority query

* chore: lint

---------

Co-authored-by: Arian Ahmadinejad <[email protected]>

* chore: add format on save as a config (#142)

Co-authored-by: Krish <[email protected]>

* fix: Changed date of hackathon and version TECH-43 (#141)

* changed date of hackathon and version number

* format

* changed all occurences of DeltaHacks IX -> X

* format

* added s by accident

* chore: upgrade to node 20 (#148)

* chore: add nvmrc

* feat: .nvmrc to v20

* chore: upgrade to prisma v5 (#150)

* chore: upgrade prisma packages

* chore: adjust schema for v5

* chore: baseline db

* fix(TS): warnings/errors messages (#146)

* fixed QRScanner warnings

* fixed QRScanner2.tsx warnings and fixed bug with QRScanner.tsx

* commented everything out of middleware.ts

* removed router from admin.tsx

* fixed error on middleware.ts that dissallowed not having an export keyword

* fixed scanner.tsx warnings and errors

---------

Co-authored-by: Felix Fong <[email protected]>
Co-authored-by: Krish <[email protected]>

* feat: create custom application form (#149)

* feat: init react form hook

* chore: run prettier

* feat: add schema for dh10 applications

* chore: worked on basics of forms

* poc form element component

* ...

* fix: cleanup social buttons

* fix: update faq link

* feat: add layout

* fix: remove for now because we need to migrate away from typeform

* feat: add zod schema for prisma make easy types

* feat: add zod generation from schema

* feat: use DH10 Application zod type

* feat: add form

* chore: migrate to pnpm

* chore: fix CI for pnpm

* lint

* feat: add basic styling

* feat: add more styling

* fix: remove zod prisma

* fix: remove generated zod types

* feat: add questions, update schema

* feat: university select

* chore: print errors for now

* feat: add og

* feat: add autofill, application submission route, and more select stuff

* fix: university select width

* fix: add light mode

* feat: allow for collapsable university section

* feat: multiselect component

* chore: cleanup unused code

* feat: add appropirate select components

* Update src/schemas/application.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* feat: show when form was autofilled

* Update apply.tsx

* fix: build error, add apostrophe

* fix: update workshop type to array

* fix: make fields optional

* Update src/pages/apply.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: update question text

* fix: pass field prop to component

* corrected wasAuoFilled -> wasAutoFilled

* fix: can scroll on side of forums

* fix: application.getPrevAutofill no more exceptions if the user has no autofill information

* fix: adjusted first and last name boxes to flex-row for smaller form factors

* fix: make previous hackathon count always positive

* add: react-hook-form-persist for localStorage

* fix: limited the year field in dates to 4 digits

* feat: added localstorage to everything except date fields

* added link to resume field on application FE

* fixed page

* chore: form mostly done 😭

Co-authored-by: Krish <[email protected]>

* chore: cleanup code, add errors

* feat: significantly improve dashboard speed by prefetching status

* fix: date autofill

* feat: upgrade to daisyui v4, responsive form

* feat: light mode. redefined. (I redid everything)

* fix: add back commented gssp

* chore: cleanup

* chore: better error messags

* feat: add word limit indicators

* chore: migrate database

* chore: remove random gitignore

* chore: add bg animation back

* chore: remove unused component

* fix: remove race condition

---------

Co-authored-by: Krish120003 <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Felix Fong <[email protected]>
Co-authored-by: jeffreychan <[email protected]>
Co-authored-by: Krish <[email protected]>

* chore: downgrade next version

* fix: multi select vertical spacing (#152)

* feat: mobile phone validation (#153)

* fix: save forms with persist ids, and remove on load (#151)

* fix: detect invalid dates (#154)

* fix: detect invalid dates

* fix: set possible as const

* feat: show submission error

* fix: use use effect for local storage manipulation

* fix: remove extra type

* chore: remove unnecessary type def

---------

Co-authored-by: Arian Ahmadinejad <[email protected]>

* fix: og image (#155)

* fix: change image

* feat: add meta tags

* fix: title

* feat: add theme colors

---------

Co-authored-by: Krish120003 <[email protected]>

* fix: fix faq link

* feat: collect mcmaster EV information (#156)

* feat: collect mcmaster EV information

* feat: collect mcmaster EV information

* chore: update text

* fix: typo

* feat: install logrocket (#157)

* feat: install logrocket

* fix: update id

* feat: add logrocket identification

* fix: identity tracking from session

* feat: disable tracking in dev

* feat: add an application killswitch (#158)

* chore: scaffold page

* chore: prelimnary setup for killswitch feature

Co-authored-by: Krish <[email protected]>

* feat: add config for killswitch

* feat: addd killswitch buttons

---------

Co-authored-by: Arian Ahmadinejad <[email protected]>

* fix: min age should be 13 (#160)

* fix: drawer exit + mlh hyperlinks (#162)

* chore: add mlh hyperlinks

* chore: add exit to drawer

* chore: house keeping

* chore: make macid default login (#163)

* chore: make macid default login

* chore: make secondary checkbox checked by default

* feat: Allow user to redo application (#165)

* chore: add button

* feat: added application deletion for user redo

* chore: lint and format

* fix: error handling for deletion failure

* fix: typo + lint

* chore: change ev form link

* fix: make router async

* fix: use trpc onsuccess for rerouting

* chore: lint

* fix: login icon

* feat: add logsnag for application deletion

---------

Co-authored-by: Krish <[email protected]>
Co-authored-by: Julius Marminge <[email protected]>
Co-authored-by: Jeffrey Chan <[email protected]>
Co-authored-by: Felix Fong <[email protected]>
Co-authored-by: Felix Fong <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: jeffreychan <[email protected]>
Co-authored-by: Krish <[email protected]>
Co-authored-by: Rachelle DeMan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant