From 33ae0ca6fd2b05fb6bd2c6fde73d65bd7dc4b442 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sat, 1 Apr 2023 12:03:49 -0700 Subject: [PATCH] chore: add cleanup migration --- .../migration/1680375641101-clean-charts.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 packages/backend/migration/1680375641101-clean-charts.js diff --git a/packages/backend/migration/1680375641101-clean-charts.js b/packages/backend/migration/1680375641101-clean-charts.js new file mode 100644 index 0000000000..3fec0fef2a --- /dev/null +++ b/packages/backend/migration/1680375641101-clean-charts.js @@ -0,0 +1,15 @@ +export class CleanCharts1680375641101 { + constructor() { + this.name = 'CleanCharts1680375641101'; + } + async up(queryRunner) { + await queryRunner.query(`delete from __chart__hashtag where ___local_users = 0 and ___remote_users = 0;`); + await queryRunner.query(`delete from __chart_day__hashtag where ___local_users = 0 and ___remote_users = 0;`); + await queryRunner.query(`vacuum __chart__hashtag;`); + await queryRunner.query(`vacuum __chart_day__hashtag;`); + } + async down(queryRunner) { + await queryRunner.query(`vacuum __chart__hashtag;`); + await queryRunner.query(`vacuum __chart_day__hashtag;`); + } +}