-
Notifications
You must be signed in to change notification settings - Fork 1.4k
PM-20574 & PM-20575 Adding Risk Insight Report tables, repositories, and migrations #5839
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
base: main
Are you sure you want to change the base?
PM-20574 & PM-20575 Adding Risk Insight Report tables, repositories, and migrations #5839
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5839 +/- ##
==========================================
+ Coverage 47.58% 50.69% +3.11%
==========================================
Files 1645 1660 +15
Lines 74658 74829 +171
Branches 6714 6716 +2
==========================================
+ Hits 35523 37935 +2412
+ Misses 37675 35376 -2299
- Partials 1460 1518 +58 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit of a 💣 I realize but hopefully easy to refactor.
@@ -0,0 +1,13 @@ | |||
CREATE TABLE [dbo].[RiskInsightReport] ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,12 @@ | |||
CREATE TABLE [dbo].[RiskInsightCriticalApplication] ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just minor changes - if you don't think we need an index with OrganizationId
+ Date
- no worries, we can request them when we need it.
We are missing MySql Migrations - at this time, I only spotted empty migration files.
[CreationDate] DATETIME2 (7) NOT NULL, | ||
[RevisionDate] DATETIME2 (7) NOT NULL, | ||
CONSTRAINT [PK_RiskInsightCriticalApplication] PRIMARY KEY CLUSTERED ([Id] ASC), | ||
CONSTRAINT [FK_RiskInsightCriticalApplication_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CONSTRAINT [FK_RiskInsightCriticalApplication_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]) | |
CONSTRAINT [FK_RiskInsightCriticalApplication_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]) ON DELETE CASCADE |
This is necessary because, there is an option to delete an Organization
and, when an org is deleted, it should delete these records as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guidance here is for direct children of Organization
to use our deletion proc for SQL Server e.g. https://github.com/bitwarden/server/blob/main/src/Sql/dbo/Stored%20Procedures/Organization_DeleteById.sql#L87 -- this results in less computational pressure on the DB when an organization is actually deleted. Change that proc and make a new one that's called there that deletes by organization ID.
For EF however, ensure that the entity type configuration does indicate this; we let self-hosters utilize the cascaded delete as their environments will not be under the pressures ours has.
[CreationDate] DATETIME2 (7) NOT NULL, | ||
[RevisionDate] DATETIME2 (7) NOT NULL, | ||
CONSTRAINT [PK_RiskInsightReport] PRIMARY KEY CLUSTERED ([Id] ASC), | ||
CONSTRAINT [FK_RiskInsightReport_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CONSTRAINT [FK_RiskInsightReport_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]) | |
CONSTRAINT [FK_RiskInsightReport_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]) ON DELETE CASCADE |
This is needed because when an organization is deleted, it must delete records in this table as well.
[CreationDate] DATETIME2 (7) NOT NULL, | ||
[RevisionDate] DATETIME2 (7) NOT NULL, | ||
CONSTRAINT [PK_RiskInsightReport] PRIMARY KEY CLUSTERED ([Id] ASC), | ||
CONSTRAINT [FK_RiskInsightReport_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CONSTRAINT [FK_RiskInsightReport_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]) | |
CONSTRAINT [FK_RiskInsightReport_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]) ON DELETE CASCADE |
just repeating what was mentioned earlier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may not need this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may not need this migration as it is empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty migration, we can safely remove this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty migration, can be safely removed.
🎟️ Tracking
PM-20574
PM-20575
📔 Objective
📸 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