Especificación Técnica: mae_personas¶
Esquema: core.identidad
Base de Datos: core
Servicio: svc-identidad
Tabla Legacy Origen: core_sigfa.mae_personas
Propósito: Maestro de personas naturales (cédula) del núcleo. Hereda de mae_entidades (patrón party).
1. Justificación y Mejoras de Arquitectura¶
- Hereda de
mae_entidades(joined table inheritance): suides el mismo de la entidad padre y no genera UUID propio (sinDEFAULT gen_random_uuid()). - Cada fila de
mae_personastiene su fila enmae_entidadescontipo_entidad = 'PERSONA_NATURAL'. - Identificación y género referenciados por UUID al modelo de catálogos.
- Registro de nacimiento y contacto en un único maestro.
- Evolución del legacy
core_sigfa.mae_personasencore.identidad.
2. Definiciones de Implementación¶
Table core.identidad.mae_personas {
id uuid [pk, ref: > mae_entidades.id]
tipo_identificacion_id uuid [ref: > cat_tipos_identificacion.id]
identificacion varchar(20) [not null]
nombres varchar(100) [not null]
apellidos varchar(100) [not null]
fecha_nacimiento date
genero_id uuid [ref: > cat_generos.id]
email varchar(150)
telefono varchar(20)
direccion varchar(300)
// Auditoría General
is_activo boolean [not null, default: `true`, note: 'Estado lógico del registro']
created_at timestamptz [not null, default: `now()`, note: 'Fecha de creación']
updated_at timestamptz [not null, default: `now()`, note: 'Fecha de última actualización']
deleted_at timestamptz [note: 'Fecha de eliminación lógica']
created_by uuid [note: 'Usuario creador']
updated_by uuid [note: 'Usuario modificador']
Indexes {
(identificacion) [unique, name: 'uq_mae_personas_identificacion']
}
}
CREATE TABLE IF NOT EXISTS core.identidad.mae_personas (
id UUID NOT NULL PRIMARY KEY,
tipo_identificacion_id UUID,
identificacion VARCHAR(20) NOT NULL,
nombres VARCHAR(100) NOT NULL,
apellidos VARCHAR(100) NOT NULL,
fecha_nacimiento DATE,
genero_id UUID,
email VARCHAR(150),
telefono VARCHAR(20),
direccion VARCHAR(300),
-- Auditoría General
is_activo BOOLEAN NOT NULL DEFAULT true,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
deleted_at TIMESTAMPTZ,
created_by UUID,
updated_by UUID,
CONSTRAINT uq_mae_personas_identificacion UNIQUE (identificacion),
CONSTRAINT fk_mae_personas_entidad FOREIGN KEY (id) REFERENCES core.identidad.mae_entidades (id),
CONSTRAINT fk_mae_personas_tipo_identificacion FOREIGN KEY (tipo_identificacion_id) REFERENCES core.identidad.cat_tipos_identificacion (id),
CONSTRAINT fk_mae_personas_genero FOREIGN KEY (genero_id) REFERENCES core.identidad.cat_generos (id)
);
-- Comentarios
COMMENT ON COLUMN core.identidad.mae_personas.id IS 'Mismo id de mae_entidades (herencia de tabla)';
COMMENT ON COLUMN core.identidad.mae_personas.tipo_identificacion_id IS 'Tipo de identificación';
COMMENT ON COLUMN core.identidad.mae_personas.identificacion IS 'Número de identificación';
COMMENT ON COLUMN core.identidad.mae_personas.nombres IS 'Nombres de la persona';
COMMENT ON COLUMN core.identidad.mae_personas.apellidos IS 'Apellidos de la persona';
COMMENT ON COLUMN core.identidad.mae_personas.fecha_nacimiento IS 'Fecha de nacimiento';
COMMENT ON COLUMN core.identidad.mae_personas.genero_id IS 'Género de la persona';
COMMENT ON COLUMN core.identidad.mae_personas.email IS 'Correo electrónico';
COMMENT ON COLUMN core.identidad.mae_personas.telefono IS 'Teléfono';
COMMENT ON COLUMN core.identidad.mae_personas.direccion IS 'Dirección';