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

Refactor database #295

Closed
wants to merge 7 commits into from
Closed

Refactor database #295

wants to merge 7 commits into from

Conversation

TusharW4ni
Copy link
Contributor

No description provided.

@TusharW4ni TusharW4ni linked an issue Feb 28, 2025 that may be closed by this pull request
@TusharW4ni
Copy link
Contributor Author

Hey @Atticusth7 , I have a few inputs:

  • In the Ride model, attributes date, startTime, and endTime should be all required fields which need to be supplied when creating that entity.
  • Also, I am unsure and unable to recollect how we are using the endTime? Is the admin going to be required to say how long the ride is going to be? @Deethya0715 can you please help us with this?
  • In the VolunteerInfo model, we need a userId field that the relation uses instead of the id that is being used twice.

The only PostgreSQL feature we are using is enums. So, I think we can easily move to SQLite and make our database deployment much easier. We won't have enums available to us in SQLite however, they can be substituted with just strings. We will need to careful to use the right strings in the APIs. Please look at these links to figure out how to migrate: https://www.robinwieruch.de/next-prisma-sqlite/ and https://www.prisma.io/docs/orm/overview/databases/sqlite

If y'all have any questions please let me know.

@Deethya0715
Copy link
Collaborator

Hey @TusharW4ni,

I belive that we are not using the endTime and @Atticusth7 will be removing it from the database. Thank you!

@TusharW4ni
Copy link
Contributor Author

Alright, a few more things:

  • In the VolunteerInfo model keep the id field that you had earlier: id Int @id @default(autoincrement()) Then you can make another attribute called userId Int for the relation field. You can keep the relation attribute like it is in. The id field is the id of the row that will be in the VolunteerInfo table, and the userId field is the id of the row in the User table.
  • You correctly added the file:./dev.db, but you should also add the actual file dev.db in the prisma folder and add it to git. I think you will need to run npx prisma migrate reset to run the migrations and seed the database before committing to git.
  • You should also run format on the schema file. You should be able to do this by hitting ctrl+shift+p in VSCode, typing format, and then choose the option that says something like format file... or format file with... which should give you an option to choose the formatter.

Since I opened this PR, I don't think GitHub will let me merge it in. So, I've added you as a reviewer on the PR. After making these changes, see if you are able to hit the Merge pull request button.

Copy link
Collaborator

@Atticusth7 Atticusth7 left a comment

Choose a reason for hiding this comment

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

Confirmed changes and approved review.

@Atticusth7 Atticusth7 self-assigned this Mar 2, 2025
@TusharW4ni TusharW4ni closed this Mar 2, 2025
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.

Refactor Database
3 participants