Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Jcofles/Proyecto-web/llms.txt

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

UniMaps stores all user accounts, campus map nodes, path connections, and security codes in a MySQL database. This page explains how to point the application at your database server, how to initialize the schema, and what tables are created.

Supported database

UniMaps requires MySQL (or a MySQL-compatible server such as MariaDB). The DB_CONNECTION variable must be set to mysql; other drivers listed in config/database.php (SQLite, PostgreSQL, SQL Server) are not supported for production use.

Required environment variables

Set these in your .env file or your deployment platform’s environment variable UI.
VariableExample valueDescription
DB_CONNECTIONmysqlDatabase driver. Must be mysql.
DB_HOST127.0.0.1Hostname or IP address of the MySQL server.
DB_PORT3306Port the MySQL server listens on. The MySQL default is 3306.
DB_DATABASEunimapsName of the database schema. The schema must already exist before running migrations.
DB_USERNAMEunimaps_userMySQL user. This user must have CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, and SELECT privileges on DB_DATABASE.
DB_PASSWORD(secret)Password for DB_USERNAME.
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=unimaps
DB_USERNAME=unimaps_user
DB_PASSWORD=your_password
On Railway, add the MySQL plugin to your project. Railway automatically injects MYSQLHOST, MYSQLPORT, MYSQLDATABASE, MYSQLUSER, and MYSQLPASSWORD variables. Map these to the DB_* names expected by Laravel in the service’s “Variables” tab, or create a reference variable (e.g., DB_HOST=$MYSQLHOST).

Running migrations

UniMaps uses Laravel migrations to create and update the database schema. Run migrations from the Clase1/ directory:
cd Clase1
php artisan migrate
On Railway (and other platforms with a release phase), this command runs automatically if you have configured the release entry in your Procfile:
# Clase1/Procfile
release: php artisan migrate --force
web: php artisan serve --host=0.0.0.0 --port=$PORT
Always ensure the database server is reachable and DB_* credentials are correct before running migrations. A misconfigured DB_HOST or wrong password will cause the migrate command to fail, and on Railway this will prevent the service from starting.

Seeding initial campus data

The default seeder loads the ITFIP campus map data (nodes and connections for the physical campus layout). Run it after migrations:
php artisan db:seed
This calls CampusItfipSeeder, which populates the nodos, conexiones, and nodo_tipos tables with the mapped locations and pathways for ITFIP university.
If you need to import the full coordinate dataset from the SQL export, use the dedicated import command:
php artisan import:coordenadas --truncate
The --truncate flag clears any existing node data before importing, which is useful when re-seeding a fresh database.

Tables overview

The following tables are created by migrations. They are listed in the order the migrations run.

User and authentication tables

TablePurpose
usersVerified user accounts. A row is only inserted here after the user confirms their email. Includes name, email, password, email_verified_at, and a status_id foreign key.
pending_usersTemporary holding table for registrations awaiting email verification. Contains nombres, apellidos, email, password (hashed), email_verification_token, and an expiry timestamp. Rows are removed once verification succeeds.
password_reset_tokensStandard Laravel token table for password reset flows.
password_reset_codesSix-digit numeric codes used by UniMaps’ custom password reset flow. Each row ties a code to an email with an expires_at timestamp.
email_change_codesSix-digit codes for email address change verification. One pending change per user (user_id is unique). Stores the new_email, code, and expiry.
deleted_users_logAudit log of deleted accounts. Retains the user’s original and anonymized email, who deleted the account (self or an admin ID), and the deletion reason.
user_statusLookup table of possible user statuses: activo, inactivo, bloqueado, eliminado.
login_attemptsTracks failed login attempts per email address. Used to enforce temporary lockouts via the blocked_until column.
sessionsSession data when SESSION_DRIVER=database.
personal_access_tokensSanctum API tokens for authenticated API access.

Campus map tables

TablePurpose
nodosMap nodes representing physical locations on campus. Each row has a nombre, latitud, longitud, piso (floor), and a tipo_id foreign key to nodo_tipos.
nodo_tiposLookup table of node categories: salon (classroom), pasillo (corridor), baño (bathroom), escaleras (stairs). Seeded automatically on first migration.
conexionesDirected edges between nodes. Each row links a nodo_origen_id to a nodo_destino_id and stores the distancia (distance in meters) used by the pathfinding algorithm. The (nodo_origen_id, nodo_destino_id) pair is unique.

System tables

TablePurpose
jobsQueue job storage when QUEUE_CONNECTION=database.
cacheCache entries when CACHE_STORE=database.
migrationsLaravel’s migration history. Do not edit this table manually.
When deploying to Railway, the MySQL plugin provisions a managed database automatically. You do not need to create the schema manually — Railway creates the database with the name it injects as MYSQLDATABASE. Just set DB_DATABASE to the same value and run migrations.

Build docs developers (and LLMs) love