Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/carlamndz/InventarioITU/llms.txt

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

InventarioITU uses a relational database as the backbone for structured, normalized data that describes where each piece of equipment lives and who it is assigned to. The project supports SQL Server (primary) or MySQL as the relational engine — both expose the same logical schema. Lab room definitions, equipment registration records, and assignment histories all fit naturally into a relational model: rows have predictable shapes, foreign keys enforce referential integrity between labs and machines, and SQL queries make it straightforward to produce audit reports. The service is named ubicacion-db throughout the stack and runs on port 1433 (SQL Server) or 3306 (MySQL).

The ubicacion-db Service

Within the InventarioITU architecture, ubicacion-db is a Microsoft SQL Server 2022 instance (or MySQL 8, depending on your chosen engine) responsible exclusively for location and assignment data. It is deployed as a Docker container during local development and as a Kubernetes Deployment + Service object in the production cluster.
PropertySQL Server valueMySQL value
Service nameubicacion-dbubicacion-db
Imagemcr.microsoft.com/mssql/server:2022-latestmysql:8
Port14333306
Default databaseinventarioinventario
Default usersaroot
SQL initialization scripts and schema migration files belong in db/sqlserver/ inside the repository. That directory currently contains placeholder files — when you add your SQL scripts there, reference them from this guide for easy bootstrapping.

Run SQL Server Locally with Docker

For local development you can spin up ubicacion-db with a single docker run command. This starts SQL Server 2022 in a detached container, accepts the EULA, and binds port 1433 on your host machine.
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=YourStrong!Passw0rd' \
  -p 1433:1433 --name ubicacion-db \
  -d mcr.microsoft.com/mssql/server:2022-latest
After a few seconds the server will be ready to accept connections. You can verify it is healthy by running:
docker exec -it ubicacion-db /opt/mssql-tools/bin/sqlcmd \
  -S localhost -U sa -P 'YourStrong!Passw0rd' -Q "SELECT @@VERSION"
Never use YourStrong!Passw0rd in a shared, staging, or production environment. Set a unique, high-entropy SA password and rotate it regularly. In Kubernetes, store the password in a Secret object — never in a ConfigMap or a container environment variable that is committed to source control.

Connection String

The application connects to ubicacion-db using the following connection string format. Replace the host with the Kubernetes service DNS name (ubicacion-db) when running inside the cluster.
mssql://sa:YourStrong!Passw0rd@localhost:1433/inventario
When connecting from within the Kubernetes cluster the hostname resolves via the internal DNS entry for the ubicacion-db Service:
mssql://sa:<DB_PASSWORD>@ubicacion-db:1433/inventario

Schema Initialization

1

Connect to the SQL Server instance

Use sqlcmd, Azure Data Studio, or the SQL Server extension for VS Code to open a session against the running container before executing the schema script.
docker exec -it ubicacion-db /opt/mssql-tools/bin/sqlcmd \
  -S localhost -U sa -P 'YourStrong!Passw0rd'
2

Create the database and tables

Run the following DDL to create the inventario database and its core tables. This is an illustrative example — you can place it in db/sqlserver/init.sql once you are ready to check scripts into the repository.
CREATE DATABASE inventario;
GO
USE inventario;
GO
CREATE TABLE laboratorios (
  id INT PRIMARY KEY IDENTITY,
  nombre NVARCHAR(100) NOT NULL,
  edificio NVARCHAR(100),
  capacidad INT
);
CREATE TABLE equipos (
  id NVARCHAR(20) PRIMARY KEY,
  nombre NVARCHAR(100),
  laboratorio_id INT REFERENCES laboratorios(id),
  asignado_a NVARCHAR(200),
  estado NVARCHAR(50) DEFAULT 'disponible',
  fecha_ingreso DATE
);
The equipos.id column (e.g. LAB01-PC-001) is a human-readable composite key that also acts as the cross-database link to MongoDB. See Data Model for details.
3

Verify the schema

Confirm both tables were created successfully:
USE inventario;
GO
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE';
GO

Environment Variables

The inventario-web application reads the following environment variables to build its SQL Server connection. Set them in your .env file for local development or in a Kubernetes Secret for cluster deployments.
VariableDescriptionExample
DB_HOSTHostname or IP of the SQL Server instanceubicacion-db
DB_PORTTCP port SQL Server listens on1433
DB_NAMEName of the application databaseinventario
DB_USERSQL login usernamesa
DB_PASSWORDPassword for the SQL loginYourStrong!Passw0rd
# .env (local development only — do not commit)
DB_HOST=localhost
DB_PORT=1433
DB_NAME=inventario
DB_USER=sa
DB_PASSWORD=YourStrong!Passw0rd

Build docs developers (and LLMs) love