Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

delete data from all clickhouse tables on user account removal

Blue Mouseae18e342687b
diff --git a/apps/production/src/user/user.controller.ts b/apps/production/src/user/user.controller.ts
index 5a6b8f13c..3f037ee5d 100644
--- a/apps/production/src/user/user.controller.ts
+++ b/apps/production/src/user/user.controller.ts
@@ -320,9 +320,17 @@ export class UserController {
)
const query1 = `ALTER table analytics DELETE WHERE pid IN (${pids})`
const query2 = `ALTER table customEV DELETE WHERE pid IN (${pids})`
+ const query3 = `ALTER table performance DELETE WHERE pid IN (${pids})`
+ const query4 = `ALTER table errors DELETE WHERE pid IN (${pids})`
+ const query5 = `ALTER table error_statuses DELETE WHERE pid IN (${pids})`
+ const query6 = `ALTER table captcha DELETE WHERE pid IN (${pids})`
await this.projectService.deleteMultiple(pids)
await clickhouse.query(query1).toPromise()
await clickhouse.query(query2).toPromise()
+ await clickhouse.query(query3).toPromise()
+ await clickhouse.query(query4).toPromise()
+ await clickhouse.query(query5).toPromise()
+ await clickhouse.query(query6).toPromise()
}
await this.userService.delete(id)
@@ -361,9 +369,17 @@ export class UserController {
)
const query1 = `ALTER table analytics DELETE WHERE pid IN (${pids})`
const query2 = `ALTER table customEV DELETE WHERE pid IN (${pids})`
+ const query3 = `ALTER table performance DELETE WHERE pid IN (${pids})`
+ const query4 = `ALTER table errors DELETE WHERE pid IN (${pids})`
+ const query5 = `ALTER table error_statuses DELETE WHERE pid IN (${pids})`
+ const query6 = `ALTER table captcha DELETE WHERE pid IN (${pids})`
await this.projectService.deleteMultiple(pids)
await clickhouse.query(query1).toPromise()
await clickhouse.query(query2).toPromise()
+ await clickhouse.query(query3).toPromise()
+ await clickhouse.query(query4).toPromise()
+ await clickhouse.query(query5).toPromise()
+ await clickhouse.query(query6).toPromise()
}
await this.actionTokensService.deleteMultiple(`userId="${id}"`)
await this.userService.delete(id)