From 5ce457efa5886029cbaa9e4c46a4abd62aab78a3 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Thu, 16 Dec 2021 21:33:53 -0800 Subject: [PATCH] Updated raw query method. --- lib/queries.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/queries.js b/lib/queries.js index f54b9267..5bcd18ba 100644 --- a/lib/queries.js +++ b/lib/queries.js @@ -36,7 +36,7 @@ export async function rawQuery(query, params = []) { const sql = db === MYSQL ? query.replace(/\$[0-9]+/g, '?') : query; - return prisma.$queryRaw.apply(prisma, [sql, ...params]); + return prisma.$queryRawUnsafe.apply(prisma, [sql, ...params]); } export function getDateQuery(field, unit, timezone) { @@ -170,14 +170,11 @@ export async function resetWebsite(website_id) { export async function deleteWebsite(website_id) { return runQuery( - /* Prisma bug, does not cascade on non-nullable foreign keys prisma.website.delete({ where: { website_id, }, }), - */ - prisma.$queryRaw`delete from website where website_id=${website_id}`, ); } @@ -269,14 +266,11 @@ export async function updateAccount(user_id, data) { export async function deleteAccount(user_id) { return runQuery( - /* Prisma bug, does not cascade on non-nullable foreign keys prisma.account.delete({ where: { user_id, }, }), - */ - prisma.$queryRaw`delete from account where user_id=${user_id}`, ); }