Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add templateId and archived index to jobs table #583

Merged

Conversation

yakanechi
Copy link
Contributor

Context

related screwdriver-cd/screwdriver#3191

screwdriver-cd/models#612 added archived to the job table filter in the job template metrics.
However, since the only index in the job table is templateId, the index does not work effectively and the job template details page takes a long time to load.

Objective

Create an index fortemplateId and archived to speed up the loading of template detail pages

References

screwdriver-cd/screwdriver#3191

License

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

Comment on lines 21 to 32
// eslint-disable-next-line no-unused-vars
down: async (queryInterface, Sequelize) => {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.removeIndex(table, `${table}_templateId_archived`, { transaction });

await queryInterface.addIndex(table, {
name: `${table}_templateId`,
fields: ['templateId'],
transaction
});
});
}
Copy link
Member

Choose a reason for hiding this comment

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

is this right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tkyi
I have confirmed locally that it works fine.
I have added it for easy rollback, but I am aware that it was not in the previous migration files.
If it is not needed, we will remove it. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not being absolutely necessary, I removed them according to customary practice.

Copy link
Member

Choose a reason for hiding this comment

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

Ah I see thanks for the context

@tkyi tkyi merged commit d04a702 into screwdriver-cd:master Sep 9, 2024
2 checks passed
@sd-buildbot
Copy link

🎉 This PR is included in version 24.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@yakanechi yakanechi deleted the add_templateId_archive_index branch September 9, 2024 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants