Prisma Studio
Once changes have been made to a database, it is often useful to manually check to ensure that the changes have been made correctly.
Prisma Studio is a tool that allows you to do just this. It provides a visual interface to your database, allowing you to view, add, edit and delete records.
To spin it up, run the following command:
npx prisma studio
This will open a new tab in your browser at http://localhost:5555
, showing the database schema and the single User
table currently within it:
Click on the User
table, and you will see the (empty) fields that are currently within it.
Adding a new user
Section titled βAdding a new userβYou can add and delete new records directly from inside Prisma Studio. Letβs add a new user manually by clicking on the Add Record button:
Youβll see that most of the fields automatically have values added to them. This is because we have set default values for id
, createdAt
and updatedAt
in the Prisma schema. All we need to do is manually add an email
to the new user.
Double click the email
field and add a new email address. Remember to click Save 1 change when youβre done:
Once you have a completely empty User
table, you can close Prisma Studio by typing Ctrl + C and hitting return in the terminal window.
Next, we will add an Article
table, and link articles to users with a foreign key.