You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesión a prueba de IA

Antes: $249

Currency
$209
Suscríbete

Termina en:

0 Días
5 Hrs
15 Min
10 Seg
Curso de Backend con ExpressJS

Curso de Backend con ExpressJS

Oscar Barajas Tavares

Oscar Barajas Tavares

Creación y Migración de Modelos con Prisma para Citas Médicas

23/30
Resources

In order to develop an application to manage medical appointments efficiently, it is first key to understand and correctly handle the minimum necessary models. These models make it easy for registered users to choose blocks of time to schedule their appointments.

What minimum models do you need to manage medical appointments with Prisma?

It is very important to have the essential models that enable the basic functionality of an API to manage appointments. In this particular case, the models are:

  • User: already available in the current model.
  • Appointments: require key information such as date, associated user and time block.
  • Time blocks: allow to display and manage the schedules available to users.

These models are critical to maintain an organized structure to support possible future extensions, such as doctors or specific categories.

How do you correctly add and migrate new models in Prisma?

To add these new models, follow a few specific steps:

  1. Place the models in the schema.prisma file.
  2. Update necessary relationships, such as incorporating user appointments.
  3. To migrate the models and generate the necessary resources, run the following commands in your terminal:
npx prisma migrate dev --name new_models npx prisma generate

These actions update your database and generate the information required to use the new models in the application.

How to visualize and manage the database with PgAdmin?

An efficient option to visually manage the PostgreSQL database is PgAdmin, a user-friendly tool to explore data:

  • Download and install PgAdmin.
  • Create a new connection using the details of the .env file (localhost, port, user, password).
  • View and manage data directly from a graphical interface.

PgAdmin makes it easy to review and validate information generated withseed scripts, review users,appointments or make manual modifications.

If you have ideas, comments or updates on this procedure or on how to better manage security when seeding data, please share them!

Contributions 1

Questions 0

Sort by:

Want to see more contributions, questions and answers from the community?

También se puede utilizar Prisma Studio.