@mastra/pg 1.12.0-alpha.0 → 1.12.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,32 @@
1
1
  # @mastra/pg
2
2
 
3
+ ## 1.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added the `disableInit` option to the `MastraVector` base class. When set to `true`, vector stores skip creating schemas, extensions, tables, and indexes at application startup. This matches the existing `disableInit` behavior on storage adapters and is useful for deployments where schemas and indexes are created ahead of time by a privileged database role, while the application runs with a least-privilege role. ([#17272](https://github.com/mastra-ai/mastra/pull/17272))
8
+
9
+ **Usage**
10
+
11
+ ```typescript
12
+ const vector = new PgVector({
13
+ id: 'vectors',
14
+ connectionString: process.env.DATABASE_URL,
15
+ disableInit: true,
16
+ });
17
+ ```
18
+
19
+ The `MASTRA_DISABLE_STORAGE_INIT` environment variable also disables vector init, so a single flag prevents both storage and vector stores from creating schemas, tables, or indexes at startup.
20
+
21
+ ### Patch Changes
22
+
23
+ - Fixed `PostgresStore` ignoring an explicit `ssl` option when the `connectionString` also carries an `sslmode=`/`ssl=` query param. node-postgres re-parses the connection string and `Object.assign`s the URL-derived `ssl` over the explicit one, so a config like `{ connectionString: '...?sslmode=require', ssl: { rejectUnauthorized: false } }` silently dropped `rejectUnauthorized: false` and failed with `UNABLE_TO_GET_ISSUER_CERT_LOCALLY` against self-signed CAs. The connection-string branch now parses the URL and applies the explicit `ssl` last, while still honoring URL-driven SSL when no `ssl` option is provided. Fixes #17307. ([#17356](https://github.com/mastra-ai/mastra/pull/17356))
24
+
25
+ - Improved Postgres memory message save performance ([#17351](https://github.com/mastra-ai/mastra/pull/17351))
26
+
27
+ - Updated dependencies [[`fa63872`](https://github.com/mastra-ai/mastra/commit/fa6387280954e6b667bec5714b55ba082bc627ff), [`d779de3`](https://github.com/mastra-ai/mastra/commit/d779de3cd9d2e7ed8110547190e2f15e786a0e41), [`1750c97`](https://github.com/mastra-ai/mastra/commit/1750c975d6179fbf6db2813b15229d4f8f23fc55), [`9283971`](https://github.com/mastra-ai/mastra/commit/928397157009b4aef4d5fdf3a0a273cb371beb55), [`f07b646`](https://github.com/mastra-ai/mastra/commit/f07b64604ab7d25391179790b7fd4823df9e2dff), [`d8838ae`](https://github.com/mastra-ai/mastra/commit/d8838ae80b69780361693d27098f7f6684af12fe), [`40f9297`](https://github.com/mastra-ai/mastra/commit/40f9297003b921c62373d3e8d3a4bda76c9f6de3), [`19a8658`](https://github.com/mastra-ai/mastra/commit/19a86589c788ef48bb6c1b0612cc82a201857379), [`850af77`](https://github.com/mastra-ai/mastra/commit/850af7779cb87c350804488734544a5b1843de25), [`0f0d1ba`](https://github.com/mastra-ai/mastra/commit/0f0d1ba67bfcb2204e571401662f1eceefc03357), [`a18775a`](https://github.com/mastra-ai/mastra/commit/a18775a693172546ee2378d39b67d4e32895b251), [`1baf2d1`](https://github.com/mastra-ai/mastra/commit/1baf2d152c6881338ff8f114633d5316fe13dd15), [`8c31bcd`](https://github.com/mastra-ai/mastra/commit/8c31bcdb00e597880d5939b1b7d7566fbe5dacae), [`0e32507`](https://github.com/mastra-ai/mastra/commit/0e32507962cdfa5569b7bda5bc6fb3dd34e40b03), [`95b14cd`](https://github.com/mastra-ai/mastra/commit/95b14cdd820e86d97ac05fe568424c513a252e31), [`07c3de7`](https://github.com/mastra-ai/mastra/commit/07c3de7f7bc418beccaea3b5e6b7f7cdda79d492), [`0bf2d93`](https://github.com/mastra-ai/mastra/commit/0bf2d932d20e2936f2d9abb8c0a86e24fbc97ec6), [`7b0d34c`](https://github.com/mastra-ai/mastra/commit/7b0d34cfe4a2fce22ac86ae17404685ff67a2ddb), [`a659a77`](https://github.com/mastra-ai/mastra/commit/a659a779bdebe3a52a518c56d2260592d0240fe0), [`aa36be2`](https://github.com/mastra-ai/mastra/commit/aa36be23aa513b7dc53cb8ca16b7fab8f20e43ad), [`3332be9`](https://github.com/mastra-ai/mastra/commit/3332be9701ecd77aba840959d9a1d1ce7aef02d3), [`212c635`](https://github.com/mastra-ai/mastra/commit/212c635203e61d036ab41db8ff86c3893dc795b3), [`d8838ae`](https://github.com/mastra-ai/mastra/commit/d8838ae80b69780361693d27098f7f6684af12fe), [`9aa5a73`](https://github.com/mastra-ai/mastra/commit/9aa5a73e7e110f6e9365eec69364a33d5f03bb56), [`f73c789`](https://github.com/mastra-ai/mastra/commit/f73c789e8ef21561580395d2c410119cab5848c8), [`8bd16da`](https://github.com/mastra-ai/mastra/commit/8bd16da73a4cb874d739373643dbd6a6e7f88684), [`c8630f8`](https://github.com/mastra-ai/mastra/commit/c8630f80d4f40cb5d22e60ab162b618b1907167a), [`94dfef6`](https://github.com/mastra-ai/mastra/commit/94dfef6e2bf19a88467ea3940afcbce88a433f0f), [`47f71dc`](https://github.com/mastra-ai/mastra/commit/47f71dc6fbcbd12d71e21a979e676e20a02bd77d), [`50ceae2`](https://github.com/mastra-ai/mastra/commit/50ceae270878e2f8fb2b2c6c2faab09df0007c8a), [`a122f79`](https://github.com/mastra-ai/mastra/commit/a122f79427ae225ec79c7b2ed46278da48d04b17), [`8cdde58`](https://github.com/mastra-ai/mastra/commit/8cdde5875bbba6702d9df226f2b20232b8d75d6c), [`3a081c1`](https://github.com/mastra-ai/mastra/commit/3a081c1255c5ae8c99f6dad91cc612934ef6f2bd), [`49f8abc`](https://github.com/mastra-ai/mastra/commit/49f8abce8258e4f2f87bd326acfbdb641264a47c), [`847ff1e`](https://github.com/mastra-ai/mastra/commit/847ff1e0d94368d94b2e173e4e0908e115568ef3), [`0c1ed1d`](https://github.com/mastra-ai/mastra/commit/0c1ed1d00c7d87b5ac99ca95896211a2fa9189fa), [`259d409`](https://github.com/mastra-ai/mastra/commit/259d409a514174299dbde1ff5e1121209b3ba850), [`9e16c68`](https://github.com/mastra-ai/mastra/commit/9e16c6818b6485ccb43df28aba6f3a2219d28662), [`cefca33`](https://github.com/mastra-ai/mastra/commit/cefca33ae666e69810c935fedf95a929c173d1d7), [`d00e8c5`](https://github.com/mastra-ai/mastra/commit/d00e8c50daebe5bce5bf2f48bde39c86fc3d2fe4), [`36fa7e2`](https://github.com/mastra-ai/mastra/commit/36fa7e24d14e58a1eb46147097b32f583e5b8775), [`87e9774`](https://github.com/mastra-ai/mastra/commit/87e97741c1e493cd6d62f478eb810b49bda4d57c), [`65a72e7`](https://github.com/mastra-ai/mastra/commit/65a72e70c25eedea8ff985a6624b96be2850236b), [`fe9eacd`](https://github.com/mastra-ai/mastra/commit/fe9eacd9545a0a9d64aad31c9fa90294a425289e), [`4c02027`](https://github.com/mastra-ai/mastra/commit/4c020277235eaa6b1dc957c90ad0639eef213992), [`0f77241`](https://github.com/mastra-ai/mastra/commit/0f7724108806703799a8ba80ad0f09414afd5066), [`849efb9`](https://github.com/mastra-ai/mastra/commit/849efb9fca6dc976589c1f90a303fea618769109), [`92ff509`](https://github.com/mastra-ai/mastra/commit/92ff5098ef8a990438ca038077021a5f7541ec1d), [`3fce5e7`](https://github.com/mastra-ai/mastra/commit/3fce5e70d011d289043e75003ef3336ed4aa43c3), [`a763592`](https://github.com/mastra-ai/mastra/commit/a763592c3db46963ef1011cfe16fe372816e775e), [`db79c86`](https://github.com/mastra-ai/mastra/commit/db79c86c60723d57e02f9636ca2611bd4515f194), [`6855012`](https://github.com/mastra-ai/mastra/commit/685501247cc4717506f3e89beed03509d63a5370), [`80c7737`](https://github.com/mastra-ai/mastra/commit/80c7737e32d7917b5f356957d67c169d01744fd3), [`7fef31c`](https://github.com/mastra-ai/mastra/commit/7fef31c0d2a6d362a43a647a8a4f6ab893758a23), [`7fef31c`](https://github.com/mastra-ai/mastra/commit/7fef31c0d2a6d362a43a647a8a4f6ab893758a23), [`3f1cf47`](https://github.com/mastra-ai/mastra/commit/3f1cf476f74c1e4cc2df908837e05853a5347e31)]:
28
+ - @mastra/core@1.38.0
29
+
3
30
  ## 1.12.0-alpha.0
4
31
 
5
32
  ### Minor Changes
@@ -3,7 +3,7 @@ name: mastra-pg
3
3
  description: Documentation for @mastra/pg. Use when working with @mastra/pg APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/pg"
6
- version: "1.12.0-alpha.0"
6
+ version: "1.12.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.12.0-alpha.0",
2
+ "version": "1.12.0",
3
3
  "package": "@mastra/pg",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -30,7 +30,7 @@ const agent = new Agent({
30
30
  id: 'support-agent',
31
31
  name: 'SupportAgent',
32
32
  instructions: 'You are a helpful support agent.',
33
- model: 'openai/gpt-5.4',
33
+ model: 'openai/gpt-5.5',
34
34
  memory: new Memory({
35
35
  storage: new LibSQLStore({
36
36
  id: 'agent-storage',
@@ -41,6 +41,7 @@ Each provider page includes installation instructions, configuration parameters,
41
41
  - [DynamoDB](https://mastra.ai/reference/storage/dynamodb)
42
42
  - [LanceDB](https://mastra.ai/reference/storage/lance)
43
43
  - [Microsoft SQL Server](https://mastra.ai/reference/storage/mssql)
44
+ - [Google Cloud Spanner](https://mastra.ai/reference/storage/spanner)
44
45
 
45
46
  > **Tip:** libSQL is the easiest way to get started because it doesn’t require running a separate database server.
46
47
 
@@ -179,7 +180,7 @@ export const agent = new Agent({
179
180
  memory: new Memory({
180
181
  options: {
181
182
  generateTitle: {
182
- model: '__OPENAI_MODEL_MINI__',
183
+ model: 'openai/gpt-5-mini',
183
184
  instructions: 'Generate a 1 word title',
184
185
  },
185
186
  },
@@ -26,7 +26,7 @@ const agent = new Agent({
26
26
  id: 'personal-assistant',
27
27
  name: 'PersonalAssistant',
28
28
  instructions: 'You are a helpful personal assistant.',
29
- model: 'openai/gpt-5.4',
29
+ model: 'openai/gpt-5.5',
30
30
  memory: new Memory({
31
31
  options: {
32
32
  workingMemory: {
@@ -272,7 +272,7 @@ import { PGVECTOR_PROMPT } from '@mastra/pg'
272
272
  export const ragAgent = new Agent({
273
273
  id: 'rag-agent',
274
274
  name: 'RAG Agent',
275
- model: 'openai/gpt-5.4',
275
+ model: 'openai/gpt-5.5',
276
276
  instructions: `
277
277
  Process queries using the provided context. Structure responses to be concise and relevant.
278
278
  ${PGVECTOR_PROMPT}
@@ -289,7 +289,7 @@ import { PINECONE_PROMPT } from '@mastra/pinecone'
289
289
  export const ragAgent = new Agent({
290
290
  id: 'rag-agent',
291
291
  name: 'RAG Agent',
292
- model: 'openai/gpt-5.4',
292
+ model: 'openai/gpt-5.5',
293
293
  instructions: `
294
294
  Process queries using the provided context. Structure responses to be concise and relevant.
295
295
  ${PINECONE_PROMPT}
@@ -306,7 +306,7 @@ import { QDRANT_PROMPT } from '@mastra/qdrant'
306
306
  export const ragAgent = new Agent({
307
307
  id: 'rag-agent',
308
308
  name: 'RAG Agent',
309
- model: 'openai/gpt-5.4',
309
+ model: 'openai/gpt-5.5',
310
310
  instructions: `
311
311
  Process queries using the provided context. Structure responses to be concise and relevant.
312
312
  ${QDRANT_PROMPT}
@@ -323,7 +323,7 @@ import { CHROMA_PROMPT } from '@mastra/chroma'
323
323
  export const ragAgent = new Agent({
324
324
  id: 'rag-agent',
325
325
  name: 'RAG Agent',
326
- model: 'openai/gpt-5.4',
326
+ model: 'openai/gpt-5.5',
327
327
  instructions: `
328
328
  Process queries using the provided context. Structure responses to be concise and relevant.
329
329
  ${CHROMA_PROMPT}
@@ -340,7 +340,7 @@ import { ASTRA_PROMPT } from '@mastra/astra'
340
340
  export const ragAgent = new Agent({
341
341
  id: 'rag-agent',
342
342
  name: 'RAG Agent',
343
- model: 'openai/gpt-5.4',
343
+ model: 'openai/gpt-5.5',
344
344
  instructions: `
345
345
  Process queries using the provided context. Structure responses to be concise and relevant.
346
346
  ${ASTRA_PROMPT}
@@ -357,7 +357,7 @@ import { LIBSQL_PROMPT } from '@mastra/libsql'
357
357
  export const ragAgent = new Agent({
358
358
  id: 'rag-agent',
359
359
  name: 'RAG Agent',
360
- model: 'openai/gpt-5.4',
360
+ model: 'openai/gpt-5.5',
361
361
  instructions: `
362
362
  Process queries using the provided context. Structure responses to be concise and relevant.
363
363
  ${LIBSQL_PROMPT}
@@ -374,7 +374,7 @@ import { UPSTASH_PROMPT } from '@mastra/upstash'
374
374
  export const ragAgent = new Agent({
375
375
  id: 'rag-agent',
376
376
  name: 'RAG Agent',
377
- model: 'openai/gpt-5.4',
377
+ model: 'openai/gpt-5.5',
378
378
  instructions: `
379
379
  Process queries using the provided context. Structure responses to be concise and relevant.
380
380
  ${UPSTASH_PROMPT}
@@ -391,7 +391,7 @@ import { VECTORIZE_PROMPT } from '@mastra/vectorize'
391
391
  export const ragAgent = new Agent({
392
392
  id: 'rag-agent',
393
393
  name: 'RAG Agent',
394
- model: 'openai/gpt-5.4',
394
+ model: 'openai/gpt-5.5',
395
395
  instructions: `
396
396
  Process queries using the provided context. Structure responses to be concise and relevant.
397
397
  ${VECTORIZE_PROMPT}
@@ -408,7 +408,7 @@ import { MONGODB_PROMPT } from '@mastra/mongodb'
408
408
  export const ragAgent = new Agent({
409
409
  id: 'rag-agent',
410
410
  name: 'RAG Agent',
411
- model: 'openai/gpt-5.4',
411
+ model: 'openai/gpt-5.5',
412
412
  instructions: `
413
413
  Process queries using the provided context. Structure responses to be concise and relevant.
414
414
  ${MONGODB_PROMPT}
@@ -425,7 +425,7 @@ import { OPENSEARCH_PROMPT } from '@mastra/opensearch'
425
425
  export const ragAgent = new Agent({
426
426
  id: 'rag-agent',
427
427
  name: 'RAG Agent',
428
- model: 'openai/gpt-5.4',
428
+ model: 'openai/gpt-5.5',
429
429
  instructions: `
430
430
  Process queries using the provided context. Structure responses to be concise and relevant.
431
431
  ${OPENSEARCH_PROMPT}
@@ -442,7 +442,7 @@ import { S3VECTORS_PROMPT } from '@mastra/s3vectors'
442
442
  export const ragAgent = new Agent({
443
443
  id: 'rag-agent',
444
444
  name: 'RAG Agent',
445
- model: 'openai/gpt-5.4',
445
+ model: 'openai/gpt-5.5',
446
446
  instructions: `
447
447
  Process queries using the provided context. Structure responses to be concise and relevant.
448
448
  ${S3VECTORS_PROMPT}
@@ -474,7 +474,7 @@ const initialResults = await pgVector.query({
474
474
  // Create a relevance scorer
475
475
  const relevanceProvider = new MastraAgentRelevanceScorer(
476
476
  'relevance-scorer',
477
- 'openai/gpt-5.4',
477
+ 'openai/gpt-5.5',
478
478
  )
479
479
 
480
480
  // Re-rank the results
@@ -11,7 +11,7 @@ import { Agent } from '@mastra/core/agent'
11
11
  export const agent = new Agent({
12
12
  name: 'test-agent',
13
13
  instructions: 'You are an agent with memory.',
14
- model: 'openai/gpt-5.4',
14
+ model: 'openai/gpt-5.5',
15
15
  memory: new Memory({
16
16
  options: {
17
17
  workingMemory: {
@@ -60,7 +60,7 @@ import { LibSQLStore, LibSQLVector } from '@mastra/libsql'
60
60
  export const agent = new Agent({
61
61
  name: 'test-agent',
62
62
  instructions: 'You are an agent with memory.',
63
- model: 'openai/gpt-5.4',
63
+ model: 'openai/gpt-5.5',
64
64
  memory: new Memory({
65
65
  storage: new LibSQLStore({
66
66
  id: 'test-agent-storage',
@@ -97,7 +97,7 @@ import { PgStore, PgVector } from '@mastra/pg'
97
97
  export const agent = new Agent({
98
98
  name: 'pg-agent',
99
99
  instructions: 'You are an agent with optimized PostgreSQL memory.',
100
- model: 'openai/gpt-5.4',
100
+ model: 'openai/gpt-5.5',
101
101
  memory: new Memory({
102
102
  storage: new PgStore({
103
103
  id: 'pg-agent-storage',
@@ -45,7 +45,7 @@ const storage = new PostgresStorage({
45
45
  export const agent = new Agent({
46
46
  name: 'memory-agent',
47
47
  instructions: 'You are a helpful assistant with conversation memory',
48
- model: 'openai/gpt-5.4',
48
+ model: 'openai/gpt-5.5',
49
49
  inputProcessors: [
50
50
  new MessageHistory({
51
51
  storage,
@@ -82,7 +82,7 @@ const semanticRecall = new SemanticRecall({
82
82
  export const agent = new Agent({
83
83
  name: 'semantic-memory-agent',
84
84
  instructions: 'You are a helpful assistant with semantic memory recall',
85
- model: 'openai/gpt-5.4',
85
+ model: 'openai/gpt-5.5',
86
86
  inputProcessors: [semanticRecall, new MessageHistory({ storage, lastMessages: 50 })],
87
87
  outputProcessors: [semanticRecall, new MessageHistory({ storage })],
88
88
  })
@@ -67,7 +67,7 @@ const storage = new PostgresStorage({
67
67
  export const agent = new Agent({
68
68
  name: 'personalized-agent',
69
69
  instructions: 'You are a helpful assistant that remembers user preferences',
70
- model: 'openai/gpt-5.4',
70
+ model: 'openai/gpt-5.5',
71
71
  inputProcessors: [
72
72
  new WorkingMemory({
73
73
  storage,
@@ -332,7 +332,7 @@ export const pgAgent = new Agent({
332
332
  name: 'PG Agent',
333
333
  instructions:
334
334
  'You are an AI agent with the ability to automatically recall memories from previous interactions.',
335
- model: 'openai/gpt-5.4',
335
+ model: 'openai/gpt-5.5',
336
336
  memory: new Memory({
337
337
  storage: new PostgresStore({
338
338
  id: 'pg-agent-storage',
@@ -142,7 +142,7 @@ const queryTool = createVectorQueryTool({
142
142
  indexName: 'documentation',
143
143
  model: new ModelRouterEmbeddingModel('openai/text-embedding-3-small'),
144
144
  reranker: {
145
- model: 'openai/gpt-5.4',
145
+ model: 'openai/gpt-5.5',
146
146
  options: {
147
147
  weights: {
148
148
  semantic: 0.5, // Semantic relevance weight
@@ -401,7 +401,7 @@ export const pgAgent = new Agent({
401
401
  name: 'PG Agent',
402
402
  instructions:
403
403
  'You are an AI agent with the ability to automatically recall memories from previous interactions.',
404
- model: 'openai/gpt-5.4',
404
+ model: 'openai/gpt-5.5',
405
405
  memory: new Memory({
406
406
  storage: new PostgresStore({
407
407
  id: 'pg-agent-storage',
package/dist/index.cjs CHANGED
@@ -4400,10 +4400,10 @@ function rowToTask(row) {
4400
4400
  retryCount: Number(row.retry_count),
4401
4401
  maxRetries: Number(row.max_retries),
4402
4402
  timeoutMs: Number(row.timeout_ms),
4403
- createdAt: row.createdAt instanceof Date ? row.createdAt : new Date(row.createdAt),
4404
- startedAt: row.startedAt ? row.startedAt instanceof Date ? row.startedAt : new Date(row.startedAt) : void 0,
4405
- suspendedAt: row.suspendedAt ? row.suspendedAt instanceof Date ? row.suspendedAt : new Date(row.suspendedAt) : void 0,
4406
- completedAt: row.completedAt ? row.completedAt instanceof Date ? row.completedAt : new Date(row.completedAt) : void 0
4403
+ createdAt: new Date(row.createdAtZ || row.createdAt),
4404
+ startedAt: row.startedAtZ || row.startedAt ? new Date(row.startedAtZ || row.startedAt) : void 0,
4405
+ suspendedAt: row.suspendedAtZ || row.suspendedAt ? new Date(row.suspendedAtZ || row.suspendedAt) : void 0,
4406
+ completedAt: row.completedAtZ || row.completedAt ? new Date(row.completedAtZ || row.completedAt) : void 0
4407
4407
  };
4408
4408
  }
4409
4409
  var BackgroundTasksPG = class _BackgroundTasksPG extends storage.BackgroundTasksStorage {
@@ -4553,15 +4553,21 @@ var BackgroundTasksPG = class _BackgroundTasksPG extends storage.BackgroundTasks
4553
4553
  }
4554
4554
  if ("startedAt" in update) {
4555
4555
  setClauses.push(`"startedAt" = $${paramIdx++}`);
4556
- params.push(update.startedAt?.toISOString() ?? null);
4556
+ setClauses.push(`"startedAtZ" = $${paramIdx++}`);
4557
+ const val = update.startedAt?.toISOString() ?? null;
4558
+ params.push(val, val);
4557
4559
  }
4558
4560
  if ("suspendedAt" in update) {
4559
4561
  setClauses.push(`"suspendedAt" = $${paramIdx++}`);
4560
- params.push(update.suspendedAt?.toISOString() ?? null);
4562
+ setClauses.push(`"suspendedAtZ" = $${paramIdx++}`);
4563
+ const val = update.suspendedAt?.toISOString() ?? null;
4564
+ params.push(val, val);
4561
4565
  }
4562
4566
  if ("completedAt" in update) {
4563
4567
  setClauses.push(`"completedAt" = $${paramIdx++}`);
4564
- params.push(update.completedAt?.toISOString() ?? null);
4568
+ setClauses.push(`"completedAtZ" = $${paramIdx++}`);
4569
+ const val = update.completedAt?.toISOString() ?? null;
4570
+ params.push(val, val);
4565
4571
  }
4566
4572
  if (setClauses.length === 0) return;
4567
4573
  const table = getTableName3(getSchemaName3(this.#schema));
@@ -4853,9 +4859,10 @@ var ChannelsPG = class _ChannelsPG extends storage.ChannelsStorage {
4853
4859
  const schemaName = getSchemaName2(this.#schema);
4854
4860
  const tableName = getTableName2({ indexName: storage.TABLE_CHANNEL_INSTALLATIONS, schemaName });
4855
4861
  const now = (/* @__PURE__ */ new Date()).toISOString();
4862
+ const createdAt = installation.createdAt?.toISOString() ?? now;
4856
4863
  await this.#db.client.none(
4857
- `INSERT INTO ${tableName} ("id", "platform", "agentId", "status", "webhookId", "data", "configHash", "error", "createdAt", "updatedAt")
4858
- VALUES ($1, $2, $3, $4, $5, $6::jsonb, $7, $8, $9, $10)
4864
+ `INSERT INTO ${tableName} ("id", "platform", "agentId", "status", "webhookId", "data", "configHash", "error", "createdAt", "createdAtZ", "updatedAt", "updatedAtZ")
4865
+ VALUES ($1, $2, $3, $4, $5, $6::jsonb, $7, $8, $9, $10, $11, $12)
4859
4866
  ON CONFLICT ("id") DO UPDATE SET
4860
4867
  "platform" = EXCLUDED."platform",
4861
4868
  "agentId" = EXCLUDED."agentId",
@@ -4864,7 +4871,8 @@ var ChannelsPG = class _ChannelsPG extends storage.ChannelsStorage {
4864
4871
  "data" = EXCLUDED."data",
4865
4872
  "configHash" = EXCLUDED."configHash",
4866
4873
  "error" = EXCLUDED."error",
4867
- "updatedAt" = EXCLUDED."updatedAt"`,
4874
+ "updatedAt" = EXCLUDED."updatedAt",
4875
+ "updatedAtZ" = EXCLUDED."updatedAtZ"`,
4868
4876
  [
4869
4877
  installation.id,
4870
4878
  installation.platform,
@@ -4874,7 +4882,9 @@ var ChannelsPG = class _ChannelsPG extends storage.ChannelsStorage {
4874
4882
  JSON.stringify(installation.data),
4875
4883
  installation.configHash ?? null,
4876
4884
  installation.error ?? null,
4877
- installation.createdAt?.toISOString() ?? now,
4885
+ createdAt,
4886
+ createdAt,
4887
+ now,
4878
4888
  now
4879
4889
  ]
4880
4890
  );
@@ -4917,13 +4927,15 @@ var ChannelsPG = class _ChannelsPG extends storage.ChannelsStorage {
4917
4927
  async saveConfig(config) {
4918
4928
  const schemaName = getSchemaName2(this.#schema);
4919
4929
  const tableName = getTableName2({ indexName: storage.TABLE_CHANNEL_CONFIG, schemaName });
4930
+ const now = config.updatedAt.toISOString();
4920
4931
  await this.#db.client.none(
4921
- `INSERT INTO ${tableName} ("platform", "data", "updatedAt")
4922
- VALUES ($1, $2::jsonb, $3)
4932
+ `INSERT INTO ${tableName} ("platform", "data", "updatedAt", "updatedAtZ")
4933
+ VALUES ($1, $2::jsonb, $3, $4)
4923
4934
  ON CONFLICT ("platform") DO UPDATE SET
4924
4935
  "data" = EXCLUDED."data",
4925
- "updatedAt" = EXCLUDED."updatedAt"`,
4926
- [config.platform, JSON.stringify(config.data), config.updatedAt.toISOString()]
4936
+ "updatedAt" = EXCLUDED."updatedAt",
4937
+ "updatedAtZ" = EXCLUDED."updatedAtZ"`,
4938
+ [config.platform, JSON.stringify(config.data), now, now]
4927
4939
  );
4928
4940
  }
4929
4941
  async getConfig(platform) {
@@ -4934,7 +4946,7 @@ var ChannelsPG = class _ChannelsPG extends storage.ChannelsStorage {
4934
4946
  return {
4935
4947
  platform: row.platform,
4936
4948
  data: typeof row.data === "string" ? JSON.parse(row.data) : row.data,
4937
- updatedAt: new Date(row.updatedAt)
4949
+ updatedAt: new Date(row.updatedAtZ || row.updatedAt)
4938
4950
  };
4939
4951
  }
4940
4952
  async deleteConfig(platform) {
@@ -4952,8 +4964,8 @@ var ChannelsPG = class _ChannelsPG extends storage.ChannelsStorage {
4952
4964
  data: typeof row.data === "string" ? JSON.parse(row.data) : row.data,
4953
4965
  configHash: row.configHash || void 0,
4954
4966
  error: row.error || void 0,
4955
- createdAt: row.createdAt instanceof Date ? row.createdAt : new Date(row.createdAt),
4956
- updatedAt: row.updatedAt instanceof Date ? row.updatedAt : new Date(row.updatedAt)
4967
+ createdAt: new Date(row.createdAtZ || row.createdAt),
4968
+ updatedAt: new Date(row.updatedAtZ || row.updatedAt)
4957
4969
  };
4958
4970
  }
4959
4971
  };