drizzle-team/drizzle-orm

[FEATURE]: index shorthand syntax

Opened this issue · 0 comments

Describe what you want

similar to short-hand column syntax but for indexes

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

would yield (with snake_case config)

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