drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: index shorthand syntax

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

Description

### Describe what you want

similar to short-hand column syntax but for indexes

```ts
mySqlTable(
"table",
{
id: int().primaryKey().autoincrement(),
fooBar: int(),
},
(table) => ({
fooIndex: index().on(table.fooBar) // <-- index name optional
})
)
```

would yield (with snake_case config)

```sql
create table `table` (
`id` int not null auto_increment primary key,
`foo_bar` int,
key foo_index(`foo_bar`)
);
```

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.