DT
Join ServerDrizzle Team
help
Create GIN index in Postgres
I need to create this index in postgres:
and this is the code I have:
Reading the docs on GitHub I was able to create "normal" index, but it's not clear how to specify index configuration options (like the type of index etc).
CREATE INDEX users_name_gin_trgm_idx ON users USING gin (name gin_trgm_ops);
and this is the code I have:
export const UserModel = pgTable(
'users',
{
id: serial('id').primaryKey(),
name: varchar('name'),
email: varchar('email', { length: 255 })
},
(table) => {
return {
name: index('name').on(table.name)
// SPACE FOR INDEX DECLARATION!
};
}
);
Reading the docs on GitHub I was able to create "normal" index, but it's not clear how to specify index configuration options (like the type of index etc).
what I tried (not working):
...
(table) => {
return {
name: index('name')
.on(table.name)
.using(sql`gin (${table.name} gin_trgm_ops)`)
};
}
}
...
Maybe it's something related with this limitation?