Skip to main content
The Sistema de Bienes Nacionales UPTAG uses a single MySQL database named bienes_nacionales_uptag. The schema contains 13 tables organized around the central bienes table. All tables use the InnoDB engine with utf8mb4_general_ci collation.

Entity Relationship Overview

usuarios
  └── auditoria          (usuario_cedula → usuarios.cedula)
  └── movimientos        (usuario_registro → usuarios.cedula)

categorias (self-ref)    (categoria_padre_id → categorias.id)
  └── bienes             (categoria_id → categorias.id)

estatus
  └── bienes             (estatus_id → estatus.id)

dependencias
  └── ubicaciones        (dependencia_id → dependencias.id)
  └── responsables       (dependencia_id → dependencias.id)

ubicaciones
  └── bienes             (ubicacion_id → ubicaciones.id)
  └── movimientos        (ubicacion_origen_id, ubicacion_destino_id → ubicaciones.id)
  └── responsables       (ubicacion_id → ubicaciones.id)
  └── control_perceptivo (ubicacion_fisica_verificada_id → ubicaciones.id)

proveedores
  └── adquisiciones      (proveedor_id → proveedores.id)

donaciones
  └── bienes             (donacion_id → donaciones.id)

adquisiciones
  └── bienes             (adquisicion_id → adquisiciones.id)

responsables
  └── movimientos        (responsable_origen_id, responsable_destino_id → responsables.id)
  └── control_perceptivo (responsable_verificado_id → responsables.id)

bienes                   ← central table
  └── movimientos        (bien_id → bienes.id)
  └── control_perceptivo (bien_id → bienes.id)
Tables are created in dependency order. Drop in reverse order to avoid FK violations.

Tables

Stores all system user accounts. cedula (national ID number) is used as the primary key and login credential.
CREATE TABLE `usuarios` (
  `cedula`               varchar(20)  NOT NULL,
  `password_hash`        varchar(255) NOT NULL,
  `nombres`              varchar(100) NOT NULL,
  `apellidos`            varchar(100) NOT NULL,
  `email`                varchar(100) DEFAULT NULL,
  `rol`                  enum('Administrador','Usuario') NOT NULL,
  `activo`               tinyint(1)   DEFAULT 1,
  `ultimo_acceso`        timestamp    NULL DEFAULT NULL,
  `fecha_creacion`       timestamp    NOT NULL DEFAULT current_timestamp(),
  `fecha_actualizacion`  timestamp    NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`cedula`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
ColumnTypeNullableDefaultDescription
cedulavarchar(20)NoNational ID number; primary key and login username
password_hashvarchar(255)Nobcrypt hash generated with password_hash($clave, PASSWORD_DEFAULT)
nombresvarchar(100)NoFirst name(s)
apellidosvarchar(100)NoLast name(s)
emailvarchar(100)YesNULLContact email address
rolenumNoEither Administrador or Usuario
activotinyint(1)Yes1Soft-delete flag; 0 disables login
ultimo_accesotimestampYesNULLTimestamp of last successful login (set by application)
fecha_creaciontimestampNocurrent_timestamp()Record creation time
fecha_actualizaciontimestampNocurrent_timestamp()Auto-updated on any change
Keys
  • PRIMARY KEY (cedula)
Seed data — one default admin is inserted with cedula = 12345678, rol = Administrador.
Holds the classification taxonomy for assets. A category may optionally have a parent category, forming a tree hierarchy (e.g., “Mobiliario” → “Sillas”).
CREATE TABLE `categorias` (
  `id`                   int(11)      NOT NULL AUTO_INCREMENT,
  `nombre`               varchar(100) NOT NULL,
  `codigo`               varchar(20)  DEFAULT NULL,
  `descripcion`          text         DEFAULT NULL,
  `categoria_padre_id`   int(11)      DEFAULT NULL,
  `activo`               tinyint(1)   DEFAULT 1,
  `fecha_creacion`       timestamp    NOT NULL DEFAULT current_timestamp(),
  `fecha_actualizacion`  timestamp    NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_categoria_codigo` (`codigo`),
  KEY `categoria_padre_id` (`categoria_padre_id`),
  CONSTRAINT `categorias_ibfk_1`
    FOREIGN KEY (`categoria_padre_id`) REFERENCES `categorias` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
ColumnTypeNullableDefaultDescription
idint(11)NoAUTO_INCREMENTSurrogate primary key
nombrevarchar(100)NoCategory display name
codigovarchar(20)YesNULLShort classification code (e.g. MOB-001); must be unique
descripciontextYesNULLFree-text description
categoria_padre_idint(11)YesNULLSelf-referential FK; NULL means root-level category
activotinyint(1)Yes1Soft-delete flag
fecha_creaciontimestampNocurrent_timestamp()Record creation time
fecha_actualizaciontimestampNocurrent_timestamp()Auto-updated on any change
Keys
  • PRIMARY KEY (id)
  • UNIQUE KEY uk_categoria_codigo (codigo)
  • FOREIGN KEY (categoria_padre_id) → categorias(id) ON DELETE SET NULL
Lookup table for the lifecycle state of each asset. The permite_movimiento flag controls whether an asset in this status can be moved or reassigned.
CREATE TABLE `estatus` (
  `id`                  int(11)      NOT NULL AUTO_INCREMENT,
  `nombre`              varchar(50)  NOT NULL,
  `descripcion`         text         DEFAULT NULL,
  `permite_movimiento`  tinyint(1)   DEFAULT 1,
  `activo`              tinyint(1)   DEFAULT 1,
  `fecha_creacion`      timestamp    NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_estatus_nombre` (`nombre`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
ColumnTypeNullableDefaultDescription
idint(11)NoAUTO_INCREMENTSurrogate primary key
nombrevarchar(50)NoStatus label; must be unique
descripciontextYesNULLHuman-readable explanation
permite_movimientotinyint(1)Yes11 = asset can be transferred; 0 = movement blocked
activotinyint(1)Yes1Soft-delete flag
fecha_creaciontimestampNocurrent_timestamp()Record creation time
Keys
  • PRIMARY KEY (id)
  • UNIQUE KEY uk_estatus_nombre (nombre)
Seed data
idnombrepermite_movimiento
1Activo1
2En Uso1
3En Reparacion0
4Desincorporado0
5Extraviado0
6En Proceso de Desincorporacion0
Represents the organizational units of UPTAG (rectoría, vice-rectorados, oficinas, PNFs, laboratorios, etc.). Each ubicacion belongs to exactly one dependencia.
CREATE TABLE `dependencias` (
  `id`                   int(11)      NOT NULL AUTO_INCREMENT,
  `nombre`               varchar(150) NOT NULL,
  `codigo`               varchar(20)  DEFAULT NULL,
  `tipo`                 enum('Administrativa','Academica','PNF','Laboratorio','Otra') DEFAULT 'Otra',
  `responsable_nombre`   varchar(150) DEFAULT NULL,
  `responsable_cedula`   varchar(20)  DEFAULT NULL,
  `direccion`            varchar(255) DEFAULT NULL,
  `ciudad`               varchar(100) DEFAULT NULL,
  `estado`               varchar(100) DEFAULT NULL,
  `activo`               tinyint(1)   DEFAULT 1,
  `fecha_creacion`       timestamp    NOT NULL DEFAULT current_timestamp(),
  `fecha_actualizacion`  timestamp    NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_dependencia_codigo` (`codigo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
ColumnTypeNullableDefaultDescription
idint(11)NoAUTO_INCREMENTSurrogate primary key
nombrevarchar(150)NoFull name of the department
codigovarchar(20)YesNULLShort code (e.g. 01); must be unique
tipoenumYes'Otra'Classification: Administrativa, Academica, PNF, Laboratorio, or Otra
responsable_nombrevarchar(150)YesNULLName of the department head
responsable_cedulavarchar(20)YesNULLNational ID of the department head
direccionvarchar(255)YesNULLPhysical address
ciudadvarchar(100)YesNULLCity
estadovarchar(100)YesNULLVenezuelan state
activotinyint(1)Yes1Soft-delete flag
fecha_creaciontimestampNocurrent_timestamp()Record creation time
fecha_actualizaciontimestampNocurrent_timestamp()Auto-updated on any change
Keys
  • PRIMARY KEY (id)
  • UNIQUE KEY uk_dependencia_codigo (codigo)
Represents specific physical spaces (offices, rooms, labs) within a dependencia. The columns responsable, telefono, and email were added via agregar_columnas_ubicaciones.sql.
CREATE TABLE `ubicaciones` (
  `id`                   int(11)      NOT NULL AUTO_INCREMENT,
  `dependencia_id`       int(11)      NOT NULL,
  `nombre`               varchar(150) NOT NULL,
  `descripcion`          text         DEFAULT NULL,
  `responsable`          varchar(200) DEFAULT NULL,   -- added via ALTER TABLE
  `telefono`             varchar(50)  DEFAULT NULL,   -- added via ALTER TABLE
  `email`                varchar(100) DEFAULT NULL,   -- added via ALTER TABLE
  `activo`               tinyint(1)   DEFAULT 1,
  `fecha_creacion`       timestamp    NOT NULL DEFAULT current_timestamp(),
  `fecha_actualizacion`  timestamp    NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `dependencia_id` (`dependencia_id`),
  CONSTRAINT `ubicaciones_ibfk_1`
    FOREIGN KEY (`dependencia_id`) REFERENCES `dependencias` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
ColumnTypeNullableDefaultDescription
idint(11)NoAUTO_INCREMENTSurrogate primary key
dependencia_idint(11)NoFK → dependencias.id; every location belongs to one department
nombrevarchar(150)NoLocation name (e.g. OFICINA DEL RECTOR)
descripciontextYesNULLAdditional description or internal code
responsablevarchar(200)YesNULLName of the person responsible for this location
telefonovarchar(50)YesNULLContact phone number
emailvarchar(100)YesNULLContact email
activotinyint(1)Yes1Soft-delete flag
fecha_creaciontimestampNocurrent_timestamp()Record creation time
fecha_actualizaciontimestampNocurrent_timestamp()Auto-updated on any change
Keys
  • PRIMARY KEY (id)
  • FOREIGN KEY (dependencia_id) → dependencias(id)
The responsable, telefono, and email columns were added after initial creation via agregar_columnas_ubicaciones.sql. They are already included in the main schema when using the latest bd_bienes_nacionales.sql.
This is the core table of the system. Every inventoried asset has exactly one row here. It references categorias, ubicaciones, adquisiciones, donaciones, and estatus.
CREATE TABLE `bienes` (
  `id`                         int(11)        NOT NULL AUTO_INCREMENT,
  `codigo_bien_nacional`       varchar(50)    NOT NULL,
  `codigo_anterior`            varchar(50)    DEFAULT NULL,
  `categoria_id`               int(11)        NOT NULL,
  `ubicacion_id`               int(11)        DEFAULT NULL,
  `adquisicion_id`             int(11)        DEFAULT NULL,
  `donacion_id`                int(11)        DEFAULT NULL,
  `descripcion`                text           NOT NULL,
  `marca`                      varchar(100)   DEFAULT NULL,
  `modelo`                     varchar(100)   DEFAULT NULL,
  `serial`                     varchar(100)   DEFAULT NULL,
  `color`                      varchar(50)    DEFAULT NULL,
  `dimensiones`                varchar(100)   DEFAULT NULL,
  `valor_adquisicion`          decimal(18,2)  DEFAULT NULL,
  `valor_actual`               decimal(18,2)  DEFAULT NULL,
  `vida_util_anos`             int(11)        DEFAULT NULL,
  `estatus_id`                 int(11)        NOT NULL,
  `observaciones`              text           DEFAULT NULL,
  `fecha_incorporacion`        date           NOT NULL,
  `fecha_desincorporacion`     date           DEFAULT NULL,
  `motivo_desincorporacion`    text           DEFAULT NULL,
  `documento_desincorporacion` varchar(255)   DEFAULT NULL,
  `activo`                     tinyint(1)     DEFAULT 1,
  `fecha_creacion`             timestamp      NOT NULL DEFAULT current_timestamp(),
  `fecha_actualizacion`        timestamp      NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_codigo_bien` (`codigo_bien_nacional`),
  KEY `categoria_id`    (`categoria_id`),
  KEY `adquisicion_id`  (`adquisicion_id`),
  KEY `donacion_id`     (`donacion_id`),
  KEY `estatus_id`      (`estatus_id`),
  KEY `idx_ubicacion_id`(`ubicacion_id`),
  CONSTRAINT `bienes_ibfk_1` FOREIGN KEY (`categoria_id`)   REFERENCES `categorias`   (`id`),
  CONSTRAINT `bienes_ibfk_2` FOREIGN KEY (`adquisicion_id`) REFERENCES `adquisiciones` (`id`) ON DELETE SET NULL,
  CONSTRAINT `bienes_ibfk_3` FOREIGN KEY (`donacion_id`)    REFERENCES `donaciones`    (`id`) ON DELETE SET NULL,
  CONSTRAINT `bienes_ibfk_4` FOREIGN KEY (`estatus_id`)     REFERENCES `estatus`       (`id`),
  CONSTRAINT `fk_bienes_ubicacion` FOREIGN KEY (`ubicacion_id`) REFERENCES `ubicaciones` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
ColumnTypeNullableDefaultDescription
idint(11)NoAUTO_INCREMENTSurrogate primary key
codigo_bien_nacionalvarchar(50)NoOfficial national asset code; must be unique
codigo_anteriorvarchar(50)YesNULLLegacy code from a prior system
categoria_idint(11)NoFK → categorias.id; required
ubicacion_idint(11)YesNULLFK → ubicaciones.id; NULL if location unknown
adquisicion_idint(11)YesNULLFK → adquisiciones.id; set when acquired by purchase or transfer
donacion_idint(11)YesNULLFK → donaciones.id; set when asset came via donation
descripciontextNoFull description of the asset
marcavarchar(100)YesNULLManufacturer brand
modelovarchar(100)YesNULLModel name or number
serialvarchar(100)YesNULLSerial number
colorvarchar(50)YesNULLPrimary color
dimensionesvarchar(100)YesNULLPhysical dimensions (free text)
valor_adquisiciondecimal(18,2)YesNULLOriginal acquisition value in BsF/USD
valor_actualdecimal(18,2)YesNULLCurrent estimated value
vida_util_anosint(11)YesNULLExpected useful life in years
estatus_idint(11)NoFK → estatus.id; required
observacionestextYesNULLFree-text notes
fecha_incorporaciondateNoDate the asset was formally incorporated
fecha_desincorporaciondateYesNULLDate the asset was decommissioned
motivo_desincorporaciontextYesNULLReason for decommissioning
documento_desincorporacionvarchar(255)YesNULLFile path or reference number of decommission document
activotinyint(1)Yes1Soft-delete flag
fecha_creaciontimestampNocurrent_timestamp()Record creation time
fecha_actualizaciontimestampNocurrent_timestamp()Auto-updated on any change
Keys
  • PRIMARY KEY (id)
  • UNIQUE KEY uk_codigo_bien (codigo_bien_nacional)
  • FOREIGN KEY (categoria_id) → categorias(id) — required, no cascade
  • FOREIGN KEY (estatus_id) → estatus(id) — required, no cascade
  • FOREIGN KEY (ubicacion_id) → ubicaciones(id) ON DELETE SET NULL
  • FOREIGN KEY (adquisicion_id) → adquisiciones(id) ON DELETE SET NULL
  • FOREIGN KEY (donacion_id) → donaciones(id) ON DELETE SET NULL
codigo_bien_nacional has a unique constraint. Attempting to insert a duplicate value will produce a MySQL error 1062 Duplicate entry. Always validate this field before inserting.
Records every movement event for an asset: incorporations, transfers, decommissions, assignments, repairs, and returns. All movements are append-only — no rows are ever updated.
CREATE TABLE `movimientos` (
  `id`                      int(11)  NOT NULL AUTO_INCREMENT,
  `bien_id`                 int(11)  NOT NULL,
  `tipo_movimiento`         enum('Incorporacion','Traslado','Desincorporacion','Asignacion','Reparacion','Devolucion') NOT NULL,
  `ubicacion_origen_id`     int(11)  DEFAULT NULL,
  `ubicacion_destino_id`    int(11)  DEFAULT NULL,
  `responsable_origen_id`   int(11)  DEFAULT NULL,
  `responsable_destino_id`  int(11)  DEFAULT NULL,
  `fecha_movimiento`        date     NOT NULL,
  `razon`                   text     NOT NULL,
  `numero_documento`        varchar(50)  DEFAULT NULL,
  `observaciones`           text     DEFAULT NULL,
  `usuario_registro`        varchar(20)  DEFAULT NULL,
  `fecha_creacion`          timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  CONSTRAINT `movimientos_ibfk_1` FOREIGN KEY (`bien_id`)                REFERENCES `bienes`       (`id`),
  CONSTRAINT `movimientos_ibfk_2` FOREIGN KEY (`ubicacion_origen_id`)    REFERENCES `ubicaciones`  (`id`) ON DELETE SET NULL,
  CONSTRAINT `movimientos_ibfk_3` FOREIGN KEY (`ubicacion_destino_id`)   REFERENCES `ubicaciones`  (`id`) ON DELETE SET NULL,
  CONSTRAINT `movimientos_ibfk_4` FOREIGN KEY (`responsable_origen_id`)  REFERENCES `responsables` (`id`) ON DELETE SET NULL,
  CONSTRAINT `movimientos_ibfk_5` FOREIGN KEY (`responsable_destino_id`) REFERENCES `responsables` (`id`) ON DELETE SET NULL,
  CONSTRAINT `movimientos_ibfk_6` FOREIGN KEY (`usuario_registro`)       REFERENCES `usuarios`     (`cedula`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
ColumnTypeNullableDefaultDescription
idint(11)NoAUTO_INCREMENTSurrogate primary key
bien_idint(11)NoFK → bienes.id; the asset being moved
tipo_movimientoenumNoOne of: Incorporacion, Traslado, Desincorporacion, Asignacion, Reparacion, Devolucion
ubicacion_origen_idint(11)YesNULLFK → ubicaciones.id; origin location
ubicacion_destino_idint(11)YesNULLFK → ubicaciones.id; destination location
responsable_origen_idint(11)YesNULLFK → responsables.id; person releasing the asset
responsable_destino_idint(11)YesNULLFK → responsables.id; person receiving the asset
fecha_movimientodateNoDate the movement occurred
razontextNoReason or justification for the movement
numero_documentovarchar(50)YesNULLSupporting document or memo number
observacionestextYesNULLAdditional notes
usuario_registrovarchar(20)YesNULLFK → usuarios.cedula; who recorded this movement
fecha_creaciontimestampNocurrent_timestamp()Record creation time
Keys
  • PRIMARY KEY (id)
  • FOREIGN KEY (bien_id) → bienes(id) — required, no cascade
  • FOREIGN KEY (ubicacion_origen_id) → ubicaciones(id) ON DELETE SET NULL
  • FOREIGN KEY (ubicacion_destino_id) → ubicaciones(id) ON DELETE SET NULL
  • FOREIGN KEY (responsable_origen_id) → responsables(id) ON DELETE SET NULL
  • FOREIGN KEY (responsable_destino_id) → responsables(id) ON DELETE SET NULL
  • FOREIGN KEY (usuario_registro) → usuarios(cedula) ON DELETE SET NULL
Immutable log of all data-modifying events in the system, including login attempts. Written via prepared statements in application code — never modified after insertion.
CREATE TABLE `auditoria` (
  `id`               int(11)      NOT NULL AUTO_INCREMENT,
  `tabla_afectada`   varchar(50)  NOT NULL,
  `accion`           enum('INSERT','UPDATE','DELETE') NOT NULL,
  `usuario_cedula`   varchar(20)  DEFAULT NULL,
  `datos_anteriores` varchar(2000) DEFAULT NULL,
  `datos_nuevos`     varchar(2000) DEFAULT NULL,
  `ip_address`       varchar(45)  DEFAULT NULL,
  `fecha_accion`     timestamp    NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `usuario_cedula` (`usuario_cedula`),
  CONSTRAINT `auditoria_ibfk_1`
    FOREIGN KEY (`usuario_cedula`) REFERENCES `usuarios` (`cedula`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
ColumnTypeNullableDefaultDescription
idint(11)NoAUTO_INCREMENTSurrogate primary key
tabla_afectadavarchar(50)NoName of the table the action targeted (e.g. usuarios, bienes)
accionenumNoType of change: INSERT, UPDATE, or DELETE
usuario_cedulavarchar(20)YesNULLFK → usuarios.cedula; NULL if user was deleted
datos_anterioresvarchar(2000)YesNULLJSON snapshot of data before the change
datos_nuevosvarchar(2000)YesNULLJSON snapshot of data after the change (also used for login event payloads)
ip_addressvarchar(45)YesNULLIPv4 or IPv6 address of the request; supports up to 45 chars for IPv6
fecha_acciontimestampNocurrent_timestamp()Timestamp of the event
Keys
  • PRIMARY KEY (id)
  • FOREIGN KEY (usuario_cedula) → usuarios(cedula) ON DELETE SET NULL
Login events (successful and failed) are stored with tabla_afectada = 'usuarios' and accion = 'INSERT'. The datos_nuevos column holds a JSON payload such as {"accion": "inicio_sesion_exitoso"} or {"intento": "sesion_fallida", "motivo": "credenciales_incorrectas"}.
Stores supplier records used when registering purchases via adquisiciones.
ColumnTypeNullableDefaultDescription
idint(11)NoAUTO_INCREMENTSurrogate primary key
razon_socialvarchar(200)NoLegal name of the supplier
rifvarchar(20)YesNULLTax ID (RIF); must be unique
direccionvarchar(255)YesNULLAddress
telefonovarchar(50)YesNULLPhone number
emailvarchar(100)YesNULLEmail
contacto_nombrevarchar(150)YesNULLContact person’s name
tipo_proveedorenumNoOficina de Compras or Ingreso por parte de la Universidad
activotinyint(1)Yes1Soft-delete flag
fecha_creaciontimestampNocurrent_timestamp()Record creation time
fecha_actualizaciontimestampNocurrent_timestamp()Auto-updated on any change
Keys
  • PRIMARY KEY (id)
  • UNIQUE KEY uk_proveedor_rif (rif)
Tracks donation records. A bien can link to a donacion via bienes.donacion_id to record that it was received as a gift.
ColumnTypeNullableDefaultDescription
idint(11)NoAUTO_INCREMENTSurrogate primary key
donante_nombrevarchar(200)NoName of the donor
donante_rifvarchar(20)YesNULLDonor’s RIF (if legal entity)
donante_cedulavarchar(20)YesNULLDonor’s national ID (if natural person)
donante_direccionvarchar(255)YesNULLDonor address
donante_telefonovarchar(50)YesNULLDonor phone
donante_emailvarchar(100)YesNULLDonor email
fecha_donaciondateNoDate the donation was received
tipo_donanteenumNoPersona Natural, Persona Juridica, or Institucion
documento_soportevarchar(255)YesNULLFile path to supporting document
observacionestextYesNULLNotes
fecha_creaciontimestampNocurrent_timestamp()Record creation time
fecha_actualizaciontimestampNocurrent_timestamp()Auto-updated on any change
Keys
  • PRIMARY KEY (id)
Records the procurement event for an asset (purchase, own-income, or transfer). Linked to proveedores and referenced by bienes.adquisicion_id.
ColumnTypeNullableDefaultDescription
idint(11)NoAUTO_INCREMENTSurrogate primary key
tipo_adquisicionenumNoCompra, Ingreso Propio, or Traspaso
proveedor_idint(11)YesNULLFK → proveedores.id; NULL for own-income acquisitions
numero_facturavarchar(50)YesNULLInvoice number
numero_orden_compravarchar(50)YesNULLPurchase order number
fecha_adquisiciondateNoAcquisition date
monto_totaldecimal(18,2)YesNULLTotal amount paid
observacionestextYesNULLNotes
documento_soportevarchar(255)YesNULLFile path to supporting document
fecha_creaciontimestampNocurrent_timestamp()Record creation time
fecha_actualizaciontimestampNocurrent_timestamp()Auto-updated on any change
Keys
  • PRIMARY KEY (id)
  • FOREIGN KEY (proveedor_id) → proveedores(id) ON DELETE SET NULL
Stores people responsible for assets or locations. The ubicacion_id column was added via agregar_fk_responsables_ubicaciones.sql.
ColumnTypeNullableDefaultDescription
idint(11)NoAUTO_INCREMENTSurrogate primary key
cedulavarchar(20)NoNational ID; must be unique
nombresvarchar(100)NoFirst name(s)
apellidosvarchar(100)NoLast name(s)
cargovarchar(100)YesNULLJob title or position
dependencia_idint(11)YesNULLFK → dependencias.id
ubicacion_idint(11)YesNULLFK → ubicaciones.id; added via migration
telefonovarchar(50)YesNULLPhone number
emailvarchar(100)YesNULLEmail
activotinyint(1)Yes1Soft-delete flag
fecha_creaciontimestampNocurrent_timestamp()Record creation time
fecha_actualizaciontimestampNocurrent_timestamp()Auto-updated on any change
Keys
  • PRIMARY KEY (id)
  • UNIQUE KEY uk_responsable_cedula (cedula)
  • FOREIGN KEY (dependencia_id) → dependencias(id) ON DELETE SET NULL
  • FOREIGN KEY (ubicacion_id) → ubicaciones(id) ON DELETE SET NULL (via fk_responsables_ubicacion)
Records periodic physical inspections of assets, capturing their condition and verified location at a point in time.
ColumnTypeNullableDefaultDescription
idint(11)NoAUTO_INCREMENTSurrogate primary key
bien_idint(11)NoFK → bienes.id; asset being inspected
fecha_controldateNoDate of the inspection
ubicacion_fisica_verificada_idint(11)YesNULLFK → ubicaciones.id; where the asset was physically found
responsable_verificado_idint(11)YesNULLFK → responsables.id; custodian at time of inspection
condicionenumNoExcelente, Bueno, Regular, Malo, or No Localizado
observacionestextYesNULLNotes from the inspector
verificador_nombrevarchar(150)YesNULLName of the inspector
verificador_cedulavarchar(20)YesNULLNational ID of the inspector
firma_digitalvarchar(255)YesNULLPath or hash for digital signature
fecha_creaciontimestampNocurrent_timestamp()Record creation time
Keys
  • PRIMARY KEY (id)
  • FOREIGN KEY (bien_id) → bienes(id)
  • FOREIGN KEY (ubicacion_fisica_verificada_id) → ubicaciones(id) ON DELETE SET NULL
  • FOREIGN KEY (responsable_verificado_id) → responsables(id) ON DELETE SET NULL

Build docs developers (and LLMs) love