[solved] database.insert is not a function

Hey friends,
I'm trying to setup drizzle with mysql but can not insert data :/

import { drizzle } from "drizzle-orm/mysql2";
import mysql from "mysql2/promise"

const conn = await mysql.createConnection({
  host: opts.host,
  user: opts.username,
  password: opts.password,
  ssl: { rejectUnauthorized: true }
})
const db = drizzle(conn,
  {
    schema,
    mode: "default"
  },
);

console.log("connected to db", Object.keys(db))
// connected to db [ "dialect", "session", "mode", "query", "_" ]


and then in my app it crashes:
await database.insert(schema.workspaces).values(unkeyWorkspace);
              ^
TypeError: database.insert is not a function. (In 'database.insert(schema.workspaces)', 'database.insert' is undefined)


Has anyone encountered this too?
Was this page helpful?