Why {unique:true} doesn't throw?

If I add 3 users with the same email address, it adds them without any issue. How can I make sure the email is unique?

I also tried with:
email: varchar('email', { length: 256, unique: true, notNull: true }).primaryKey()


const users = pgTable('users', {
    id: uuid('id').defaultRandom().primaryKey(),
    email: text('email', { length: 256, unique: true, notNull: true }),
    created_at: timestamp('created_at').notNull().defaultNow(),
})
Was this page helpful?