Drizzle types error

Hello, I have this schema:
export const applications = pgTable('applications', {
id: uuid('id').primaryKey().defaultRandom(),
status: applicationStatus('status').notNull().default('pending'),
type: applicationType('type').notNull(),
createdAt: timestamp('created_at').defaultNow().notNull(),
updatedAt: timestamp('updated_at').defaultNow().notNull(),
userId: uuid('user_id').references(() => users.id).notNull(),
details: jsonb('details').notNull(),
reviewerId: uuid('reviewer_id').references(() => admins.id),
});
export const applications = pgTable('applications', {
id: uuid('id').primaryKey().defaultRandom(),
status: applicationStatus('status').notNull().default('pending'),
type: applicationType('type').notNull(),
createdAt: timestamp('created_at').defaultNow().notNull(),
updatedAt: timestamp('updated_at').defaultNow().notNull(),
userId: uuid('user_id').references(() => users.id).notNull(),
details: jsonb('details').notNull(),
reviewerId: uuid('reviewer_id').references(() => admins.id),
});
I'm trying to update it here:
const [application] = await this.db.update(schema.applications)
.set({
status,
updatedAt: new Date()
})
.where(eq(schema.applications.id, id))
.returning();
const [application] = await this.db.update(schema.applications)
.set({
status,
updatedAt: new Date()
})
.where(eq(schema.applications.id, id))
.returning();
However, I get this error for both status and updatedAt:
Object literal may only specify known properties, and 'status' does not exist in type '{ type?: SQL<unknown> |....
Object literal may only specify known properties, and 'status' does not exist in type '{ type?: SQL<unknown> |....
In fact, the only known properties seem to be details, type, and userId. also all fields are there in the database
1 Reply
Kuba
Kuba3mo ago
Can you create a https://drizzle.run/ ?
Drizzle Run
Drizzle Run
Want results from more Discord servers?
Add your server