|
|
@ -2760,6 +2760,7 @@ class BaseModelSqlv2 { |
|
|
|
rowId: insertObj[ag.column_name], |
|
|
|
rowId: insertObj[ag.column_name], |
|
|
|
insertObj, |
|
|
|
insertObj, |
|
|
|
ag, |
|
|
|
ag, |
|
|
|
|
|
|
|
ai, |
|
|
|
}), |
|
|
|
}), |
|
|
|
false, |
|
|
|
false, |
|
|
|
{}, |
|
|
|
{}, |
|
|
@ -2803,7 +2804,7 @@ class BaseModelSqlv2 { |
|
|
|
).__nc_ai_id; |
|
|
|
).__nc_ai_id; |
|
|
|
} |
|
|
|
} |
|
|
|
response = await this.readByPk( |
|
|
|
response = await this.readByPk( |
|
|
|
this.extractCompositePK({ rowId: id, insertObj, ag }), |
|
|
|
this.extractCompositePK({ rowId: id, insertObj, ag, ai }), |
|
|
|
false, |
|
|
|
false, |
|
|
|
{}, |
|
|
|
{}, |
|
|
|
{ ignoreView: true, getHiddenColumn: true }, |
|
|
|
{ ignoreView: true, getHiddenColumn: true }, |
|
|
@ -3270,18 +3271,16 @@ class BaseModelSqlv2 { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
rowId = pkObj; |
|
|
|
rowId = pkObj; |
|
|
|
} else if ( |
|
|
|
} else if (!ai && !ag && insertObj) { |
|
|
|
!ai && |
|
|
|
|
|
|
|
!ag && |
|
|
|
|
|
|
|
(force || this.model.primaryKeys?.length > 1 || this.isSnowflake) |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
// handle if primary key is not ai or ag
|
|
|
|
// handle if primary key is not ai or ag
|
|
|
|
const pkObj = {}; |
|
|
|
if (this.model.primaryKeys.length === 1) { |
|
|
|
for (const pk of this.model.primaryKeys) { |
|
|
|
return insertObj[this.model.primaryKey.column_name] ?? null; |
|
|
|
const key = pk.title; |
|
|
|
} else { |
|
|
|
pkObj[key] = insertObj[pk.column_name] ?? null; |
|
|
|
return this.model.primaryKeys.reduce((acc, pk) => { |
|
|
|
|
|
|
|
acc[pk.title] = insertObj[pk.column_name] ?? null; |
|
|
|
|
|
|
|
return acc; |
|
|
|
|
|
|
|
}, {}); |
|
|
|
} |
|
|
|
} |
|
|
|
rowId = pkObj; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return rowId; |
|
|
|
return rowId; |
|
|
|