How do I set a column to be unique in drizzle syntax for mySQL?

CCory4/27/2023
Would something like this be correct?
export const authUsers = mysqlTable(
'auth_users',
{
id: varchar('id', { length: 191 }).primaryKey().notNull(),
username: varchar('username', { length: 191 }).notNull()
},
(table) => {
return {
idKey: uniqueIndex('auth_users_id_key').on(table.id),
usernameKey: uniqueIndex('auth_users_username_key').on(table.username)
};
}
);
export const authUsers = mysqlTable(
'auth_users',
{
id: varchar('id', { length: 191 }).primaryKey().notNull(),
username: varchar('username', { length: 191 }).notNull()
},
(table) => {
return {
idKey: uniqueIndex('auth_users_id_key').on(table.id),
usernameKey: uniqueIndex('auth_users_username_key').on(table.username)
};
}
);
wishing there was a .unique()
UUUnknown User4/27/2023
Message Not Public
Sign In & Join Server To View
CCory4/27/2023
ah okay cool!

Looking for more? Join the community!