From 31c5c6512d267d4284ffd44c543f24d964221690 Mon Sep 17 00:00:00 2001 From: naskya Date: Sun, 17 Sep 2023 12:46:46 +0900 Subject: [PATCH] chore: truncate chart tables --- .../1694921638251-truncate-chart-tables.js | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 packages/backend/migration-neko/1694921638251-truncate-chart-tables.js diff --git a/packages/backend/migration-neko/1694921638251-truncate-chart-tables.js b/packages/backend/migration-neko/1694921638251-truncate-chart-tables.js new file mode 100644 index 000000000..7a02ba7c3 --- /dev/null +++ b/packages/backend/migration-neko/1694921638251-truncate-chart-tables.js @@ -0,0 +1,81 @@ +export class TruncateChartTables1694921638251 { + name = "TruncateChartTables1694921638251"; + + async up(queryRunner) { + await queryRunner.query( + `TRUNCATE TABLE "__chart__ap_request" RESTART IDENTITY`, + ); + await queryRunner.query(`TRUNCATE TABLE "__chart__drive" RESTART IDENTITY`); + await queryRunner.query( + `TRUNCATE TABLE "__chart__federation" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart__hashtag" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart__instance" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart__network" RESTART IDENTITY`, + ); + await queryRunner.query(`TRUNCATE TABLE "__chart__notes" RESTART IDENTITY`); + await queryRunner.query(`TRUNCATE TABLE "__chart__users" RESTART IDENTITY`); + await queryRunner.query( + `TRUNCATE TABLE "__chart__per_user_drive" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart__per_user_following" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart__per_user_notes" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart__per_user_reaction" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart_day__ap_request" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart_day__drive" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart_day__federation" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart_day__hashtag" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart_day__instance" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart_day__network" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart_day__notes" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart_day__users" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart_day__per_user_following" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart_day__per_user_notes" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart_day__per_user_drive" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart_day__per_user_reaction" RESTART IDENTITY`, + ); + await queryRunner.query(`TRUNCATE TABLE "__chart__test" RESTART IDENTITY`); + await queryRunner.query( + `TRUNCATE TABLE "__chart__test_unique" RESTART IDENTITY`, + ); + await queryRunner.query( + `TRUNCATE TABLE "__chart__test_grouped" RESTART IDENTITY`, + ); + } + + async down(queryRunner) {} +}