mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-18 15:23:38 +01:00
Updated raw query method.
This commit is contained in:
parent
a609de0ea6
commit
5ce457efa5
@ -36,7 +36,7 @@ export async function rawQuery(query, params = []) {
|
|||||||
|
|
||||||
const sql = db === MYSQL ? query.replace(/\$[0-9]+/g, '?') : query;
|
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) {
|
export function getDateQuery(field, unit, timezone) {
|
||||||
@ -170,14 +170,11 @@ export async function resetWebsite(website_id) {
|
|||||||
|
|
||||||
export async function deleteWebsite(website_id) {
|
export async function deleteWebsite(website_id) {
|
||||||
return runQuery(
|
return runQuery(
|
||||||
/* Prisma bug, does not cascade on non-nullable foreign keys
|
|
||||||
prisma.website.delete({
|
prisma.website.delete({
|
||||||
where: {
|
where: {
|
||||||
website_id,
|
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) {
|
export async function deleteAccount(user_id) {
|
||||||
return runQuery(
|
return runQuery(
|
||||||
/* Prisma bug, does not cascade on non-nullable foreign keys
|
|
||||||
prisma.account.delete({
|
prisma.account.delete({
|
||||||
where: {
|
where: {
|
||||||
user_id,
|
user_id,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
*/
|
|
||||||
prisma.$queryRaw`delete from account where user_id=${user_id}`,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user