csa-admin-org / csa-admin

Web application to manage CSA (Community Supported Agriculture), ACP (Agriculture Contractuelle de Proximité) or Solawi (Solidarische Landwirtschaft) organizations.
https://csa-admin.org
MIT License
37 stars 12 forks source link

Switch to SQLite, one database per tenant #136

Closed thibaudgg closed 2 weeks ago

thibaudgg commented 3 weeks ago

This patch switches from a single PostgreSQL database, using schemas for tenant isolation, to one separate SQLite database per tenant.

This is a major change that affects the whole application. It is a step towards a simpler architecture with less external dependencies.

This also provides a better isolation between tenants, and allows to easily backup and restore individual tenants.

The database switch is done by leveraging the ActiveRecord Horizontal Sharding feature, which allow to dynamically switch the database connection based on the current tenant.