fix: no inyectar campos de auditoria en tablas raw (ignoreSchema)
buildSetClause añadia siempre updatedDate/updatedByUserNum (y en inserts createdDate/createdByUserNum), pero las tablas raw que se escriben con ignoreSchema (aux_plg_config, uploads, traducciones...) no tienen esas columnas y el INSERT/UPDATE moria con Unknown column — p.ej. guardar la config de un plugin desde el dashboard fallaba con 'No se pudo guardar la configuracion en la base de datos'. Se replica la semantica del CocoDB legacy: prepareBaseSQL solo añadia auditoria y defaults cuando habia schema cargado.
This commit is contained in:
@@ -1337,9 +1337,15 @@ class AcaiAPI
|
||||
$params = [];
|
||||
$uploadFields = [];
|
||||
|
||||
// ── Audit fields — always written, not overridable by the caller ──
|
||||
// ── Audit fields — not overridable by the caller ─────────────────
|
||||
// Solo con esquema: las tablas raw (ignoreSchema — uploads,
|
||||
// traducciones, aux_*...) no tienen columnas de auditoria y el
|
||||
// INSERT/UPDATE reventaria con "Unknown column". Misma semantica que
|
||||
// CocoDB legacy (prepareBaseSQL solo añadia estos campos con schema).
|
||||
if (!$ignoreSchema) {
|
||||
$setParts[] = '`updatedDate` = ?'; $params[] = $now;
|
||||
$setParts[] = '`updatedByUserNum` = ?'; $params[] = $user;
|
||||
}
|
||||
|
||||
// ── INSERT-only defaults ──────────────────────────────────────────
|
||||
if ($isInsert) {
|
||||
@@ -1351,11 +1357,11 @@ class AcaiAPI
|
||||
$setParts[] = '`num` = NULL';
|
||||
}
|
||||
|
||||
if (!isset($record['createdDate'])) {
|
||||
if (!$ignoreSchema && !isset($record['createdDate'])) {
|
||||
$setParts[] = '`createdDate` = ?';
|
||||
$params[] = $now;
|
||||
}
|
||||
if (!isset($record['createdByUserNum'])) {
|
||||
if (!$ignoreSchema && !isset($record['createdByUserNum'])) {
|
||||
$setParts[] = '`createdByUserNum` = ?';
|
||||
$params[] = $user;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user