Skip to content

Commit 9cd121d

Browse files
committed
fix: user profile analytics ch sync
1 parent 75110c7 commit 9cd121d

2 files changed

Lines changed: 2 additions & 22 deletions

File tree

src/cron/userProfileAnalyticsClickhouse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ export const userProfileAnalyticsClickhouseCron: Cron = {
4545
uniqMerge(unique_visitors) AS "uniqueVisitors"
4646
FROM api.user_profile_analytics
4747
FINAL
48-
WHERE user_id IN (
49-
SELECT DISTINCT user_id
48+
WHERE profile_id IN (
49+
SELECT DISTINCT profile_id
5050
FROM api.user_profile_analytics
5151
WHERE created_at > {lastRunAt: DateTime}
5252
)

src/migration/1768505964487-UserProfileAnalytics.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,9 @@ export class UserProfileAnalytics1768505964487 implements MigrationInterface {
2424
CONSTRAINT "PK_user_profile_analytics_history" PRIMARY KEY ("id", "date")
2525
)`,
2626
);
27-
28-
await queryRunner.query(
29-
`ALTER TABLE "user_profile_analytics"
30-
ADD CONSTRAINT "FK_user_profile_analytics_user"
31-
FOREIGN KEY ("id") REFERENCES "user"("id")
32-
ON DELETE CASCADE ON UPDATE NO ACTION`,
33-
);
34-
35-
await queryRunner.query(
36-
`ALTER TABLE "user_profile_analytics_history"
37-
ADD CONSTRAINT "FK_user_profile_analytics_history_user"
38-
FOREIGN KEY ("id") REFERENCES "user"("id")
39-
ON DELETE CASCADE ON UPDATE NO ACTION`,
40-
);
4127
}
4228

4329
public async down(queryRunner: QueryRunner): Promise<void> {
44-
await queryRunner.query(
45-
`ALTER TABLE "user_profile_analytics_history" DROP CONSTRAINT "FK_user_profile_analytics_history_user"`,
46-
);
47-
await queryRunner.query(
48-
`ALTER TABLE "user_profile_analytics" DROP CONSTRAINT "FK_user_profile_analytics_user"`,
49-
);
5030
await queryRunner.query(`DROP TABLE "user_profile_analytics_history"`);
5131
await queryRunner.query(`DROP TABLE "user_profile_analytics"`);
5232
}

0 commit comments

Comments
 (0)