Email does not exist on user table

I'm having problems signing users up. I keep getting email does not exist on users table even though I have it set up.
export const auth: any = betterAuth({
user: {
modelName: "users",
fields: {
emailVerified: "email_verified",
createdAt: "created_at",
updatedAt: "updated_at",
},
}
})
export const auth: any = betterAuth({
user: {
modelName: "users",
fields: {
emailVerified: "email_verified",
createdAt: "created_at",
updatedAt: "updated_at",
},
}
})
export const users = sqliteTable("users", {
id: text("id")
.unique()
.primaryKey()
.notNull(),
createdAt: integer("created_at", { mode: "timestamp" }),
updatedAt: integer("updated_at", { mode: "timestamp" }),
image: text("image"),
name: text("name", { length: 100 }).notNull(),
lastName: text("last_name", { length: 100 }),
phoneNumber: text("phone_number", { length: 20 }),
email: text("email").notNull().unique(),
stripeCustomerId: text("stripe_customer_id").unique(),
stripeSubscriptionId: text("stripe_subscription_id").unique(),
subscriptionExpiresAt: text("subscription_expires_at"),
role: text("role", {
length: 20,
enum: ["user", "owner", "pro", "admin"],
})
.default("owner")
.notNull(),
emailVerified: integer("email_verified", { mode: "boolean" })
.default(false)
.notNull(),
});
export const users = sqliteTable("users", {
id: text("id")
.unique()
.primaryKey()
.notNull(),
createdAt: integer("created_at", { mode: "timestamp" }),
updatedAt: integer("updated_at", { mode: "timestamp" }),
image: text("image"),
name: text("name", { length: 100 }).notNull(),
lastName: text("last_name", { length: 100 }),
phoneNumber: text("phone_number", { length: 20 }),
email: text("email").notNull().unique(),
stripeCustomerId: text("stripe_customer_id").unique(),
stripeSubscriptionId: text("stripe_subscription_id").unique(),
subscriptionExpiresAt: text("subscription_expires_at"),
role: text("role", {
length: 20,
enum: ["user", "owner", "pro", "admin"],
})
.default("owner")
.notNull(),
emailVerified: integer("email_verified", { mode: "boolean" })
.default(false)
.notNull(),
});
3 Replies
Shaki
ShakiOP4mo ago
I ran the migrations and can even see the email field when I open drizzle studio on the users table
bekacru
bekacru4mo ago
remove your fields config. Better Auth doesn't interact with the db directly if you're using drizzle adapter. so emailVerified is still db.emailVerified not db.["email_verified"]
Shaki
ShakiOP4mo ago
Still getting same error. The field "email" does not exist in the schema for the model "user". Please update your schema

Did you find this page helpful?