34 lines
1,016 B
JavaScript
34 lines
1,016 B
JavaScript
|
|
/**
|
||
|
|
* 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');
|
||
|
|
};
|