fix: 新增一处外键检查的assert错误信息

This commit is contained in:
QCQCQC@Debian 2025-12-05 13:57:50 +08:00
parent aade97762f
commit 66cf652646
2 changed files with 2 additions and 2 deletions

View File

@ -209,7 +209,7 @@ class MysqlStore extends CascadeStore_1.CascadeStore {
// 边界如果是toModi的对象这里的外键确实有可能为空
// assert(schema[e].toModi || r[`${attr}Id`] === r[attr].id, `对象${<string>e}取数据时发现其外键与连接的对象的主键不一致rowId是${r.id},其${attr}Id值为${r[`${attr}Id`]},连接的对象的主键为${r[attr].id}`);
if (r[attr].id === null) {
(0, assert_1.default)(schema[e].toModi || r[`${attr}Id`] === null);
(0, assert_1.default)(schema[e].toModi || r[`${attr}Id`] === null, `对象${String(e)}取数据时发现其外键找不到目标对象rowId是${r.id},其外键${attr}Id值为${r[`${attr}Id`]}`);
delete r[attr];
continue;
}

View File

@ -222,7 +222,7 @@ export class MysqlStore<ED extends EntityDict & BaseEntityDict, Cxt extends Asyn
// 边界如果是toModi的对象这里的外键确实有可能为空
// assert(schema[e].toModi || r[`${attr}Id`] === r[attr].id, `对象${<string>e}取数据时发现其外键与连接的对象的主键不一致rowId是${r.id},其${attr}Id值为${r[`${attr}Id`]},连接的对象的主键为${r[attr].id}`);
if (r[attr].id === null) {
assert(schema[e].toModi || r[`${attr}Id`] === null);
assert(schema[e].toModi || r[`${attr}Id`] === null, `对象${String(e)}取数据时发现其外键找不到目标对象rowId是${r.id},其外键${attr}Id值为${r[`${attr}Id`]}`);
delete r[attr];
continue;
}