Dayblox
Dayblox
Explore posts from servers
DTDrizzle Team
Created by Dayblox on 4/2/2024 in #help
prepared statements placeholder typing
Schema
const users = sqliteTable("user", {
id: text("id").primaryKey(),
text: text("text"),
})
const users = sqliteTable("user", {
id: text("id").primaryKey(),
text: text("text"),
})
const updateUser = db
.update(users)
.set({ text: sql.placeholder("text") })
.where(eq(users.id, sql.placeholder("id")))
.prepare()
const updateUser = db
.update(users)
.set({ text: sql.placeholder("text") })
.where(eq(users.id, sql.placeholder("id")))
.prepare()
On the text property I get the following
Type 'Placeholder<"text", any>' is not assignable to type 'string | SQL<unknown> | null | undefined'.
Type 'Placeholder<"text", any>' is not assignable to type 'string | SQL<unknown> | null | undefined'.
The issue only seems to occur in the set part, is there a reason? A better way?
5 replies
DTDrizzle Team
Created by Dayblox on 10/26/2023 in #help
URL_INVALID
The env variables are defined when using bun run push but not when using npm run push or pnpm run push, resulting in LibsqlError: URL_INVALID: The URL is not in a valid format because url is undefined?authToken=undefined
export default {
schema: "./src/db/schema.ts",
out: "./src/db/migrations",
driver: "libsql",
dbCredentials: {
url: `${process.env.DATABASE_URL}?authToken=${process.env.DATABASE_TOKEN}`,
},
} satisfies Config
export default {
schema: "./src/db/schema.ts",
out: "./src/db/migrations",
driver: "libsql",
dbCredentials: {
url: `${process.env.DATABASE_URL}?authToken=${process.env.DATABASE_TOKEN}`,
},
} satisfies Config
{
"scripts": {
"push": "drizzle-kit push:sqlite"
},
// ...
}
{
"scripts": {
"push": "drizzle-kit push:sqlite"
},
// ...
}
7 replies