[PM 30100][Server] Subscription Discount Database Infrastructure#6936
Conversation
|
New Issues (2)Checkmarx found the following issues in this Pull Request
Fixed Issues (4)Great job! The following issues were fixed in this Pull Request
|
…t-database-infrastructure
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6936 +/- ##
==========================================
+ Coverage 60.21% 60.27% +0.05%
==========================================
Files 1976 1982 +6
Lines 87536 87653 +117
Branches 7810 7816 +6
==========================================
+ Hits 52714 52830 +116
+ Misses 32907 32904 -3
- Partials 1915 1919 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…t-database-infrastructure
…t-database-infrastructure
The previous migrations were missing .Designer.cs files. This commit: - Removes the incomplete migration files - Regenerates all three provider migrations (MySQL, Postgres, SQLite) with proper Designer files - Updates DatabaseContextModelSnapshot.cs for each provider 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
mkincaid-bw
left a comment
There was a problem hiding this comment.
Minor changes requested.
| @@ -0,0 +1,19 @@ | |||
| CREATE VIEW [dbo].[SubscriptionDiscountView] | |||
| AS | |||
| SELECT | |||
There was a problem hiding this comment.
The preferred format for simple single table views is to select * from the table (unless some for of transformation is needed on one or more of the columns).
https://contributing.bitwarden.com/contributing/code-style/sql#views
| CREATE OR ALTER VIEW [dbo].[SubscriptionDiscountView] | ||
| AS | ||
| SELECT | ||
| [Id], |
There was a problem hiding this comment.
The preferred format for simple single table views is to select * from the table (unless some for of transformation is needed on one or more of the columns).
https://contributing.bitwarden.com/contributing/code-style/sql#views
| GO | ||
| CREATE NONCLUSTERED INDEX [IX_SubscriptionDiscount_DateRange] | ||
| ON [dbo].[SubscriptionDiscount]([StartDate] ASC, [EndDate] ASC) | ||
| INCLUDE([StripeProductIds], [AudienceType]); |
There was a problem hiding this comment.
❓ In the SubscriptionDiscount_ReadActive proc, you are selecting * from the table for the specified date range. SQL Server will still need to reference the underlying table for the rest of the columns, so these extra INCLUDE columns are just taking up extra space. Do you need these INCLUDE columns for another query outside of this proc?
| .HasMaxLength(100) | ||
| .HasColumnType("varchar(100)"); | ||
|
|
||
| b.Property<decimal?>("PercentOff") |
There was a problem hiding this comment.
This does not align with the SQL server column with a DECIMAL(5,2) data type.
| b.Property<decimal?>("PercentOff") | |
| b.Property<decimal?>("PercentOff") | |
| .HasPrecision(5, 2) |
…t-database-infrastructure
fba257f to
2055931
Compare
…t-database-infrastructure
|





🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-30100
📔 Objective
Improve type safety for StripeProductIds in the SubscriptionDiscount entity by changing it from a raw JSON string (string?) to a strongly-typed collection (ICollection?).
This change was suggested during code review to:
🔧 Changes Made
Core Entity
Data Access Layer
Tests
📸 Screenshots
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:) or similar for great changes:memo:) or ℹ️ (:information_source:) for notes or general info:question:) for questions:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:) for suggestions / improvements:x:) or:warning:) for more significant problems or concerns needing attention:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt:pick:) for minor or nitpick changes