mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
24 lines
640 B
JavaScript
24 lines
640 B
JavaScript
import { prisma, runQuery } from 'lib/db/relational';
|
|
|
|
export async function deleteWebsite(website_id) {
|
|
return runQuery(
|
|
prisma.$transaction([
|
|
prisma.pageview.deleteMany({
|
|
where: { session: { website: { website_id } } },
|
|
}),
|
|
prisma.event_data.deleteMany({
|
|
where: { event: { session: { website: { website_id } } } },
|
|
}),
|
|
prisma.event.deleteMany({
|
|
where: { session: { website: { website_id } } },
|
|
}),
|
|
prisma.session.deleteMany({
|
|
where: { website: { website_id } },
|
|
}),
|
|
prisma.website.delete({
|
|
where: { website_id },
|
|
}),
|
|
]),
|
|
);
|
|
}
|