You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You'll be creating the schemas for one of the big databases our client will be using: inventory!
TODO
Initial steps:
move this ticket to the In Progress column
get updated with the codebase (git checkout dev, git pull, create a new branch by git checkout -b [branchname] as per README, npm install to update your dependencies, npm run dev)
Prisma setup:
Add a model to the schema.prisma file for inventory (itemName is a primary key (unique identifier))
Generate the Prisma client by running: npx prisma generate
Testing (after making the Prisma schema)
prisma migrate dev (this applies updates the neon.tech db with your new prisma changes)
prisma db pull (this tests if Prisma can connect to the Neon.tech database)
ts-node testConnection.ts (runs the connection test under tests/testConnection.ts)
API setup:
Open the file called api/inventory/route.ts
Add CRUD functions for inventory (not API endpoints yet, but utility functions that will be used in the API)
Create (POST)
Read (GET)
Update (PUT)
Delete (DELETE)
create a PR for this ticket
move this ticket to the Ready for Review column
What is CRUD?
Create: Takes all the information necessary to create an object
Read all: Returns every record in the table
Update: Takes a record object with an ID. Writes over the existing record with the input
Delete: Deletes a record from the table, given a record ID
How do we access our database?
We're using Neon.tech to host and manage our SQL database. Running the prisma migrate dev command applies any pending migration files in our Prisma project to our Neon.tech PostgreSQL database. This means it creates new tables or modifies existing ones based on the changes in the Prisma schema. These changes are reflected in the Neon.tech dashboard. You'll be able to see the newly created tables, columns, and relationships in your database, or any modifications (like added or removed columns) if you're updating the schema.
Our schema
The text was updated successfully, but these errors were encountered:
Purpose
You'll be creating the schemas for one of the big databases our client will be using: inventory!
TODO
Initial steps:
git checkout dev
,git pull
,create a new branch by git checkout -b [branchname]
as per README,npm install
to update your dependencies,npm run dev
)Prisma setup:
schema.prisma
file for inventory (itemName is a primary key (unique identifier))npx prisma generate
prisma migrate dev
(this applies updates the neon.tech db with your new prisma changes)prisma db pull
(this tests if Prisma can connect to the Neon.tech database)ts-node testConnection.ts
(runs the connection test undertests/testConnection.ts
)API setup:
api/inventory/route.ts
What is CRUD?
Create: Takes all the information necessary to create an object
Read all: Returns every record in the table
Update: Takes a record object with an ID. Writes over the existing record with the input
Delete: Deletes a record from the table, given a record ID
Helpful Resources
We'll be using Vercel for the server: https://vercel.com/guides/nextjs-prisma-postgres
How do we access our database?
We're using Neon.tech to host and manage our SQL database. Running the
prisma migrate dev
command applies any pending migration files in our Prisma project to our Neon.tech PostgreSQL database. This means it creates new tables or modifies existing ones based on the changes in the Prisma schema. These changes are reflected in the Neon.tech dashboard. You'll be able to see the newly created tables, columns, and relationships in your database, or any modifications (like added or removed columns) if you're updating the schema.Our schema
The text was updated successfully, but these errors were encountered: