TypeError unless column is notNull

gave the following error. Object literal may only specify known properties, and <column> does not exist in type: schema.ts:
export const usersSchema = sqliteTable('users', {
id: int().primaryKey({ autoIncrement: true }),
name: text().notNull(),
email: text().notNull().unique(),
verified: int().notNull(),
columnWithError: text(),
});
export const usersSchema = sqliteTable('users', {
id: int().primaryKey({ autoIncrement: true }),
name: text().notNull(),
email: text().notNull().unique(),
verified: int().notNull(),
columnWithError: text(),
});
const user = await db
.insert(usersSchema)
.values({
name: '',
email,
passwordHash,
verified: 0,
columnWithError, // NOT READ FOR SOME REASON
})
const user = await db
.insert(usersSchema)
.values({
name: '',
email,
passwordHash,
verified: 0,
columnWithError, // NOT READ FOR SOME REASON
})
Once I add the .notNull() the error is gone, am I doning something wrong? Thanks.
3 Replies
Yuya
YuyaOP3mo ago
i am facing the same issue when i add a default()
Michael | 1send
Michael | 1send3mo ago
I am getting the same error. Any resolution?
TOSL
TOSL3mo ago
Why are you trying to insert a passwordHash when it isn't a column on your table? At least it's not in code you provided

Did you find this page helpful?