Update your database
To add new tables or columns to your database we use Prisma. Prisma is a TypeScript ORM, and it helps you apply changes to your database, and interact with it in a type-safe way., and without using SQL.
Add a new table
To add a new table, open the file prisma/schema.prisma
and add a new model.
For instance, to add a new table called Orders
, add this
Add column
To add a column to a table, simply add a new property to a model.
To add a new column, called validUntil
to the previous Orders
table, simply add line 5:
Apply the schema to your database
To do that, run this command:
With this command, prisma will apply the schema defined into prisma/schema.prisma
to the database defined in the .env file, using the connection string defined in the environment variable DATABASE_URL
.
Last updated
Was this helpful?