From 13ff6810ca1e3284d0e032c15987510aed93e57c Mon Sep 17 00:00:00 2001 From: Rizky Date: Sat, 20 Jul 2024 14:30:57 +0700 Subject: [PATCH] fix --- pkgs/utils/query.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/utils/query.ts b/pkgs/utils/query.ts index 91eee7b..2b4b5d0 100644 --- a/pkgs/utils/query.ts +++ b/pkgs/utils/query.ts @@ -254,6 +254,18 @@ export const execQuery = async (args: DBArg, prisma: any) => { return getRels({ schema_table, schema, table, tables }); } else if (action === "schema_columns") { for (const col of schema_table.properties) { + if ( + col.type === "attribute" && + col.name === "id" && + col.args[0].type === "attributeArgument" && + col.args[0].value + ) { + for (const colname of (col.args[0].value as any).args) { + if (columns[colname]) { + columns[colname].is_pk = true; + } + } + } if (col.type === "field" && !col.array) { if (col.attributes && col.attributes?.length > 0) { const attr = col.attributes.find(