@mastra/pg 1.0.0-beta.10 → 1.0.0-beta.11
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/CHANGELOG.md +63 -0
- package/dist/index.cjs +340 -149
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +341 -150
- package/dist/index.js.map +1 -1
- package/dist/shared/config.d.ts +61 -66
- package/dist/shared/config.d.ts.map +1 -1
- package/dist/storage/client.d.ts +91 -0
- package/dist/storage/client.d.ts.map +1 -0
- package/dist/storage/db/index.d.ts +36 -17
- package/dist/storage/db/index.d.ts.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +35 -14
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/test-utils.d.ts.map +1 -1
- package/package.json +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,68 @@
|
|
|
1
1
|
# @mastra/pg
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.11
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Remove pg-promise dependency and use pg.Pool directly ([#11450](https://github.com/mastra-ai/mastra/pull/11450))
|
|
8
|
+
|
|
9
|
+
**BREAKING CHANGE**: This release replaces pg-promise with vanilla node-postgres (`pg`).
|
|
10
|
+
|
|
11
|
+
### Breaking Changes
|
|
12
|
+
- **Removed `store.pgp`**: The pg-promise library instance is no longer exposed
|
|
13
|
+
- **Config change**: `{ client: pgPromiseDb }` is no longer supported. Use `{ pool: pgPool }` instead
|
|
14
|
+
- **Cloud SQL config**: `max` and `idleTimeoutMillis` must now be passed via `pgPoolOptions`
|
|
15
|
+
|
|
16
|
+
### New Features
|
|
17
|
+
- **`store.pool`**: Exposes the underlying `pg.Pool` for direct database access or ORM integration (e.g., Drizzle)
|
|
18
|
+
- **`store.db`**: Provides a `DbClient` interface with methods like `one()`, `any()`, `tx()`, etc.
|
|
19
|
+
- **`store.db.connect()`**: Acquire a client for session-level operations
|
|
20
|
+
|
|
21
|
+
### Migration
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
// Before (pg-promise)
|
|
25
|
+
import pgPromise from 'pg-promise';
|
|
26
|
+
const pgp = pgPromise();
|
|
27
|
+
const client = pgp(connectionString);
|
|
28
|
+
const store = new PostgresStore({ id: 'my-store', client });
|
|
29
|
+
|
|
30
|
+
// After (pg.Pool)
|
|
31
|
+
import { Pool } from 'pg';
|
|
32
|
+
const pool = new Pool({ connectionString });
|
|
33
|
+
const store = new PostgresStore({ id: 'my-store', pool });
|
|
34
|
+
|
|
35
|
+
// Use store.pool with any library that accepts a pg.Pool
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- Added `exportSchemas()` function to generate Mastra database schema as SQL DDL without a database connection. ([#11448](https://github.com/mastra-ai/mastra/pull/11448))
|
|
41
|
+
|
|
42
|
+
**What's New**
|
|
43
|
+
|
|
44
|
+
You can now export your Mastra database schema as SQL DDL statements without connecting to a database. This is useful for:
|
|
45
|
+
- Generating migration scripts
|
|
46
|
+
- Reviewing the schema before deployment
|
|
47
|
+
- Creating database schemas in environments where the application doesn't have CREATE privileges
|
|
48
|
+
|
|
49
|
+
**Example**
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { exportSchemas } from '@mastra/pg';
|
|
53
|
+
|
|
54
|
+
// Export schema for default 'public' schema
|
|
55
|
+
const ddl = exportSchemas();
|
|
56
|
+
console.log(ddl);
|
|
57
|
+
|
|
58
|
+
// Export schema for a custom schema
|
|
59
|
+
const customDdl = exportSchemas('my_schema');
|
|
60
|
+
// Creates: CREATE SCHEMA IF NOT EXISTS "my_schema"; and all tables within it
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- Updated dependencies [[`e54953e`](https://github.com/mastra-ai/mastra/commit/e54953ed8ce1b28c0d62a19950163039af7834b4), [`7d56d92`](https://github.com/mastra-ai/mastra/commit/7d56d9213886e8353956d7d40df10045fd12b299), [`fdac646`](https://github.com/mastra-ai/mastra/commit/fdac646033a0930a1a4e00d13aa64c40bb7f1e02), [`d07b568`](https://github.com/mastra-ai/mastra/commit/d07b5687819ea8cb1dffa776d0c1765faf4aa1ae), [`68ec97d`](https://github.com/mastra-ai/mastra/commit/68ec97d4c07c6393fcf95c2481fc5d73da99f8c8), [`4aa55b3`](https://github.com/mastra-ai/mastra/commit/4aa55b383cf06043943359ea316572fd969861a7)]:
|
|
64
|
+
- @mastra/core@1.0.0-beta.19
|
|
65
|
+
|
|
3
66
|
## 1.0.0-beta.10
|
|
4
67
|
|
|
5
68
|
### Patch Changes
|