insert with InferModel not working

Hey, playing with Drizzle, like it a lot but I am having an issue where I inferred the model of a schema as type NewUser = InferModel<typeof Users, "insert">; and try to insert. It doesn't give an error, simply does nothing. In my app I have it do many different selects so I know the schema is fine and everything is connected and working. Yet when I execute this insert nothing is added to the db.

import { InferModel } from "drizzle-orm";

type NewUser = InferModel<typeof Users, "insert">;
 
const insertUser = async (userNew: NewUser) => {
    return db.insert(Users).values(userNew)
}

async function main() {
    let userNew : NewUser = {
        email: "xxx@xxx.net",
        password: "xxx",
        token: "xxx"
    };
    console.log(userNew);

    await insertUser(userNew);
}

main();


Here is the table schema (sqlite):
export const Users = sqliteTable("users", {
    id: integer("id", { mode: "number" }).primaryKey({ autoIncrement: true }),
    email: text("email").notNull(),
    password: text("password").notNull(),
    token: text("token"),
    createdAt: integer("createdAt", { mode: "timestamp" }).notNull().defaultNow(),
    updatedAt: integer("updatedAt", { mode: "timestamp" }).notNull().defaultNow(),
})
Was this page helpful?