What does this section of the docs mean?

Under the docs for indexes and constraints it says that drizzle kit only supports index name and on() param. What does this mean? Would the following not work with drizzle kit then?
export const users = mysqlTable("users", {
clerkID: varchar("clerk_id", {length: 255}).notNull().primaryKey(),
email: varchar("email", {length: 255}).notNull(),
publicUsername: varchar("public_username", {length: 50}).notNull(),
}, (table) => {
return {
publicUsernameIdx: uniqueIndex("public_username_idx").on(table.publicUsername)
}
});
export const users = mysqlTable("users", {
clerkID: varchar("clerk_id", {length: 255}).notNull().primaryKey(),
email: varchar("email", {length: 255}).notNull(),
publicUsername: varchar("public_username", {length: 50}).notNull(),
}, (table) => {
return {
publicUsernameIdx: uniqueIndex("public_username_idx").on(table.publicUsername)
}
});
1 Reply
Andrii Sherman
It will work; it just means that drizzle-kit will use only the index name and columns to create an index. If you specify where/using/etc., it won't be applied in migrations automatically, and you'll need to add it manually. This is something we are going to add to drizzle-kit in the next release or the release after next together wioth unique constraint btw
Want results from more Discord servers?
Add your server