drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: default naming convention for index

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

Description

### Feature hasn't been suggested before.

- [X] I have verified this feature I'm about to request hasn't been suggested before.

### Describe the enhancement you want to request

(This may be SQLite specific)

Right now the `index` method from `drizzle-orm/sqlite-core` requires a name for index:

```ts
(t) => [index().on(t.code, t.name)] // => Expected 1 arguments, but got 0.
```

I've been using my own helper method (wrapper around `index` and `uniqueIndex`) to automatically assign it a unique index name such as `index_users_code_name`, but I've been needing the helper in all of my projects.

I believe ORM should offer a sane and safe default that covers 90% of use cases.

That way, users are only expected to give it a name when they feel they absolutely need it, like when >62 chars.

https://blog.saeloun.com/2023/10/24/rails-index-name-too-long/

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.