@mastra/pg 0.17.1-alpha.0 → 0.17.2-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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @mastra/pg
2
2
 
3
+ ## 0.17.2-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Add validation for index creation ([#8552](https://github.com/mastra-ai/mastra/pull/8552))
8
+
9
+ - Updated dependencies [[`c621613`](https://github.com/mastra-ai/mastra/commit/c621613069173c69eb2c3ef19a5308894c6549f0), [`12b1189`](https://github.com/mastra-ai/mastra/commit/12b118942445e4de0dd916c593e33ec78dc3bc73), [`4783b30`](https://github.com/mastra-ai/mastra/commit/4783b3063efea887825514b783ba27f67912c26d), [`076b092`](https://github.com/mastra-ai/mastra/commit/076b0924902ff0f49d5712d2df24c4cca683713f), [`2aee9e7`](https://github.com/mastra-ai/mastra/commit/2aee9e7d188b8b256a4ddc203ccefb366b4867fa), [`c582906`](https://github.com/mastra-ai/mastra/commit/c5829065a346260f96c4beb8af131b94804ae3ad), [`fa2eb96`](https://github.com/mastra-ai/mastra/commit/fa2eb96af16c7d433891a73932764960d3235c1d), [`4783b30`](https://github.com/mastra-ai/mastra/commit/4783b3063efea887825514b783ba27f67912c26d), [`a739d0c`](https://github.com/mastra-ai/mastra/commit/a739d0c8b37cd89569e04a6ca0827083c6167e19), [`603e927`](https://github.com/mastra-ai/mastra/commit/603e9279db8bf8a46caf83881c6b7389ccffff7e), [`cd45982`](https://github.com/mastra-ai/mastra/commit/cd4598291cda128a88738734ae6cbef076ebdebd), [`874f74d`](https://github.com/mastra-ai/mastra/commit/874f74da4b1acf6517f18132d035612c3ecc394a), [`0baf2ba`](https://github.com/mastra-ai/mastra/commit/0baf2bab8420277072ef1f95df5ea7b0a2f61fe7), [`26e968d`](https://github.com/mastra-ai/mastra/commit/26e968db2171ded9e4d47aa1b4f19e1e771158d0), [`cbd3fb6`](https://github.com/mastra-ai/mastra/commit/cbd3fb65adb03a7c0df193cb998aed5ac56675ee)]:
10
+ - @mastra/core@0.20.1-alpha.1
11
+
12
+ ## 0.17.1
13
+
14
+ ### Patch Changes
15
+
16
+ - Breaking change to move the agent.streamVNext/generateVNext implementation to the default stream/generate. The old stream/generate have now been moved to streamLegacy and generateLegacy ([#8097](https://github.com/mastra-ai/mastra/pull/8097))
17
+
18
+ - Updated dependencies [[`00cb6bd`](https://github.com/mastra-ai/mastra/commit/00cb6bdf78737c0fac14a5a0c7b532a11e38558a), [`869ba22`](https://github.com/mastra-ai/mastra/commit/869ba222e1d6b58fc1b65e7c9fd55ca4e01b8c2f), [`1b73665`](https://github.com/mastra-ai/mastra/commit/1b73665e8e23f5c09d49fcf3e7d709c75259259e), [`f7d7475`](https://github.com/mastra-ai/mastra/commit/f7d747507341aef60ed39e4b49318db1f86034a6), [`084b77b`](https://github.com/mastra-ai/mastra/commit/084b77b2955960e0190af8db3f77138aa83ed65c), [`a93ff84`](https://github.com/mastra-ai/mastra/commit/a93ff84b5e1af07ee236ac8873dac9b49aa5d501), [`bc5aacb`](https://github.com/mastra-ai/mastra/commit/bc5aacb646d468d325327e36117129f28cd13bf6), [`6b5af12`](https://github.com/mastra-ai/mastra/commit/6b5af12ce9e09066e0c32e821c203a6954498bea), [`bf60e4a`](https://github.com/mastra-ai/mastra/commit/bf60e4a89c515afd9570b7b79f33b95e7d07c397), [`d41aee5`](https://github.com/mastra-ai/mastra/commit/d41aee526d124e35f42720a08e64043229193679), [`e8fe13c`](https://github.com/mastra-ai/mastra/commit/e8fe13c4b4c255a42520127797ec394310f7c919), [`3ca833d`](https://github.com/mastra-ai/mastra/commit/3ca833dc994c38e3c9b4f9b4478a61cd8e07b32a), [`1edb8d1`](https://github.com/mastra-ai/mastra/commit/1edb8d1cfb963e72a12412990fb9170936c9904c), [`fbf6e32`](https://github.com/mastra-ai/mastra/commit/fbf6e324946332d0f5ed8930bf9d4d4479cefd7a), [`4753027`](https://github.com/mastra-ai/mastra/commit/4753027ee889288775c6958bdfeda03ff909af67)]:
19
+ - @mastra/core@0.20.0
20
+
3
21
  ## 0.17.1-alpha.0
4
22
 
5
23
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -3132,65 +3132,72 @@ var StoreOperationsPG = class extends storage.StoreOperations {
3132
3132
  }
3133
3133
  }
3134
3134
  /**
3135
- * Creates automatic indexes for optimal query performance
3135
+ * Returns definitions for automatic performance indexes
3136
3136
  * These composite indexes cover both filtering and sorting in single index
3137
3137
  */
3138
+ getAutomaticIndexDefinitions() {
3139
+ const schemaPrefix = this.schemaName ? `${this.schemaName}_` : "";
3140
+ return [
3141
+ // Composite index for threads (filter + sort)
3142
+ {
3143
+ name: `${schemaPrefix}mastra_threads_resourceid_createdat_idx`,
3144
+ table: storage.TABLE_THREADS,
3145
+ columns: ["resourceId", "createdAt DESC"]
3146
+ },
3147
+ // Composite index for messages (filter + sort)
3148
+ {
3149
+ name: `${schemaPrefix}mastra_messages_thread_id_createdat_idx`,
3150
+ table: storage.TABLE_MESSAGES,
3151
+ columns: ["thread_id", "createdAt DESC"]
3152
+ },
3153
+ // Composite index for traces (filter + sort)
3154
+ {
3155
+ name: `${schemaPrefix}mastra_traces_name_starttime_idx`,
3156
+ table: storage.TABLE_TRACES,
3157
+ columns: ["name", "startTime DESC"]
3158
+ },
3159
+ // Composite index for evals (filter + sort)
3160
+ {
3161
+ name: `${schemaPrefix}mastra_evals_agent_name_created_at_idx`,
3162
+ table: storage.TABLE_EVALS,
3163
+ columns: ["agent_name", "created_at DESC"]
3164
+ },
3165
+ // Composite index for scores (filter + sort)
3166
+ {
3167
+ name: `${schemaPrefix}mastra_scores_trace_id_span_id_created_at_idx`,
3168
+ table: storage.TABLE_SCORERS,
3169
+ columns: ["traceId", "spanId", "createdAt DESC"]
3170
+ },
3171
+ // AI Spans indexes for optimal trace querying
3172
+ {
3173
+ name: `${schemaPrefix}mastra_ai_spans_traceid_startedat_idx`,
3174
+ table: storage.TABLE_AI_SPANS,
3175
+ columns: ["traceId", "startedAt DESC"]
3176
+ },
3177
+ {
3178
+ name: `${schemaPrefix}mastra_ai_spans_parentspanid_startedat_idx`,
3179
+ table: storage.TABLE_AI_SPANS,
3180
+ columns: ["parentSpanId", "startedAt DESC"]
3181
+ },
3182
+ {
3183
+ name: `${schemaPrefix}mastra_ai_spans_name_idx`,
3184
+ table: storage.TABLE_AI_SPANS,
3185
+ columns: ["name"]
3186
+ },
3187
+ {
3188
+ name: `${schemaPrefix}mastra_ai_spans_spantype_startedat_idx`,
3189
+ table: storage.TABLE_AI_SPANS,
3190
+ columns: ["spanType", "startedAt DESC"]
3191
+ }
3192
+ ];
3193
+ }
3194
+ /**
3195
+ * Creates automatic indexes for optimal query performance
3196
+ * Uses getAutomaticIndexDefinitions() to determine which indexes to create
3197
+ */
3138
3198
  async createAutomaticIndexes() {
3139
3199
  try {
3140
- const schemaPrefix = this.schemaName ? `${this.schemaName}_` : "";
3141
- const indexes = [
3142
- // Composite index for threads (filter + sort)
3143
- {
3144
- name: `${schemaPrefix}mastra_threads_resourceid_createdat_idx`,
3145
- table: storage.TABLE_THREADS,
3146
- columns: ["resourceId", "createdAt DESC"]
3147
- },
3148
- // Composite index for messages (filter + sort)
3149
- {
3150
- name: `${schemaPrefix}mastra_messages_thread_id_createdat_idx`,
3151
- table: storage.TABLE_MESSAGES,
3152
- columns: ["thread_id", "createdAt DESC"]
3153
- },
3154
- // Composite index for traces (filter + sort)
3155
- {
3156
- name: `${schemaPrefix}mastra_traces_name_starttime_idx`,
3157
- table: storage.TABLE_TRACES,
3158
- columns: ["name", "startTime DESC"]
3159
- },
3160
- // Composite index for evals (filter + sort)
3161
- {
3162
- name: `${schemaPrefix}mastra_evals_agent_name_created_at_idx`,
3163
- table: storage.TABLE_EVALS,
3164
- columns: ["agent_name", "created_at DESC"]
3165
- },
3166
- // Composite index for scores (filter + sort)
3167
- {
3168
- name: `${schemaPrefix}mastra_scores_trace_id_span_id_created_at_idx`,
3169
- table: storage.TABLE_SCORERS,
3170
- columns: ["trace_id", "span_id", "created_at DESC"]
3171
- },
3172
- // AI Spans indexes for optimal trace querying
3173
- {
3174
- name: `${schemaPrefix}mastra_ai_spans_traceid_startedat_idx`,
3175
- table: storage.TABLE_AI_SPANS,
3176
- columns: ["traceId", "startedAt DESC"]
3177
- },
3178
- {
3179
- name: `${schemaPrefix}mastra_ai_spans_parentspanid_startedat_idx`,
3180
- table: storage.TABLE_AI_SPANS,
3181
- columns: ["parentSpanId", "startedAt DESC"]
3182
- },
3183
- {
3184
- name: `${schemaPrefix}mastra_ai_spans_name_idx`,
3185
- table: storage.TABLE_AI_SPANS,
3186
- columns: ["name"]
3187
- },
3188
- {
3189
- name: `${schemaPrefix}mastra_ai_spans_spantype_startedat_idx`,
3190
- table: storage.TABLE_AI_SPANS,
3191
- columns: ["spanType", "startedAt DESC"]
3192
- }
3193
- ];
3200
+ const indexes = this.getAutomaticIndexDefinitions();
3194
3201
  for (const indexOptions of indexes) {
3195
3202
  try {
3196
3203
  await this.createIndex(indexOptions);