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

feat(3266): add scope and scopeId to banner models #586

Merged
merged 13 commits into from
Jan 21, 2025
Merged

Conversation

VonnyJap
Copy link
Member

Context

The current implementation of banner schema is at the global level.

Objective

Sometimes banner is needed at the pipeline or build level only.

References

screwdriver-cd/screwdriver#3266

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.

@VonnyJap VonnyJap requested a review from sagar1312 January 15, 2025 23:04
models/banner.js Outdated Show resolved Hide resolved
models/banner.js Outdated
.positive()
.description('Identifier to pipelineId for PIPELINE, buildId for BUILD, or null for GLOBAL')
.optional()
.allow(null)
Copy link
Member

Choose a reason for hiding this comment

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

We should make this non nullable when the scope is PIPELINE or BUILD

},
{ transaction }
);
await queryInterface.addColumn(
Copy link
Member

Choose a reason for hiding this comment

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

should we index by scope and scope id for faster look up?

models/banner.js Outdated Show resolved Hide resolved
@@ -81,7 +105,7 @@ module.exports = {
* @property keys
* @type {Array}
*/
keys: ['message', 'type', 'createTime'],
keys: ['message', 'type', 'createTime', 'scope', 'scopeId'],
Copy link
Member

Choose a reason for hiding this comment

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

Also add a composite index having scope and scopeId

indexes: [{ fields: ['isActive'] }, { fields: ['scope', 'scopeId'] }]

Co-authored-by: Dayanand Sagar <[email protected]>
@VonnyJap VonnyJap merged commit a9bbee5 into master Jan 21, 2025
2 checks passed
@VonnyJap VonnyJap deleted the banner-scope branch January 21, 2025 22:52
@sd-buildbot
Copy link

🎉 This PR is included in version 24.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

4 participants