writing-database-queries

Installation
SKILL.md

Dual-ORM Architecture

Bitwarden maintains two data access implementations, split by database provider:

  • MSSQL: Dapper with stored procedures
  • PostgreSQL, MySQL, SQLite: Entity Framework Core

These implementations are mutually exclusive at runtime — SQL Server uses only Dapper, while the other providers use only EF Core. Both implementations conform to the same repository interfaces.

  • When adding new repository functionality, implement it in both Dapper and EF Core (unless the feature is explicitly EF-only).
  • When modifying an existing stored procedure in a backwards-compatible way (for example, adding a new parameter with a default), EF Core changes are not required.
  • Some commercial features (for example, Secrets Manager) are EF Core only.

Evolutionary Database Design (EDD)

Bitwarden Cloud uses a no-rollback approach to database deployments. The key implication: server deployments can be rolled back, but database migrations cannot, so migrations must be designed to avoid being a source of downtime.

All MSSQL migrations live in util/Migrator/DbScripts/ and execute in chronological order based on the migration filename (YYYY-MM-DD_##_Description.sql).

Related skills

More from bitwarden/ai-plugins

Installs
33
GitHub Stars
100
First Seen
Feb 13, 2026