mirror of
https://github.com/BetterCorp/BetterFrame.git
synced 2026-05-26 17:56:34 +00:00
Prep for multi-tenant PostgreSQL:
shared/tenant.ts: tenant model, schema name derivation, search_path
SQL helper. Schema-per-tenant: each tenant gets tenant_<uuid> schema,
public schema holds tenant registry + global admins.
migrations-pg.ts: two migration sets:
- PUBLIC_MIGRATIONS: tenants + global_admins + schema_migrations tables
- TENANT_MIGRATIONS: full BetterFrame table set in PG-native types
(SERIAL, TIMESTAMPTZ, JSONB, native BOOLEAN). Mirrors SQLite schema
1:1 but with PG conventions.
DbAdapter + SqliteAdapter + PgAdapter already existed. Next steps:
1. Repository async conversion (155 sync calls → await adapter.*)
2. Tenant provisioning endpoint (create schema + run migrations)
3. Request middleware: session → tenant_id → SET search_path
4. Global admin UI for tenant management
|
||
|---|---|---|
| .. | ||
| src | ||
| .gitignore | ||
| bsb-tests.json | ||
| package.json | ||
| tsconfig.json | ||