Diccionario de datos¶
Fuente de persistencia: backend/migrations/*.sql. El catálogo es técnico y no representa datos reales.
schema_migrations¶
| Columna | Tipo | Obligatoria | Restricciones | Descripción |
|---|---|---|---|---|
version |
INTEGER |
sí | PRIMARY KEY | Número de la migración aplicada. |
applied_at |
TIMESTAMPTZ |
sí | NOT NULL DEFAULT CURRENT_TIMESTAMP | Momento en que se aplicó la migración. |
analysis_reports¶
| Columna | Tipo | Obligatoria | Restricciones | Descripción |
|---|---|---|---|---|
id |
UUID |
sí | PRIMARY KEY | Identificador único del reporte de análisis. |
actor_id |
TEXT |
sí | NOT NULL | Identificador de quien ejecutó el análisis. |
project_id |
TEXT |
sí | NOT NULL DEFAULT 'default' | Proyecto al que pertenece el reporte. |
engine |
TEXT |
sí | NOT NULL | Motor analizado (mongodb, couchdb o cassandra). |
resource |
TEXT |
sí | NOT NULL | Recurso analizado (colección, base o tabla). |
risk |
TEXT |
sí | NOT NULL | Nivel de riesgo calculado. |
outcome |
TEXT |
sí | NOT NULL | Resultado general del análisis. |
created_at |
TIMESTAMPTZ |
sí | NOT NULL | Fecha y hora de creación del reporte. |
payload |
JSONB |
sí | NOT NULL | Contenido completo del reporte en JSON. |
audit_events¶
| Columna | Tipo | Obligatoria | Restricciones | Descripción |
|---|---|---|---|---|
id |
BIGSERIAL |
sí | PRIMARY KEY | Identificador secuencial del evento. |
actor_id |
TEXT |
sí | NOT NULL | Identificador de quien realizó la acción. |
action |
TEXT |
sí | NOT NULL | Acción auditada. |
resource |
TEXT |
sí | NOT NULL | Recurso sobre el que se actuó. |
outcome |
TEXT |
sí | NOT NULL | Resultado de la acción. |
correlation_id |
TEXT |
sí | NOT NULL DEFAULT 'legacy' | Identificador de correlación de la solicitud. |
created_at |
TIMESTAMPTZ |
sí | NOT NULL | Fecha y hora del evento. |
Contratos de datos (modelos Pydantic)¶
Fuente: backend/src/schemasafe/core/models.py.
InspectionProvenance¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
contract_version |
str |
no | — |
adapter |
str |
no | — |
adapter_version |
str |
no | — |
source |
InspectionMode |
sí | — |
resource |
str |
no | — |
coverage |
str |
no | — |
collected_at |
datetime |
no | — |
notes |
list[str] |
no | — |
FieldProfile¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
contract_version |
str |
no | — |
path |
str |
no | — |
present_count |
int |
no | — |
missing_count |
int |
no | — |
null_count |
int |
no | — |
type_counts |
dict[str, int] |
no | — |
TableColumn¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
name |
str |
no | — |
data_type |
str |
no | — |
role |
str |
no | — |
position |
int \| None |
no | — |
is_collection |
bool |
no | — |
is_udt |
bool |
no | — |
TableSchema¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
namespace |
str |
no | — |
table |
str |
no | — |
columns |
list[TableColumn] |
no | — |
partition_keys |
list[str] |
no | — |
clustering_keys |
list[str] |
no | — |
collection_columns |
list[str] |
no | — |
udt_columns |
list[str] |
no | — |
InspectionSnapshot¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
contract_version |
str |
no | — |
engine |
Engine |
sí | — |
resource |
str |
no | — |
resource_kind |
ResourceKind |
no | — |
mode |
InspectionMode |
no | — |
evidence_status |
EvidenceStatus |
no | — |
evidence_scope |
EvidenceScope |
no | — |
observation_limit |
int \| None |
no | — |
inspection_duration_ms |
int \| None |
no | — |
records |
list[dict[str, Any]] |
no | — |
total_count |
int \| None |
no | — |
field_profiles |
dict[str, FieldProfile] |
no | — |
table_schema |
TableSchema \| None |
no | — |
indexes |
list[str] |
no | — |
validations |
list[str] |
no | — |
constraints |
list[str] |
no | — |
capabilities |
list[Capability] |
no | — |
capability_version |
str |
no | — |
limitations |
list[str] |
no | — |
limitations_version |
str |
no | — |
provenance |
InspectionProvenance |
sí | — |
inspected_at |
datetime |
no | — |
ChangeProposal¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
operation |
ChangeOperation |
sí | — |
field |
str |
no | — |
target_field |
str \| None |
no | — |
target_type |
str \| None |
no | — |
required |
bool \| None |
no | — |
target_path |
str \| None |
no | — |
description |
str \| None |
no | — |
engine_action |
str \| None |
no | — |
OperationInfo¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
operation |
ChangeOperation |
sí | — |
required_fields |
list[str] |
no | — |
optional_fields |
list[str] |
no | — |
capability |
Capability \| None |
no | — |
description |
str |
sí | — |
AnalysisRequest¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
engine |
Engine |
sí | — |
project_id |
str |
no | — |
resource |
str |
no | — |
proposal |
ChangeProposal |
sí | — |
UserConnection¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
host |
str |
no | — |
port |
int |
no | — |
database |
str |
no | — |
username |
str |
no | — |
password |
SecretStr |
no | — |
tls |
bool |
no | — |
UserConnectionRequest¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
engine |
Engine |
sí | — |
connection |
UserConnection |
sí | — |
UserAnalysisRequest¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
engine |
Engine |
sí | — |
connection |
UserConnection |
sí | — |
resource |
str |
no | — |
proposal |
ChangeProposal |
sí | — |
UserConnectionPolicyInfo¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
enabled |
bool |
sí | — |
tls_required |
bool |
no | — |
read_only |
bool |
no | — |
persisted |
bool |
no | — |
requests_per_minute |
int |
no | — |
Finding¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
rule_id |
str |
sí | — |
severity |
RiskLevel |
sí | — |
message |
str |
sí | — |
evidence |
dict[str, Any] |
no | — |
recommendation |
str |
sí | — |
AnalysisReport¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
contract_version |
str |
no | — |
id |
UUID |
no | — |
actor_id |
str |
sí | — |
project_id |
str |
no | — |
engine |
Engine |
sí | — |
resource |
str |
sí | — |
mode |
str |
sí | — |
proposal |
ChangeProposal |
sí | — |
analyzed_count |
int |
sí | — |
observed_count |
int |
no | — |
denominator |
int \| None |
no | — |
evidence_scope |
EvidenceScope |
no | — |
metric_status |
MetricStatus |
no | — |
observation_limit |
int \| None |
no | — |
inspection_duration_ms |
int \| None |
no | — |
affected_count |
int \| None |
sí | — |
impact_percentage |
float \| None |
sí | — |
risk |
RiskLevel |
sí | — |
outcome |
OverallStatus |
sí | — |
findings |
list[Finding] |
no | — |
limitations |
list[str] |
no | — |
rules_applied |
list[str] |
no | — |
created_at |
datetime |
no | — |
AnalysisSummary¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
contract_version |
str |
no | — |
id |
UUID |
sí | — |
actor_id |
str |
sí | — |
project_id |
str |
no | — |
engine |
Engine |
sí | — |
resource |
str |
sí | — |
risk |
RiskLevel |
sí | — |
outcome |
OverallStatus |
sí | — |
created_at |
datetime |
sí | — |
AnalysisComparison¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
contract_version |
str |
no | — |
first_id |
UUID |
sí | — |
second_id |
UUID |
sí | — |
comparable |
bool |
sí | — |
reasons |
list[str] |
no | — |
affected_delta |
int \| None |
no | — |
impact_delta |
float \| None |
no | — |
risk_changed |
bool |
no | — |
outcome_changed |
bool |
no | — |
AnalysisHistoryFilters¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
engine |
Engine \| None |
no | — |
resource |
str \| None |
no | — |
actor_id |
str \| None |
no | — |
project_id |
str \| None |
no | — |
risk |
RiskLevel \| None |
no | — |
outcome |
OverallStatus \| None |
no | — |
limit |
int |
no | — |
offset |
int |
no | — |
AnalysisHistoryPage¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
contract_version |
str |
no | — |
items |
list[AnalysisSummary] |
no | — |
total |
int |
no | — |
limit |
int |
no | — |
offset |
int |
no | — |
has_more |
bool |
sí | — |
AuditEvent¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
id |
int \| None |
no | — |
actor_id |
str |
no | — |
action |
str |
no | — |
resource |
str |
no | — |
outcome |
str |
no | — |
correlation_id |
str |
no | — |
created_at |
datetime |
no | — |
AuditFilters¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
actor_id |
str \| None |
no | — |
created_from |
datetime \| None |
no | — |
created_to |
datetime \| None |
no | — |
limit |
int |
no | — |
offset |
int |
no | — |
AuditPage¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
contract_version |
str |
no | — |
items |
list[AuditEvent] |
no | — |
total |
int |
no | — |
limit |
int |
no | — |
offset |
int |
no | — |
has_more |
bool |
sí | — |
CapabilityInfo¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
contract_version |
str |
no | — |
engine |
Engine |
sí | — |
capabilities |
list[Capability] |
sí | — |
limitations |
list[str] |
sí | — |
limitations_version |
str |
no | — |
resource_kind |
ResourceKind |
no | — |
mode |
InspectionMode |
no | — |
ConnectionCheck¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
engine |
Engine |
sí | — |
status |
str |
sí | — |
detail |
str |
sí | — |
capabilities |
list[Capability] |
no | — |
limitations |
list[str] |
no | — |
resource_kind |
ResourceKind |
no | — |
mode |
InspectionMode |
no | — |
checked_at |
datetime \| None |
no | — |
ReadinessDependency¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
status |
str |
sí | — |
ready |
bool |
sí | — |
mode |
str |
sí | — |
detail |
str |
sí | — |
checked_at |
datetime |
sí | — |
ReadinessResponse¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
contract_version |
str |
no | — |
status |
str |
sí | — |
service |
str |
sí | — |
environment |
str |
sí | — |
mode |
str |
sí | — |
dependencies |
dict[str, ReadinessDependency] |
sí | — |
correlation_id |
str |
sí | — |
MetricsSnapshot¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
contract_version |
str |
no | — |
service |
str |
sí | — |
uptime_seconds |
float |
no | — |
requests |
dict[str, Any] |
sí | — |
adapters |
dict[str, Any] |
sí | — |
cache |
dict[str, Any] |
no | — |
UsageFilters¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
engine |
Engine \| None |
no | — |
mode |
InspectionMode \| None |
no | — |
created_from |
datetime \| None |
no | — |
created_to |
datetime \| None |
no | — |
UsageSummary¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
contract_version |
str |
no | — |
period_from |
datetime \| None |
no | — |
period_to |
datetime \| None |
no | — |
total_analyses |
int |
no | — |
by_engine |
dict[str, int] |
no | — |
by_risk |
dict[str, int] |
no | — |
by_outcome |
dict[str, int] |
no | — |
by_mode |
dict[str, int] |
no | — |
connection_errors |
int |
no | — |
permission_errors |
int |
no | — |
report_exports |
int |
no | — |
average_latency_ms |
float \| None |
no | — |
p95_latency_ms |
float \| None |
no | — |
backend |
dict[str, Any] |
no | — |
limitations |
list[str] |
no | — |
ResourceDiscovery¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
contract_version |
str |
no | — |
engine |
Engine |
sí | — |
status |
str |
sí | — |
resources |
list[str] |
no | — |
databases |
list[str] |
no | — |
collections |
dict[str, list[str]] |
no | — |
tables |
dict[str, list[str]] |
no | — |
capabilities |
list[Capability] |
no | — |
limitations |
list[str] |
no | — |
resource_kind |
ResourceKind |
no | — |
mode |
InspectionMode |
no | — |
checked_at |
datetime \| None |
no | — |
UserConnectionDiscovery¶
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
connection |
ConnectionCheck |
sí | — |
resources |
ResourceDiscovery |
sí | — |
Enumeraciones¶
Engine:MONGODB='mongodb',COUCHDB='couchdb',CASSANDRA='cassandra'.InspectionMode:FIXTURE='fixture',LIVE='live',FIXTURE_FALLBACK='fixture-fallback'.EvidenceStatus:COMPLETE='complete',INCOMPLETE='incomplete'.EvidenceScope:EXACT='exact',SAMPLE='sample',INCOMPLETE='incomplete'.MetricStatus:EXACT='exact',UNAVAILABLE='unavailable'.ResourceKind:DOCUMENT='document',TABLE='table',UNKNOWN='unknown'.ChangeOperation:ADD_FIELD='add_field',REMOVE_FIELD='remove_field',RENAME_FIELD='rename_field',CHANGE_TYPE='change_type',REQUIRE_FIELD='require_field',CHANGE_NESTING='change_nesting',ADD_INDEX='add_index',REMOVE_INDEX='remove_index',ADD_VALIDATION='add_validation',REMOVE_VALIDATION='remove_validation',TIGHTEN_CONSTRAINT='tighten_constraint',RELAX_CONSTRAINT='relax_constraint',CHANGE_ARRAY_SHAPE='change_array_shape',CHANGE_NULLABILITY='change_nullability',ENGINE_SPECIFIC='engine_specific'.RiskLevel:LOW='BAJO',MEDIUM='MEDIO',HIGH='ALTO',CRITICAL='CRÍTICO'.OverallStatus:APPROVED='APROBADO',REVIEW='REQUIERE REVISIÓN',NOT_RECOMMENDED='NO RECOMENDADO'.Capability:FIELD_TYPES='field_types',REQUIREDNESS='requiredness',NESTING='nesting',INDEXES='indexes',VALIDATIONS='validations',CONSTRAINTS='constraints',CONNECTION='connection',ENGINE_SPECIFIC='engine_specific'.
Coherencia entre la migración SQL y Liquibase¶
| Tabla | Columnas en backend/migrations/ |
Columnas en Liquibase | Estado |
|---|---|---|---|
schema_migrations |
applied_at, version | applied_at, version | coincide |
analysis_reports |
actor_id, created_at, engine, id, outcome, payload, project_id, resource, risk | actor_id, created_at, engine, id, outcome, payload, project_id, resource, risk | coincide |
audit_events |
action, actor_id, correlation_id, created_at, id, outcome, resource | action, actor_id, correlation_id, created_at, id, outcome, resource | coincide |
Procedencia y límites¶
analysis_reportsconserva el resumen y el payload del análisis; no contiene una copia declarada de una base productiva.audit_eventsconserva acciones sanitizadas con actor, recurso, resultado y correlación.schema_migrationspermite aplicar la versión de esquema de forma reproducible.- SQLite y PostgreSQL implementan el mismo contrato
ReportStore; el análisis nunca escribe en los motores inspeccionados.