26 lines
635 B
JavaScript
26 lines
635 B
JavaScript
|
|
/**
|
||
|
|
* Enable pg_trgm + GIN index on cards.name for Layer-1 OCR text matching.
|
||
|
|
*
|
||
|
|
* @type {import('node-pg-migrate').ColumnDefinitions | undefined}
|
||
|
|
*/
|
||
|
|
export const shorthands = undefined;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @param {import('node-pg-migrate').MigrationBuilder} pgm
|
||
|
|
*/
|
||
|
|
export const up = (pgm) => {
|
||
|
|
pgm.sql(`
|
||
|
|
CREATE EXTENSION IF NOT EXISTS pg_trgm;
|
||
|
|
|
||
|
|
CREATE INDEX IF NOT EXISTS idx_cards_name_trgm
|
||
|
|
ON cards USING gin (name gin_trgm_ops);
|
||
|
|
`);
|
||
|
|
};
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @param {import('node-pg-migrate').MigrationBuilder} pgm
|
||
|
|
*/
|
||
|
|
export const down = (pgm) => {
|
||
|
|
throw new Error('Down migration not supported for add-pg-trgm-card-name-index');
|
||
|
|
};
|