@mastra/pg 1.20.0 → 1.20.1-alpha.0
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 +9 -0
- package/dist/docs/SKILL.md +2 -2
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-deployment-workers.md +251 -5
- package/dist/docs/references/docs-memory-semantic-recall.md +1 -1
- package/dist/docs/references/docs-memory-working-memory.md +2 -2
- package/dist/docs/references/docs-storage-overview.md +7 -6
- package/dist/docs/references/integrations-databases-postgresql.md +10 -9
- package/dist/docs/references/reference-rag-chunking-and-embedding.md +1 -1
- package/dist/docs/references/reference-rag-metadata-filters.md +1 -1
- package/dist/docs/references/reference-storage-retention.md +1 -1
- package/dist/docs/references/reference-tools-vector-query-tool.md +1 -1
- package/dist/docs/references/reference-vectors-pg.md +1 -1
- package/dist/index.cjs +17 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +1 -2
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -19358,33 +19358,47 @@ var WorkflowsPG = class WorkflowsPG extends WorkflowsStorage {
|
|
|
19358
19358
|
updatedAt: new Date(row.updatedAtZ || row.updatedAt)
|
|
19359
19359
|
};
|
|
19360
19360
|
}
|
|
19361
|
+
static getDefaultIndexDefs(schemaPrefix) {
|
|
19362
|
+
return [{
|
|
19363
|
+
name: `${schemaPrefix}mastra_workflow_snapshot_name_createdat_idx`,
|
|
19364
|
+
table: TABLE_WORKFLOW_SNAPSHOT,
|
|
19365
|
+
columns: ["workflow_name", "createdAt DESC"]
|
|
19366
|
+
}];
|
|
19367
|
+
}
|
|
19361
19368
|
/**
|
|
19362
19369
|
* Returns all DDL statements for this domain: table with unique constraint.
|
|
19363
19370
|
* Used by exportSchemas to produce a complete, reproducible schema export.
|
|
19364
19371
|
*/
|
|
19365
19372
|
static getExportDDL(schemaName) {
|
|
19366
19373
|
const statements = [];
|
|
19374
|
+
const parsedSchema = schemaName ? parseSqlIdentifier(schemaName, "schema name") : "";
|
|
19375
|
+
const schemaPrefix = parsedSchema && parsedSchema !== "public" ? `${parsedSchema}_` : "";
|
|
19367
19376
|
statements.push(generateTableSQL({
|
|
19368
19377
|
tableName: TABLE_WORKFLOW_SNAPSHOT,
|
|
19369
19378
|
schema: TABLE_SCHEMAS[TABLE_WORKFLOW_SNAPSHOT],
|
|
19370
19379
|
schemaName,
|
|
19371
19380
|
includeAllConstraints: true
|
|
19372
19381
|
}));
|
|
19382
|
+
for (const idx of WorkflowsPG.getDefaultIndexDefs(schemaPrefix)) statements.push(generateIndexSQL(idx, schemaName));
|
|
19373
19383
|
return statements;
|
|
19374
19384
|
}
|
|
19375
19385
|
/**
|
|
19376
19386
|
* Returns default index definitions for the workflows domain tables.
|
|
19377
|
-
* Currently no default indexes are defined for workflows.
|
|
19378
19387
|
*/
|
|
19379
19388
|
getDefaultIndexDefinitions() {
|
|
19380
|
-
|
|
19389
|
+
const schemaPrefix = this.#schema !== "public" ? `${this.#schema}_` : "";
|
|
19390
|
+
return WorkflowsPG.getDefaultIndexDefs(schemaPrefix);
|
|
19381
19391
|
}
|
|
19382
19392
|
/**
|
|
19383
19393
|
* Creates default indexes for optimal query performance.
|
|
19384
|
-
* Currently no default indexes are defined for workflows.
|
|
19385
19394
|
*/
|
|
19386
19395
|
async createDefaultIndexes() {
|
|
19387
19396
|
if (this.#skipDefaultIndexes) return;
|
|
19397
|
+
for (const indexDef of this.getDefaultIndexDefinitions()) try {
|
|
19398
|
+
await this.#db.createIndex(indexDef);
|
|
19399
|
+
} catch (error) {
|
|
19400
|
+
this.logger?.warn?.(`Failed to create index ${indexDef.name}:`, error);
|
|
19401
|
+
}
|
|
19388
19402
|
}
|
|
19389
19403
|
async init() {
|
|
19390
19404
|
await this.#db.createTable({
|