@mastra/pg 0.14.0 → 0.14.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/dist/index.js CHANGED
@@ -2216,7 +2216,7 @@ var StoreOperationsPG = class extends StoreOperations {
2216
2216
  const conditions = keyEntries.map(([key], index) => `"${key}" = $${index + 1}`).join(" AND ");
2217
2217
  const values = keyEntries.map(([_, value]) => value);
2218
2218
  const result = await this.client.oneOrNone(
2219
- `SELECT * FROM ${getTableName({ indexName: tableName, schemaName: getSchemaName(this.schemaName) })} WHERE ${conditions}`,
2219
+ `SELECT * FROM ${getTableName({ indexName: tableName, schemaName: getSchemaName(this.schemaName) })} WHERE ${conditions} ORDER BY "createdAt" DESC LIMIT 1`,
2220
2220
  values
2221
2221
  );
2222
2222
  if (!result) {
@@ -2771,6 +2771,7 @@ var WorkflowsPG = class extends WorkflowsStorage {
2771
2771
  const query = `
2772
2772
  SELECT * FROM ${getTableName({ indexName: TABLE_WORKFLOW_SNAPSHOT, schemaName: this.schema })}
2773
2773
  ${whereClause}
2774
+ ORDER BY "createdAt" DESC LIMIT 1
2774
2775
  `;
2775
2776
  const queryValues = values;
2776
2777
  const result = await this.client.oneOrNone(query, queryValues);