Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/JuanSebax85/backend-prueba-fullstack/llms.txt

Use this file to discover all available pages before exploring further.

The backend uses a PostgreSQL 15 database named prueba. Hibernate manages the schema automatically on startup, creating or updating the three core tables — alumnos, materias, and notas — to match the entity definitions in the application.

Schema overview

alumnos

Stores student records.
ColumnTypeNotes
idbigintPrimary key, auto-generated
nombrevarcharFirst name
apellidovarcharLast name
emailvarcharEmail address
fecha_nacimientodateDate of birth

materias

Stores course (subject) records.
ColumnTypeNotes
idbigintPrimary key, auto-generated
nombrevarcharCourse name
codigovarcharCourse code
creditosintegerCredit value

notas

Stores grade records. Each nota links one alumno to one materia.
ColumnTypeNotes
idbigintPrimary key, auto-generated
valordouble precisionGrade value
fecha_registrodateDate the grade was recorded
alumno_idbigintForeign key → alumnos.id
materia_idbigintForeign key → materias.id

Referential integrity

The notas table has foreign key constraints on both alumno_id and materia_id. This enforces referential integrity at the database level:
  • A nota cannot reference an alumno or materia that does not exist.
  • Attempting to delete an alumno or materia that still has associated notas will fail with a foreign key violation.
You must delete all related notas before deleting an alumno or a materia. Failure to do so will result in a constraint violation error and the delete will be rejected by the database.
The safe deletion order is:
  1. Delete notas that reference the target alumno or materia.
  2. Delete the alumno or materia.

Connecting to the database

To open an interactive PostgreSQL session inside the running container:
docker exec -it postgres_db psql -U postgres -d prueba
This drops you into a psql shell connected to the prueba database as the postgres user.

Viewing existing data

Once connected, run standard SQL queries to inspect the data:
SELECT * FROM alumnos;
SELECT * FROM materias;
SELECT * FROM notas;
Use \dt in the psql shell to list all tables, and \d tablename to inspect column definitions and constraints.

Restoring a backup dump

1

Copy the dump file into the container

docker cp backup.dump postgres_db:/backup.dump
This places the dump file inside the running postgres_db container at /backup.dump.
2

Run the restore command

docker exec -it postgres_db psql -U postgres -d prueba -f /backup.dump
PostgreSQL reads the SQL file and executes all statements against the prueba database.
If the dump contains CREATE TABLE statements and the tables already exist, you may see errors for duplicate objects. To restore cleanly, either drop the existing tables first or use a dump format that includes DROP TABLE IF EXISTS statements.

Schema auto-management

The application is configured with:
application.properties
spring.jpa.hibernate.ddl-auto=update
On every startup, Hibernate compares the current database schema against the JPA entity definitions and applies any differences. New tables and columns are created automatically; existing data is preserved. Columns removed from entities are left in place and must be dropped manually if no longer needed.

Next steps

Configuration guide

Set the database connection variables and understand connection pool settings.

Docker deployment

Start the database service and run the full stack with Docker Compose.

Build docs developers (and LLMs) love