drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: indexes on materialized views

Open
#2,976 16 comments 83 reactions 0 assignees View on GitHub
db/postgres drizzle/kit enhancement
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

Currently it is not possible to add indexes on materialized views.

The [documentation](https://orm.drizzle.team/docs/indexes-constraints#indexes) explains quite well how to create indexes on tables. This is done by providing the third argument to pgTable call, like this:
```ts
export const user = pgTable("user", {
id: serial("id").primaryKey(),
name: text("name"),
email: text("email"),
}, (table) => {
return {
nameIdx: index("name_idx").on(table.name),
emailIdx: uniqueIndex("email_idx").on(table.email),
};
});
```

However, `pgMaterializedView` does not accept a third argument at all, even though it is possible to add indexes on materialized views in postgresql. Please add a possibility to define indexes on materialized views. 🙏🏼

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.