Deleted_user_f8439ab4ed59
Explore posts from serversDTDrizzle Team
•Created by Deleted_user_f8439ab4ed59 on 9/12/2024 in #help
how to do one to many?
hello everyone i am having some problems doing a one to many relation and select on a post schema i have. for context i get this error when ever i try to make a query using the where and with here is my select statement and here is my schema:
13 replies
DTDrizzle Team
•Created by Deleted_user_f8439ab4ed59 on 7/21/2024 in #help
how to use booleans in dizzle?
i have succesfully followed the drizzle docs on how to use booleans but i get a weird error:
Type 'MySqlBooleanBuilderInitial<"isFeatured">' is not assignable to type 'PgColumnBuilderBase<ColumnBuilderBaseConfig<ColumnDataType, string>, object>'.
The types of '_.dialect' are incompatible between these types.
Type '"mysql"' is not assignable to type '"pg"'.ts(2322)
here is my table: export const articles = pgTable("p_articles", {
id: serial("id").primaryKey(),
userId: text("userId")
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
title: text("title").notNull(),
description: text("description").notNull(),
isFeatured: boolean("isFeatured"),
imageUrl: text("imageUrl").notNull(),
createdDate: timestamp("timestamp", { mode: "date" }).notNull(),
});
3 replies
DTDrizzle Team
•Created by Deleted_user_f8439ab4ed59 on 6/1/2024 in #help
Error: Cannot read properties of undefined (reading 'findMany')
import { auth } from "@/auth";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { SignIn } from "@/components/ui/signin";
import { SignOut } from "@/components/ui/signout";
import { database } from "@/db/database";
import { items } from "@/db/schema";
import { revalidatePath } from "next/cache";
export default async function Home() {
const session = await auth();
const allItems = await database.query.items.findMany();
if (!session) {
return <SignIn />;
}
const user = session.user;
if (!user) {
return <SignIn />;
}
return (
<main className="container mx-auto py-12">
{session ? <SignOut /> : <SignIn />}
<form
action={async (formData: FormData) => {
"use server";
await database.insert(items).values({
name: formData.get("name") as string,
userId: session?.user?.id!,
});
revalidatePath("/");
}}
>
<Input name="name" placeholder="name your item" />
<Button type="submit">post item</Button>
{allItems.map((item) => (
<div key={item.id}>{item.name}</div>
))}
</form>
</main>
);
}
3 replies
DTDrizzle Team
•Created by Deleted_user_f8439ab4ed59 on 5/30/2024 in #help
unable to run drizzle studio
12 replies
TTCTheo's Typesafe Cult
•Created by Deleted_user_f8439ab4ed59 on 5/21/2024 in #questions
Noob, I tried to follow along with the docs but got a different file structure.
Hello, I recently tried to learn the T3 stack and decided to use the official T3 docs. However, I got confused when I ran npm create t3-app@latest and got a different file structure than the one shown at https://create.t3.gg/en/folder-structure anyway my question is how can i get the showen folder-structure
11 replies