Unable to read error message when inserting withdb.insert().values()

Hey there, i am using visual studio code and am developing with nuxt3. I am trying to insert an object but I am getting an error message that is very difficult to read. Am I doing something wrong? I have no idea what's wrong looking at this..
4 Replies
Martacus
MartacusOP14mo ago
No description
Martacus
MartacusOP14mo ago
Okay so my bad, I had wrong types for the createdAt and updatedAt. The error is very complicated and my eyes just couldnt really focus. In the schema I added .defaultNow() to them. Will updatedAt be updated on every edit to the row?

export const users = pgTable("user", {
id: uuid('id').defaultRandom().primaryKey(),
name: text("name").notNull(),
email: text("email").notNull(),
password: text("password").notNull(),
createdAt: timestamp("created_at").notNull().defaultNow(),
updatedAt: timestamp("updated_at").notNull().defaultNow()
});

export const users = pgTable("user", {
id: uuid('id').defaultRandom().primaryKey(),
name: text("name").notNull(),
email: text("email").notNull(),
password: text("password").notNull(),
createdAt: timestamp("created_at").notNull().defaultNow(),
updatedAt: timestamp("updated_at").notNull().defaultNow()
});
Angelelz
Angelelz14mo ago
No, defaultNot is only for insertion Pg doesn't have an on update clause I think people use triggers for stuff like this
Martacus
MartacusOP14mo ago
tyty
Want results from more Discord servers?
Add your server