|
|
|
@ -2621,7 +2621,20 @@ class BaseModelSqlv2 {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const ai = this.model.columns.find((c) => c.ai); |
|
|
|
|
if ( |
|
|
|
|
|
|
|
|
|
let ag: Column; |
|
|
|
|
if (!ai) ag = this.model.columns.find((c) => c.meta?.ag); |
|
|
|
|
|
|
|
|
|
// handle if autogenerated primary key is used
|
|
|
|
|
if (ag) { |
|
|
|
|
if (!response) await this.execAndParse(query); |
|
|
|
|
response = await this.readByPk( |
|
|
|
|
data[ag.title], |
|
|
|
|
false, |
|
|
|
|
{}, |
|
|
|
|
{ ignoreView: true, getHiddenColumn: true }, |
|
|
|
|
); |
|
|
|
|
} else if ( |
|
|
|
|
!response || |
|
|
|
|
(typeof response?.[0] !== 'object' && response?.[0] !== null) |
|
|
|
|
) { |
|
|
|
@ -2680,12 +2693,14 @@ class BaseModelSqlv2 {
|
|
|
|
|
|
|
|
|
|
await Promise.all(postInsertOps.map((f) => f(rowId))); |
|
|
|
|
|
|
|
|
|
response = await this.readByPk( |
|
|
|
|
rowId, |
|
|
|
|
false, |
|
|
|
|
{}, |
|
|
|
|
{ ignoreView: true, getHiddenColumn: true }, |
|
|
|
|
); |
|
|
|
|
if (rowId !== null && rowId !== undefined) { |
|
|
|
|
response = await this.readByPk( |
|
|
|
|
rowId, |
|
|
|
|
false, |
|
|
|
|
{}, |
|
|
|
|
{ ignoreView: true, getHiddenColumn: true }, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
await this.afterInsert(response, this.dbDriver, cookie); |
|
|
|
|
|
|
|
|
|