Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion components/gitpod-db/src/typeorm/workspace-db-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,12 @@ export class TypeORMWorkspaceDBImpl extends TransactionalDBImpl<WorkspaceDB> imp
const sessions = (await workspaceInstanceRepo
.createQueryBuilder("wsi")
.leftJoinAndMapOne("wsi.workspace", DBWorkspace, "ws", "ws.id = wsi.workspaceId")
.leftJoinAndMapOne("wsi.metrics", DBWorkspaceInstanceMetrics, "wsim", "wsim.instanceId = wsi.id")
.leftJoinAndMapOne(
"wsi.metrics",
DBWorkspaceInstanceMetrics,
"wsim",
"wsim.instanceId COLLATE utf8mb4_general_ci = wsi.id COLLATE utf8mb4_general_ci",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 2nd COLLATE is superfluous.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But also... why not leave it as-is, looking at the mess in some of the tables schemas... 🫠

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But also... why not leave it as-is, looking at the mess in some of the tables schemas... 🫠

I did it because of the original request XD "Maybe we can fix that in the query itself (there is a way to force a collation on the fly)."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, update schema will be a better idea, let's merge current PR first

)
.where("ws.organizationId = :organizationId", { organizationId })
.andWhere("wsi.creationTime >= :periodStart", { periodStart: periodStart.toISOString() })
.andWhere("wsi.creationTime <= :periodEnd", { periodEnd: periodEnd.toISOString() })
Expand Down
Loading