chronark
chronark
Explore posts from servers
DTDrizzle Team
Created by chronark on 2/2/2024 in #help
"drizzle-orm/planetscale-serverless/migrator" in cf workers
Hey guys in cf workers you don't have access to the file system, how hard would it be to provide migrations to the migrate function? something like this:
import {migrate} from "drizzle-orm/planetscale-serverless/migrator";

await migarte(db, `CREATE TABLE...`)
import {migrate} from "drizzle-orm/planetscale-serverless/migrator";

await migarte(db, `CREATE TABLE...`)
12 replies
DTDrizzle Team
Created by chronark on 12/11/2023 in #help
planetscale - removing uniqueIndex
Hey there, I'm trying to remove a unique index on planetscale but when I push my schema, it tells me the constraint is not found My change:
(table) => ({
tenantIdIdx: uniqueIndex("tenant_id_idx").on(table.tenantId),
- slugIdx: uniqueIndex("slug_idx").on(table.slug),
}),
(table) => ({
tenantIdIdx: uniqueIndex("tenant_id_idx").on(table.tenantId),
- slugIdx: uniqueIndex("slug_idx").on(table.slug),
}),
pnpm drizzle-kit push:mysql
pnpm drizzle-kit push:mysql
6 replies
DTDrizzle Team
Created by chronark on 12/8/2023 in #help
[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", "_" ]
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)
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?
3 replies