From 0f828bcccefc383e0e9101484c0691fa16f41181 Mon Sep 17 00:00:00 2001 From: Rizky Date: Tue, 25 Jun 2024 15:02:55 +0700 Subject: [PATCH] fix query --- pkgs/utils/query.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/utils/query.ts b/pkgs/utils/query.ts index 3d954ae..61f9292 100644 --- a/pkgs/utils/query.ts +++ b/pkgs/utils/query.ts @@ -225,7 +225,8 @@ export const execQuery = async (args: DBArg, prisma: any) => { const schema = createPrismaSchemaBuilder(await readAsync(schema_path)); if (action === "schema_tables") { const tables = schema.findAllByType("model", {}).map((e) => e?.name); - return tables || []; + const view = schema.findAllByType("view", {}).map((e) => e?.name); + return [...tables, ...view]; } else { const schema_table = schema.findByType("model", { name: table }); const columns = {} as Record<