diff --git a/queries/admin/user.ts b/queries/admin/user.ts index 12b7ae3b..431e934b 100644 --- a/queries/admin/user.ts +++ b/queries/admin/user.ts @@ -161,6 +161,9 @@ export async function deleteUser( return prisma .transaction([ + client.eventData.deleteMany({ + where: { websiteId: { in: websiteIds } }, + }), client.websiteEvent.deleteMany({ where: { websiteId: { in: websiteIds } }, }), diff --git a/queries/admin/website.ts b/queries/admin/website.ts index 49c97691..f5ce5739 100644 --- a/queries/admin/website.ts +++ b/queries/admin/website.ts @@ -78,6 +78,9 @@ export async function deleteWebsite( const cloudMode = process.env.CLOUD_MODE; return transaction([ + client.eventData.deleteMany({ + where: { websiteId }, + }), client.websiteEvent.deleteMany({ where: { websiteId }, }), diff --git a/queries/analytics/event/getEvents.ts b/queries/analytics/event/getEvents.ts index de66731c..32bd1dd9 100644 --- a/queries/analytics/event/getEvents.ts +++ b/queries/analytics/event/getEvents.ts @@ -35,7 +35,7 @@ function clickhouseQuery(websiteId: string, startAt: Date, eventType: number) { url_path, event_name as eventName from website_event - where event_type = {eventType:Uint32} + where event_type = {eventType:UInt32} and website_id = {websiteId:UUID} and created_at >= {startAt:DateTime('UTC')}`, {