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

EES-5627 Adding Label to the Release #5457

Merged
merged 3 commits into from
Dec 12, 2024
Merged

EES-5627 Adding Label to the Release #5457

merged 3 commits into from
Dec 12, 2024

Conversation

jack-hive
Copy link
Collaborator

@jack-hive jack-hive commented Dec 12, 2024

This PR adds a new optional Label database column to the Release.

It has been set to have a max character limit of 50.

The plan is, in a subsequent PR, to change how we calculate the Slug for a Release such that it appends this Label to the end, prefixed with a -. For this reason, the character limit of the Slug has been extended by 51.

As part of this, we have changed the existing unique index that exists on the PublicationId/Year/TimePeriodCoverage columns, and have added the Label to the mix.

Other Changes

  • We have added the support to change the Label in the ReleaseGeneratorExtensions in the spirit of avoiding conflicts in some further work that might be coming along at the same time (namely, EES-5628 and EES-5634)

table: "Releases",
columns: new[] { "PublicationId", "Year", "TimePeriodCoverage", "Label" },
unique: true,
filter: "[Label] IS NOT NULL");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Out of interest, does this unique constraint still take effect for the combination of PublicationId, Year and TimePeriodCoverage when Label IS null? We'd hope it does! 🙂

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would hope so! I'll double check

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've fixed this with adding HasFilter(null) to the configuration for the index

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wasn't sure how the null filter applied by the code HasFilter(null) is getting related specifically to the Label column.

I think the documentation here covers this. It says

When using the SQL Server provider EF adds an 'IS NOT NULL' filter for all nullable columns that are part of a unique index. To override this convention you can supply a null value.

So I think the answer is that it's probably not exclusive to the Label column, and would be applicable to other nullable columns if there were any.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's correct yes, that's also what I found :)

@benoutram benoutram self-requested a review December 12, 2024 11:53
@jack-hive jack-hive merged commit d357fe5 into dev Dec 12, 2024
8 checks passed
@jack-hive jack-hive deleted the EES-5627 branch December 12, 2024 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants