@fayz-ai/db 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +40 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # @fayz-ai/db
2
+
3
+ > The shared Drizzle spine that every Fayz plugin schema composes with.
4
+
5
+ [![npm](https://img.shields.io/npm/v/@fayz-ai/db.svg)](https://www.npmjs.com/package/@fayz-ai/db)
6
+ [![license](https://img.shields.io/npm/l/@fayz-ai/db.svg)](https://github.com/FayaLabs/fayz-sdk/blob/main/LICENSE)
7
+
8
+ When apps are composed from plugins, their data models have to compose too. `@fayz-ai/db` is the schema spine: a small set of canonical Drizzle tables — tenants, persons, orders, bookings, products — plus the column helpers (tenant id, timestamps) that plugin schemas build on. Every plugin references the same spine, so a CRM's clients and an agenda's bookings agree on what a person and a tenant are.
9
+
10
+ It also re-exports `drizzle-orm/pg-core` so the whole stack runs on one Drizzle instance — apps compose their own tables, the spine refs, and plugin schemas without the dual-copy `PgColumn` type clashes you get from mismatched drizzle-orm versions.
11
+
12
+ ## What's inside
13
+ - **Spine tables** — `saasCore`, `tenants`, `persons`, `orders`, `bookings`, `products`, `orderItems` (Ring 0 references plugins point at)
14
+ - **Column helpers** — `tenantId`, `timestamps`, `createdAt`
15
+ - **Re-exported pg-core** — the full `drizzle-orm/pg-core` builder surface, so every package shares one drizzle-orm instance
16
+
17
+ ## Install
18
+ ```bash
19
+ npm install @fayz-ai/db
20
+ ```
21
+ Depends on `drizzle-orm`. Import pg-core builders from here, not from `drizzle-orm` directly.
22
+
23
+ ## Usage
24
+ ```ts
25
+ import { pgTable, text, tenantId, timestamps, persons } from '@fayz-ai/db'
26
+
27
+ export const notes = pgTable('notes', {
28
+ id: text('id').primaryKey(),
29
+ personId: text('person_id').references(() => persons.id),
30
+ body: text('body'),
31
+ tenantId: tenantId(),
32
+ ...timestamps,
33
+ })
34
+ ```
35
+
36
+ ## Part of the Fayz SDK
37
+ The data spine beneath every plugin schema; apps compose it in their own `drizzle.config`.
38
+
39
+ ## Roadmap & contributing
40
+ Built and evolving in the open. See the [Fayz SDK roadmap](../../docs/ROADMAP.md#db) for current gaps, missing features, and good first issues.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fayz-ai/db",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Fayz SDK database layer — Drizzle schema primitives, spine references, and migration helpers shared across plugins.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",