makaron pelnoziarnisty
makaron pelnoziarnisty
Explore posts from servers
HHono
Created by predaytor on 4/16/2024 in #help
How to setup Hono with Remix/Cloudflare for Vite dev server?
@predaytor Hi, I have a similar problem. Have you managed to make it work?
11 replies
DTDrizzle Team
Created by makaron pelnoziarnisty on 2/8/2024 in #help
Cannot read properties of undefined (reading 'columns')
Seems to work after switching to local database server, so its fine for now, although I'd love it to work with Turso db server
5 replies
DTDrizzle Team
Created by makaron pelnoziarnisty on 2/8/2024 in #help
Cannot read properties of undefined (reading 'columns')
// Database Client
// db.ts
import { drizzle } from "drizzle-orm/libsql";
import { createClient } from "@libsql/client";
import * as users from "./schemas/users";

const databaseURL = process.env.DB_URL;
if (!databaseURL) {
throw new Error("DB_URL is not set");
}

const client = createClient({
url: databaseURL,
authToken: process.env.DB_TOKEN,
});

const db = drizzle(client, {
schema: { ...users },
});

export default db;
// Database Client
// db.ts
import { drizzle } from "drizzle-orm/libsql";
import { createClient } from "@libsql/client";
import * as users from "./schemas/users";

const databaseURL = process.env.DB_URL;
if (!databaseURL) {
throw new Error("DB_URL is not set");
}

const client = createClient({
url: databaseURL,
authToken: process.env.DB_TOKEN,
});

const db = drizzle(client, {
schema: { ...users },
});

export default db;
// drizzle.config.ts
import type { Config } from "drizzle-kit";

export default {
schema: "./app/lib/db/schemas/*",
out: "./app/lib/db/migrations",
driver: "turso",
dbCredentials: {
url: DB_URL,
authToken: DB_TOKEN,
},
verbose: true,
strict: true,
} satisfies Config;
// drizzle.config.ts
import type { Config } from "drizzle-kit";

export default {
schema: "./app/lib/db/schemas/*",
out: "./app/lib/db/migrations",
driver: "turso",
dbCredentials: {
url: DB_URL,
authToken: DB_TOKEN,
},
verbose: true,
strict: true,
} satisfies Config;
5 replies
DTDrizzle Team
Created by makaron pelnoziarnisty on 7/4/2023 in #help
Delete limit
um, im not sure what you mean I just want to delete any dog of the given breed Can I do better than this?:
// I suppose it is more beneficial to wrap it up in a transaction function
await db.transaction(async (tx) => {
const dog = await tx.query.dogs.findFirst({
where: (dogs, { eq }) => eq(dogs.breed, 'husky')
});

await db.delete(dogs).where(eq(dogs.id, dog.id));
});
// I suppose it is more beneficial to wrap it up in a transaction function
await db.transaction(async (tx) => {
const dog = await tx.query.dogs.findFirst({
where: (dogs, { eq }) => eq(dogs.breed, 'husky')
});

await db.delete(dogs).where(eq(dogs.id, dog.id));
});
11 replies
DTDrizzle Team
Created by makaron pelnoziarnisty on 7/4/2023 in #help
Delete limit
No other way to do it with just one query rn?
11 replies
DTDrizzle Team
Created by makaron pelnoziarnisty on 7/4/2023 in #help
Delete limit
yeah but Id need to make a query first right?
11 replies
DTDrizzle Team
Created by makaron pelnoziarnisty on 6/17/2023 in #help
Full Text Search
3 replies
DTDrizzle Team
Created by makaron pelnoziarnisty on 6/8/2023 in #help
Error when running drizzle-kit generate:mysql
yep that was it, thanks
5 replies
DTDrizzle Team
Created by makaron pelnoziarnisty on 5/14/2023 in #help
Connecting to Vercel Postgres
I managed to make it work 👍
6 replies
DTDrizzle Team
Created by makaron pelnoziarnisty on 5/14/2023 in #help
Connecting to Vercel Postgres
Okay, I've just found the solution. I'm using SvelteKit which uses Vite and apparently Vite does not expose .env variables on process.env by default. Here's the solution: https://github.com/vercel/storage/tree/main/packages/postgres#a-note-for-vite-users
6 replies
DTDrizzle Team
Created by makaron pelnoziarnisty on 4/12/2023 in #help
Config in Typescript?
Oh yeah thats true thanks
4 replies
DTDrizzle Team
Created by makaron pelnoziarnisty on 4/5/2023 in #help
Wrong type on decimals
yep this is mysql
7 replies
DTDrizzle Team
Created by makaron pelnoziarnisty on 4/3/2023 in #help
Left join with JSON
Okay thank you
6 replies
DTDrizzle Team
Created by makaron pelnoziarnisty on 4/3/2023 in #help
Left join with JSON
6 replies