drizzle-multitenant 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -8
- package/dist/cli/index.js +1809 -5949
- package/dist/{context-Vki959ri.d.ts → context-BBLPNjmk.d.ts} +1 -1
- package/dist/cross-schema/index.js +1 -426
- package/dist/export/index.d.ts +395 -0
- package/dist/export/index.js +9 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +34 -4745
- package/dist/integrations/express.d.ts +3 -3
- package/dist/integrations/express.js +1 -110
- package/dist/integrations/fastify.d.ts +3 -3
- package/dist/integrations/fastify.js +1 -236
- package/dist/integrations/hono.js +0 -3
- package/dist/integrations/nestjs/index.d.ts +1 -1
- package/dist/integrations/nestjs/index.js +3 -11006
- package/dist/lint/index.d.ts +475 -0
- package/dist/lint/index.js +5 -0
- package/dist/metrics/index.d.ts +530 -0
- package/dist/metrics/index.js +3 -0
- package/dist/migrator/index.d.ts +116 -4
- package/dist/migrator/index.js +34 -2990
- package/dist/{migrator-BDgFzSh8.d.ts → migrator-C7FtsZ0H.d.ts} +263 -2
- package/dist/scaffold/index.d.ts +330 -0
- package/dist/scaffold/index.js +277 -0
- package/dist/{types-BhK96FPC.d.ts → types-CGqsPe2Q.d.ts} +49 -1
- package/package.json +18 -1
- package/dist/cli/index.js.map +0 -1
- package/dist/cross-schema/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/integrations/express.js.map +0 -1
- package/dist/integrations/fastify.js.map +0 -1
- package/dist/integrations/hono.js.map +0 -1
- package/dist/integrations/nestjs/index.js.map +0 -1
- package/dist/migrator/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -24,10 +24,13 @@
|
|
|
24
24
|
| Feature | Description |
|
|
25
25
|
|---------|-------------|
|
|
26
26
|
| **Schema Isolation** | PostgreSQL schema-per-tenant with automatic LRU pool management |
|
|
27
|
-
| **
|
|
27
|
+
| **Shared Schema** | Full support for shared schema migrations and seeding (plans, roles, permissions) |
|
|
28
28
|
| **Parallel Migrations** | Apply migrations to all tenants concurrently with progress tracking |
|
|
29
29
|
| **Cross-Schema Queries** | Type-safe joins between tenant and shared tables |
|
|
30
|
-
| **
|
|
30
|
+
| **Schema Linting** | Validate schemas with 8 configurable rules (naming, conventions, security) |
|
|
31
|
+
| **Scaffolding** | Generate schemas, seeds, and migrations from templates |
|
|
32
|
+
| **Export/Import** | Export to JSON Schema, TypeScript types, or Mermaid ERD diagrams |
|
|
33
|
+
| **Observability** | Built-in Prometheus exporter with Express/Fastify integrations |
|
|
31
34
|
| **Framework Support** | First-class Express, Fastify, and NestJS integrations |
|
|
32
35
|
|
|
33
36
|
<br />
|
|
@@ -78,11 +81,23 @@ const users = await db.select().from(schema.users);
|
|
|
78
81
|
## CLI Commands
|
|
79
82
|
|
|
80
83
|
```bash
|
|
81
|
-
|
|
82
|
-
npx drizzle-multitenant
|
|
84
|
+
# Setup & Migrations
|
|
85
|
+
npx drizzle-multitenant init --template=full # Enhanced setup wizard
|
|
86
|
+
npx drizzle-multitenant generate --name=users # Generate tenant migration
|
|
87
|
+
npx drizzle-multitenant generate:shared --name=plans # Generate shared migration
|
|
83
88
|
npx drizzle-multitenant migrate --all # Apply to all tenants
|
|
89
|
+
npx drizzle-multitenant migrate:shared # Apply shared migrations
|
|
90
|
+
|
|
91
|
+
# Developer Tools
|
|
92
|
+
npx drizzle-multitenant scaffold:schema orders # Generate schema file
|
|
93
|
+
npx drizzle-multitenant lint # Validate schemas
|
|
94
|
+
npx drizzle-multitenant doctor # Diagnose configuration
|
|
95
|
+
npx drizzle-multitenant export --format=mermaid # Export ERD diagram
|
|
96
|
+
|
|
97
|
+
# Tenant Management
|
|
84
98
|
npx drizzle-multitenant status # Check migration status
|
|
85
99
|
npx drizzle-multitenant tenant:create --id=acme # Create new tenant
|
|
100
|
+
npx drizzle-multitenant seed:all # Seed shared + tenants
|
|
86
101
|
```
|
|
87
102
|
|
|
88
103
|
<br />
|
|
@@ -168,14 +183,19 @@ export class UserService {
|
|
|
168
183
|
<td><a href="https://mateusflorez.github.io/drizzle-multitenant/guide/cli">CLI Commands</a></td>
|
|
169
184
|
</tr>
|
|
170
185
|
<tr>
|
|
171
|
-
<td><a href="https://mateusflorez.github.io/drizzle-multitenant/guide/
|
|
172
|
-
<td><a href="https://mateusflorez.github.io/drizzle-multitenant/guide/
|
|
173
|
-
<td><a href="https://mateusflorez.github.io/drizzle-multitenant/guide/
|
|
186
|
+
<td><a href="https://mateusflorez.github.io/drizzle-multitenant/guide/shared-schema">Shared Schema</a></td>
|
|
187
|
+
<td><a href="https://mateusflorez.github.io/drizzle-multitenant/guide/scaffold">Scaffolding</a></td>
|
|
188
|
+
<td><a href="https://mateusflorez.github.io/drizzle-multitenant/guide/schema-linting">Schema Linting</a></td>
|
|
174
189
|
</tr>
|
|
175
190
|
<tr>
|
|
191
|
+
<td><a href="https://mateusflorez.github.io/drizzle-multitenant/guide/export-import">Export & Import</a></td>
|
|
176
192
|
<td><a href="https://mateusflorez.github.io/drizzle-multitenant/guide/cross-schema">Cross-Schema Queries</a></td>
|
|
177
193
|
<td><a href="https://mateusflorez.github.io/drizzle-multitenant/guide/advanced">Advanced Features</a></td>
|
|
178
|
-
|
|
194
|
+
</tr>
|
|
195
|
+
<tr>
|
|
196
|
+
<td><a href="https://mateusflorez.github.io/drizzle-multitenant/guide/frameworks/express">Express</a></td>
|
|
197
|
+
<td><a href="https://mateusflorez.github.io/drizzle-multitenant/guide/frameworks/fastify">Fastify</a></td>
|
|
198
|
+
<td><a href="https://mateusflorez.github.io/drizzle-multitenant/guide/frameworks/nestjs">NestJS</a></td>
|
|
179
199
|
</tr>
|
|
180
200
|
</table>
|
|
181
201
|
|