feat(ADM-018): completed feature

This commit is contained in:
chattie
2026-08-17 22:23:10 +02:00
parent cf1c69fc8b
commit d595b4871f
871 changed files with 47411 additions and 281 deletions

View File

@@ -0,0 +1,47 @@
/**
* PostgreSQL full-text search support for catalog products.
*/
/** @param {import('node-pg-migrate').MigrationBuilder} pgm */
export const up = (pgm) => {
pgm.sql(`
CREATE INDEX catalog_products_fts_idx
ON catalog_products USING gin (
(
setweight(to_tsvector('spanish', COALESCE(name, '')), 'A') ||
setweight(to_tsvector('spanish', COALESCE(description, '')), 'B') ||
setweight(to_tsvector('spanish', COALESCE(seo_title, '')), 'B') ||
setweight(to_tsvector('spanish', COALESCE(seo_description, '')), 'C')
)
)
`);
pgm.sql(`
CREATE INDEX brands_brands_fts_idx
ON brands_brands USING gin (
(
setweight(to_tsvector('spanish', COALESCE(name, '')), 'A') ||
setweight(to_tsvector('spanish', COALESCE(slug, '')), 'B') ||
setweight(to_tsvector('spanish', COALESCE(seo_title, '')), 'B') ||
setweight(to_tsvector('spanish', COALESCE(seo_description, '')), 'C')
)
)
`);
pgm.sql(`
CREATE INDEX categories_categories_fts_idx
ON categories_categories USING gin (
(
setweight(to_tsvector('spanish', COALESCE(name, '')), 'A') ||
setweight(to_tsvector('spanish', COALESCE(slug, '')), 'B') ||
setweight(to_tsvector('spanish', COALESCE(seo_title, '')), 'B') ||
setweight(to_tsvector('spanish', COALESCE(seo_description, '')), 'C')
)
)
`);
};
/** @param {import('node-pg-migrate').MigrationBuilder} pgm */
export const down = (pgm) => {
pgm.sql('DROP INDEX IF EXISTS categories_categories_fts_idx');
pgm.sql('DROP INDEX IF EXISTS brands_brands_fts_idx');
pgm.sql('DROP INDEX IF EXISTS catalog_products_fts_idx');
};