Closed iceleo-com closed 5 days ago
Hi,
I want to create FULLTEXT index full_name on table tbl_user with 3 columns first_name, middle_name, last_name to MySQL database
FULLTEXT
full_name
tbl_user
first_name
middle_name
last_name
But I cannot figure out a good way to do that, except using raw SQL
This is my current code
await db.schema .createIndex('full_name') .ifNotExists() .on('tbl_user') .columns(['first_name', 'middle_name', 'last_name']) .$call((builder) => { const rawSql = builder .compile() .sql .replace( /CREATE((?!(INDEX)).)*INDEX/i, 'CREATE FULLTEXT INDEX', ); console.log(`${rawSql}\n`); return sql.raw(rawSql); }) .execute(db);
I guess the FULLTEXT index creating syntax has not been supported yet.
If you can add a new method to the library, it would be nice. Because there is no guarantee that my code will work in the future. Or any better solutions are helpful too.
Thank you so much for your help!
It's much cleaner and easier to just write the whole thing as raw SQL.
Hi,
I want to create
FULLTEXT
indexfull_name
on tabletbl_user
with 3 columnsfirst_name
,middle_name
,last_name
to MySQL databaseBut I cannot figure out a good way to do that, except using raw SQL
This is my current code
I guess the FULLTEXT index creating syntax has not been supported yet.
If you can add a new method to the library, it would be nice. Because there is no guarantee that my code will work in the future. Or any better solutions are helpful too.
Thank you so much for your help!