@hogsend/db 0.12.1 → 0.13.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.
@@ -155,6 +155,13 @@
155
155
  "when": 1781074519747,
156
156
  "tag": "0021_stiff_psynapse",
157
157
  "breakpoints": true
158
+ },
159
+ {
160
+ "idx": 22,
161
+ "version": "7",
162
+ "when": 1781101598164,
163
+ "tag": "0022_ftux_journey_states_updated_at_idx",
164
+ "breakpoints": true
158
165
  }
159
166
  ]
160
167
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hogsend/db",
3
- "version": "0.12.1",
3
+ "version": "0.13.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/migrate.ts CHANGED
@@ -78,10 +78,13 @@ export async function migrateTrack(opts: MigrateTrackOptions): Promise<void> {
78
78
 
79
79
  function createMigrateClient(databaseUrl: string): { client: Client; db: Db } {
80
80
  // Single dedicated connection. `idle_timeout: 0` keeps it from dropping
81
- // mid-run.
81
+ // mid-run. `onnotice` swallows Postgres NOTICEs (e.g. `CREATE SCHEMA IF NOT
82
+ // EXISTS` reporting `schema "drizzle" already exists, skipping`) which
83
+ // postgres-js otherwise dumps as raw objects mid-output.
82
84
  const client = postgres(databaseUrl, {
83
85
  max: 1,
84
86
  idle_timeout: 0,
87
+ onnotice: () => {},
85
88
  connection: { application_name: "hogsend-migrate" },
86
89
  });
87
90
  return { client, db: drizzle(client) };
@@ -50,5 +50,8 @@ export const journeyStates = pgTable(
50
50
  table.journeyId,
51
51
  table.status,
52
52
  ),
53
+ // Time-windowed activity counts (GET /v1/health) range-scan on updatedAt —
54
+ // without this the healthcheck seq-scans the whole table on every hit.
55
+ index("journey_states_updated_at_idx").on(table.updatedAt),
53
56
  ],
54
57
  );