diff --git a/docs/adr/0002-postgresql.md b/docs/adr/0002-postgresql.md new file mode 100644 index 0000000..4a1796d --- /dev/null +++ b/docs/adr/0002-postgresql.md @@ -0,0 +1,36 @@ +# ADR-0002: PostgreSQL as the relational database + +- **Status:** Accepted +- **Date:** 2026-11-29 + +## Context + +Basira stores structured data with clear relationships (organizations, users, +tickets, replies), and needs transactions and constraints. Relationships live +inside a module; modules do not share foreign keys (see ADR-0001). The +knowledge base feature will also need similarity search over embeddings. + +## Decision + +Use PostgreSQL, accessed through Entity Framework Core (Npgsql provider). +Each module uses its own schema in the same database. + +## Alternatives considered + +- **SQL Server:** very common in the .NET ecosystem and has excellent tooling. + It also runs on Linux and in containers, so portability was not the deciding + factor. It is a valid choice for this project. +- **MySQL:** fine for relational data, but weaker fit for the planned + vector-search feature. + +## Consequences + +**Positive** +- Free and open source, with no licensing cost when deploying. +- Mature EF Core provider and good Linux/cloud hosting support. +- The pgvector extension can support embeddings search in the AI phase. + +**Negative** +- The author has not used PostgreSQL before, so there is a learning curve. +- EF Core migrations are provider-specific, so switching databases later means + regenerating them. \ No newline at end of file