Skip to content
Merged
Changes from 3 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
4 changes: 4 additions & 0 deletions pkg/datastore/mysql/ensurer/indexes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ CREATE INDEX deployment_status_updated_at_desc ON Deployment (Status, UpdatedAt
ALTER TABLE Deployment ADD COLUMN PipedId VARCHAR(36) GENERATED ALWAYS AS (data->>"$.piped_id") VIRTUAL NOT NULL;
CREATE INDEX deployment_piped_id ON Deployment (PipedId);

-- index on `CompletedAt` DESC
Copy link
Member

Choose a reason for hiding this comment

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

nits, this should be on CompletedAt and Id

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you. I updated, PTAL

ALTER TABLE Deployment ADD COLUMN CompletedAt INT(11) GENERATED ALWAYS AS (data->>"$.completed_at") VIRTUAL NULL;
CREATE INDEX deployment_completed_at_desc_id ON Deployment (CompletedAt DESC, Id);

-- index on `DeploymentChainId` ASC and `UpdatedAt` DESC
ALTER TABLE Deployment ADD COLUMN DeploymentChainId VARCHAR(36) GENERATED ALWAYS AS (data->>"$.deployment_chain_id") VIRTUAL NOT NULL;
ALTER TABLE Deployment MODIFY DeploymentChainId VARCHAR(36) GENERATED ALWAYS AS (IFNULL(data->>"$.deployment_chain_id", "")) VIRTUAL NOT NULL;
Expand Down