feat(scanner): add debug instrumentation for vision pipeline timing #155
3 changed files with 45 additions and 6 deletions
|
|
@ -7,7 +7,13 @@
|
||||||
* 1. `collection_permissions` (collaboration roles + invite tokens)
|
* 1. `collection_permissions` (collaboration roles + invite tokens)
|
||||||
* 2. `collection_activity` (audit-trail with JSONB details)
|
* 2. `collection_activity` (audit-trail with JSONB details)
|
||||||
* 3. `users.is_pending` (column for invited-but-not-yet-accepted users)
|
* 3. `users.is_pending` (column for invited-but-not-yet-accepted users)
|
||||||
* 4. 4 indexes for query hot-paths
|
* 4. 3 indexes on the tables this migration creates
|
||||||
|
*
|
||||||
|
* `idx_collections_visibility` is NOT created here. This file's timestamp
|
||||||
|
* runs before `1781442330002_reconcile-collections-columns`, which is the
|
||||||
|
* migration that adds `collections.visibility`. Creating the index here
|
||||||
|
* fails on a fresh CI database (`column "visibility" does not exist`).
|
||||||
|
* The index ships in `1786757312884_add-collections-visibility-index`.
|
||||||
*
|
*
|
||||||
* `lib/permission-middleware.js` reads `collection_permissions` in
|
* `lib/permission-middleware.js` reads `collection_permissions` in
|
||||||
* `withCollectionPermission` and writes `collection_activity` from
|
* `withCollectionPermission` and writes `collection_activity` from
|
||||||
|
|
@ -74,8 +80,6 @@ export const up = (pgm) => {
|
||||||
ON collection_permissions(user_id);
|
ON collection_permissions(user_id);
|
||||||
CREATE INDEX IF NOT EXISTS idx_collection_activity_collection_id
|
CREATE INDEX IF NOT EXISTS idx_collection_activity_collection_id
|
||||||
ON collection_activity(collection_id);
|
ON collection_activity(collection_id);
|
||||||
CREATE INDEX IF NOT EXISTS idx_collections_visibility
|
|
||||||
ON collections(visibility);
|
|
||||||
`);
|
`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,11 @@
|
||||||
*
|
*
|
||||||
* Excluded from B2 (out of scope per architect inventory):
|
* Excluded from B2 (out of scope per architect inventory):
|
||||||
* - `collection_permissions`, `collection_activity`, `users.is_pending`,
|
* - `collection_permissions`, `collection_activity`, `users.is_pending`,
|
||||||
* `idx_collections_visibility`, `idx_collection_permissions_*`,
|
* `idx_collection_permissions_*`, `idx_collection_activity_collection_id`
|
||||||
* `idx_collection_activity_collection_id` — these belong to B3
|
* — B3 (`reconcile-collaboration-tables`).
|
||||||
* (`reconcile-collaboration-tables`) per the architect plan.
|
* `idx_collections_visibility` — ships in
|
||||||
|
* `1786757312884_add-collections-visibility-index` (B3's timestamp
|
||||||
|
* precedes this file's `visibility` column add).
|
||||||
* - `is_system_collection` — already captured by
|
* - `is_system_collection` — already captured by
|
||||||
* `migrations/1780378340194_system-collection-description.js`.
|
* `migrations/1780378340194_system-collection-description.js`.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
33
migrations/1786757312884_add-collections-visibility-index.js
Normal file
33
migrations/1786757312884_add-collections-visibility-index.js
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
/**
|
||||||
|
* Create `idx_collections_visibility` after `collections.visibility` exists.
|
||||||
|
*
|
||||||
|
* `1781000000003_reconcile-collaboration-tables` originally created this
|
||||||
|
* index, but that file's timestamp runs before
|
||||||
|
* `1781442330002_reconcile-collections-columns` adds the column. Fresh CI
|
||||||
|
* databases failed with `column "visibility" does not exist`.
|
||||||
|
*
|
||||||
|
* Idempotent: `IF NOT EXISTS` no-ops on envs where the historical
|
||||||
|
* collaboration script or the original B3 statement already built the index.
|
||||||
|
*
|
||||||
|
* @type {import('node-pg-migrate').ColumnDefinitions | undefined}
|
||||||
|
*/
|
||||||
|
export const shorthands = undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('node-pg-migrate').MigrationBuilder} pgm
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
export const up = (pgm) => {
|
||||||
|
pgm.sql(`
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_collections_visibility
|
||||||
|
ON collections(visibility);
|
||||||
|
`);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('node-pg-migrate').MigrationBuilder} pgm
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
export const down = (pgm) => {
|
||||||
|
pgm.sql('DROP INDEX IF EXISTS idx_collections_visibility');
|
||||||
|
};
|
||||||
Loading…
Reference in a new issue