Database
This document describes how to access the database using Drizzle ORM.
import { db } from '$lib/db';import { posts } from '@repo/db/schema';import { eq, desc } from '@repo/db';
const items = await db.query.posts.findMany({ where: eq(posts.status, 'published'), orderBy: desc(posts.createdAt)});await db.insert(posts).values({ title: 'New Post', content: 'Hello World', status: 'draft'});