mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-25 06:56:29 +00:00
fix: add default value for rollup
This commit is contained in:
@@ -58,9 +58,23 @@ export default async function ({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qb[columnOptions.rollup_function as string]?.(
|
if (
|
||||||
knex.ref(`${refTableAlias}.${rollupColumn.column_name}`),
|
['sum', 'sumDistinct', 'avgDistinct', 'avg'].includes(
|
||||||
);
|
columnOptions.rollup_function,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
qb.select(
|
||||||
|
knex.raw(`COALESCE((??), 0)`, [
|
||||||
|
knex[columnOptions.rollup_function as string]?.(
|
||||||
|
knex.ref(`${refTableAlias}.${rollupColumn.column_name}`),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
qb[columnOptions.rollup_function as string]?.(
|
||||||
|
knex.ref(`${refTableAlias}.${rollupColumn.column_name}`),
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (relationColumnOption.type) {
|
switch (relationColumnOption.type) {
|
||||||
|
|||||||
Reference in New Issue
Block a user