basalt / tenancy-sqlite/src / sqliteTenantSource
Function: sqliteTenantSource()
> sqliteTenantSource(dbOrLocation?): SqliteTenantSource
Defined in: tenancy-sqlite/src/index.ts:180
Open a database (or reuse a DatabaseSync) and return the tenant source wired to it, ready to drop straight into tenancyPlugin:
ts
const tenants = sqliteTenantSource('./data/tenants.db')
await tenants.create({ id: 'acme', name: 'Acme', domains: ['app.acme.com'] })
tenancyPlugin({ source: tenants, resolvers: [subdomainResolver({ base: 'localhost' })] })The raw handle is exposed as source.db for advanced use.
Parameters
dbOrLocation?
string | DatabaseSync