Skip to main content

Database name

All connection settings in conexion.php point to a single database:
bienes_nacionales_uptag
Create this database before importing the schema.

Create the database

  1. Open http://localhost/phpmyadmin.
  2. Click New in the left sidebar.
  3. Enter bienes_nacionales_uptag as the database name.
  4. Set the collation to utf8mb4_general_ci.
  5. Click Create.

Import the schema

The file bd_bienes_nacionales.sql in the project root contains the complete schema and default seed data.
1

Select the database

Click bienes_nacionales_uptag in the phpMyAdmin sidebar.
2

Import the SQL file

Go to the Import tab, click Choose File, select bd_bienes_nacionales.sql, and click Go.
3

Verify

The left sidebar should now list all tables under bienes_nacionales_uptag.

Table overview

The schema creates thirteen tables. The diagram below shows the dependency order used in bd_bienes_nacionales.sql.

usuarios

System users. Primary key is cedula (Venezuelan national ID). Stores password_hash (bcrypt), rol (Administrador or Usuario), and activo flag.

categorias

Asset categories. Supports a self-referencing categoria_padre_id for hierarchical classification (e.g., SIGECOF categories).

estatus

Asset statuses. The permite_movimiento flag controls whether a bien in that status can be transferred.

dependencias

Organizational units (Rectoría, Vicerrectorado, OGA, etc.). Typed as Administrativa, Academica, PNF, Laboratorio, or Otra.

ubicaciones

Physical locations within a dependencia (e.g., Oficina del Rector). Each ubicación belongs to exactly one dependencia.

bienes

Core asset table. References categorias, ubicaciones, estatus, adquisiciones, and optionally donaciones.

movimientos

Asset movement history. Records origin/destination locations, responsible parties, and the registering user’s cédula.

auditoria

System audit log. Every login attempt, password change, and data modification writes a row with tabla_afectada, accion, usuario_cedula, and ip_address.
Additional tables in the schema: proveedores, donaciones, adquisiciones, responsables, and control_perceptivo.

Default seed data

The SQL file inserts the following records automatically: Default admin user
-- cedula: 12345678 | password: Admin123!
INSERT INTO `usuarios` VALUES
('12345678', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',
 'Administrador', 'Sistema', '[email protected]', 'Administrador', 1, NULL, NOW(), NOW());
Default statuses
INSERT INTO `estatus` VALUES
(1, 'Activo',                        'Bien incorporado y operativo',          1, 1, NOW()),
(2, 'En Uso',                        'Bien asignado y en uso normal',         1, 1, NOW()),
(3, 'En Reparacion',                 'Bien temporalmente fuera de servicio',  0, 1, NOW()),
(4, 'Desincorporado',                'Bien dado de baja del inventario',      0, 1, NOW()),
(5, 'Extraviado',                    'Bien no localizado',                    0, 1, NOW()),
(6, 'En Proceso de Desincorporacion','Bien en tramite de baja',               0, 1, NOW());
Sample category
INSERT INTO `categorias` VALUES
(1, 'Mobiliario y Equipo de Oficina', 'MOB-001',
 'Mobiliario general para oficinas', NULL, 1, NOW(), NOW());
Seed dependencias and ubicaciones
INSERT INTO `dependencias` VALUES
(1, 'RECTORÍA - UPTAG',                   '01', 'Administrativa', ...),
(2, 'VICERECTORADO ACADÉMICO',            '02', 'Academica',      ...),
(3, 'OFICINA DE GESTIÓN ADMINISTRATIVA',  '03', 'Administrativa', ...);

INSERT INTO `ubicaciones` VALUES
(1, 1, 'OFICINA DEL RECTOR',              '0101', ...),
(2, 2, 'VICERECTORADO ACADEMICO JEFATURA','0201', ...),
(3, 3, 'OFICINA DE GESTION ADM.',         '0301', ...);
Change the default admin password immediately after the first login. The hash in the seed data is the bcrypt hash for Admin123! using PHP’s PASSWORD_DEFAULT algorithm.

Backup and restore

Create a backup
mysqldump -u root -p bienes_nacionales_uptag > respaldo_$(date +%Y%m%d).sql
Restore from a backup
mysql -u root -p bienes_nacionales_uptag < respaldo_archivo.sql
Schedule daily backups with cron in production environments:
0 2 * * * mysqldump -u root -pYourPassword bienes_nacionales_uptag > /backups/bienes_$(date +\%Y\%m\%d).sql

Exporting from within the system

An administrator can export the database directly from the web interface at Configuración (configuracion.php). This option is only visible to users with the Administrador role, as enforced by header.php:
$es_administrador = ($_SESSION['usuario']['rol'] === 'Administrador');
The export generates and downloads an SQL dump without requiring command-line access.

Build docs developers (and LLMs) love