server icon indicating copy to clipboard operation
server copied to clipboard

[BEEEP][SM-1061] Add missing vault table indexes to EF config

Open Thomas-Avery opened this issue 1 year ago • 0 comments

Type of change

- [ ] Bug fix
- [ ] New feature development
- [X] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

The purpose of this PR is to add any missing indexes we have on Microsoft SQL Server configurations to the Entity Framework table configurations.

For this PR, I'll be excluding indexes that require custom filters because EF doesn't have a good way to handle them for multiple target database providers.

This was moved from https://github.com/bitwarden/server/pull/2947 for just the vault tables.

Code changes

  • src/Infrastructure.EntityFramework/Repositories/DatabaseContext.cs: Extracting tables that required indexes into the IEntityTypeConfiguration and configuration folder approach.

  • src/Infrastructure.EntityFramework/Vault/Configurations/CipherEntityTypeConfiguration.cs: src/Infrastructure.EntityFramework/Vault/Configurations/FolderEntityTypeConfiguration.cs: Extracted into the IEntityTypeConfiguration and configuration folder approach. Adding missing indexes.

  • util/MySqlMigrations/Migrations/*: MySql EF migrations

  • util/PostgresMigrations/Migrations/*: Postgres EF migrations

  • util/SqliteMigrations/Migrations/*: Sqlite EF migrations

Before you submit

  • Please check for formatting errors (dotnet format --verify-no-changes) (required)
  • If making database changes - make sure you also update Entity Framework queries and/or migrations
  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team

Thomas-Avery avatar Dec 29 '23 20:12 Thomas-Avery