Drizzle TeamDT
Drizzle Team3y ago
9 replies
pdina

Create GIN index in Postgres

I need to create this index in postgres:

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).
Was this page helpful?