[PM-28531] Remove old proc and use new one#7110
Conversation
|
New Issues (2)Checkmarx found the following issues in this Pull Request
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7110 +/- ##
==========================================
+ Coverage 56.70% 60.74% +4.04%
==========================================
Files 2013 2026 +13
Lines 88191 88684 +493
Branches 7861 7906 +45
==========================================
+ Hits 50009 53874 +3865
+ Misses 36362 32901 -3461
- Partials 1820 1909 +89 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| SELECT | ||
| [OrganizationId], | ||
| [ContentEncryptionKey], | ||
| [SummaryData], | ||
| [RevisionDate] | ||
| FROM [dbo].[OrganizationReportView] | ||
| WHERE [OrganizationId] = @OrganizationId | ||
| AND [RevisionDate] >= @StartDate | ||
| AND [RevisionDate] <= @EndDate | ||
| ORDER BY [RevisionDate] DESC |
There was a problem hiding this comment.
The entire SELECT statement should be indented 4 spaces, and SQL keywords should be on their own line
https://contributing.bitwarden.com/contributing/code-style/sql#select-statements
| SELECT | |
| [OrganizationId], | |
| [ContentEncryptionKey], | |
| [SummaryData], | |
| [RevisionDate] | |
| FROM [dbo].[OrganizationReportView] | |
| WHERE [OrganizationId] = @OrganizationId | |
| AND [RevisionDate] >= @StartDate | |
| AND [RevisionDate] <= @EndDate | |
| ORDER BY [RevisionDate] DESC | |
| SELECT | |
| [OrganizationId], | |
| [ContentEncryptionKey], | |
| [SummaryData], | |
| [RevisionDate] | |
| FROM | |
| [dbo].[OrganizationReportView] | |
| WHERE | |
| [OrganizationId] = @OrganizationId | |
| AND [RevisionDate] >= @StartDate | |
| AND [RevisionDate] <= @EndDate | |
| ORDER BY | |
| [RevisionDate] DESC |
There was a problem hiding this comment.
I didn't commit this suggestion because I renamed the file, but I have updated the formatting in the new file,
| @@ -0,0 +1,23 @@ | |||
| DROP PROC IF EXISTS [dbo].[OrganizationReport_GetSummariesByDateRange] | |||
There was a problem hiding this comment.
This does not follow our EDD pattern.
https://contributing.bitwarden.com/contributing/database-migrations/edd/
Database changes must be deployable independently of code changes, and must support both the current and next release. Dropping this proc should happen later in another PR once the server code has been deployed and hardened a bit.
There was a problem hiding this comment.
@mkincaid-bw The procedure and the endpoint weren't used this far.
It is safe to drop the proc in this PR as it is being replaced by a new one.
There was a problem hiding this comment.
Also, my apologies for this PR being so large - I should have made two PR's one with the DB changes and another with the code changes. I came in this morning thinking of what else I got to do next and didn't think about making another PR.
| BEGIN | ||
| SET NOCOUNT ON | ||
|
|
||
| SELECT |
There was a problem hiding this comment.
Same comment as above re: formatting.
There was a problem hiding this comment.
The file name is OrganizationReport_ReadyByOrganizationIdAndRevisionDate.sql (_ReadyBy...) but should be OrganizationReport_ReadByOrganizationIdAndRevisionDate.sql (_ReadBy...) to match the stored proc name.
There was a problem hiding this comment.
I am so sorry about this - I should have fixed this before this was made available to you.
| public string? SummaryData { get; set; } | ||
| public required Guid OrganizationId { get; set; } | ||
| [JsonPropertyName("encryptedData")] | ||
| public required string SummaryData { get; set; } |
There was a problem hiding this comment.
The SummaryData and RevisionDate (below) properties are required here, but both columns in the DB allow nulls. Not sure if it's an issue or not but I just wanted to point it out.
There was a problem hiding this comment.
@mkincaid-bw you are right - the properties are required, otherwise I would get a whole host of null checking in areas of the project that I shouldn't touch - if there is no summary data, than this object is not relevant. And I tested it in the database
There was a problem hiding this comment.
@mkincaid-bw SummaryData and RevisionDate were added later to this table and we used NULL as way to safely add them.
src/Sql/dbo/Dirt/Stored Procedures/OrganizationReport_ReadByOrganizationIdAndRevisionDate.sql
Outdated
Show resolved
Hide resolved
...grator/DbScripts/2026-02-27_00_AddOrganizationReport_ReadByOrganizationIdAndRevisionDate.sql
Outdated
Show resolved
Hide resolved
…ganizationIdAndRevisionDate.sql Co-authored-by: mkincaid-bw <mkincaid@bitwarden.com>
…adByOrganizationIdAndRevisionDate.sql Co-authored-by: mkincaid-bw <mkincaid@bitwarden.com>
|





🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-28531
📔 Objective
📸 Screenshots