From 4cbbb43cea262c70533c73d4ca70d4e0e21deaa4 Mon Sep 17 00:00:00 2001 From: "Andres C. Rodriguez" Date: Fri, 12 Apr 2024 19:29:47 -0700 Subject: [PATCH] Fixing wrong case --- src/ddl.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ddl.ts b/src/ddl.ts index 8d2f998..c47ad84 100644 --- a/src/ddl.ts +++ b/src/ddl.ts @@ -93,10 +93,9 @@ export class DDL { static createFullTextIndex(dbType: string, columns: string[], padWidth = 4, table: string, name = "fulltext"): string { const pad = "".padEnd(padWidth); - table = table.toLowerCase(); const wrapper = (columns: string[], s = ",", w = false) => columns.map((c) => w ? "COALESCE(" + c + ",'')" : c).join(s); - if (dbType === DB.Provider.MYSQL) return `${pad}CREATE FULLTEXT INDEX ${table}_${name} ON ${table} (${wrapper(columns, ",")});\n`; - if (dbType === DB.Provider.POSTGRES) return `${pad}CREATE INDEX ${table}_${name} ON ${table} USING GIN (TO_TSVECTOR('english', ${wrapper(columns, "||' '||", true)}));`; + if (dbType === DB.Provider.MYSQL) return `${pad}CREATE FULLTEXT INDEX ${table.toLowerCase()}_${name} ON ${table} (${wrapper(columns, ",")});\n`; + if (dbType === DB.Provider.POSTGRES) return `${pad}CREATE INDEX ${table.toLowerCase()}_${name} ON ${table} USING GIN (TO_TSVECTOR('english', ${wrapper(columns, "||' '||", true)}));`; return ""; }