-
Notifications
You must be signed in to change notification settings - Fork 888
Add callout for bun and sqlite #7280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,23 @@ const adapter = new PrismaBetterSqlite3({ | |
| const prisma = new PrismaClient({ adapter }) | ||
| ``` | ||
|
|
||
| :::tip Using SQLite with Bun | ||
| When running Prisma Client on Bun, use the `@prisma/adapter-libsql` driver adapter. Bun doesn't support the native SQLite driver that `better-sqlite3` relies on (see the [`node:sqlite` reference](https://bun.com/reference/node/sqlite)). Instantiate the adapter and pass it to `PrismaClient`: | ||
|
|
||
| ```ts | ||
| import { PrismaClient } from '../prisma/generated/client'; | ||
| import { PrismaLibSql } from '@prisma/adapter-libsql'; | ||
|
|
||
| const adapter = new PrismaLibSql({ | ||
| url: process.env.DATABASE_URL ?? '', | ||
| }); | ||
|
|
||
| const prisma = new PrismaClient({ adapter }); | ||
|
|
||
| export default prisma; | ||
| ``` | ||
| ::: | ||
|
Comment on lines
+69
to
+84
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainClarify the import path for consistency. The Bun tip looks good overall, but there's a subtle inconsistency that could confuse readers: the code example just above (line 61) imports from Consider updating line 73 to use -import { PrismaClient } from '../prisma/generated/client';
+import { PrismaClient } from './generated/prisma';Alternatively, if the different path is intentional to show different project structures, a comment explaining this would help readers. </script> 🏁 Script executed: #!/bin/bash
# Retrieve the SQLite documentation file and examine the import paths around lines 61 and 73
cat content/200-orm/050-overview/500-databases/500-sqlite.mdx | head -90 | tail -40Length of output: 1394 🏁 Script executed: #!/bin/bash
# Get line numbers and context around the imports
sed -n '55,90p' content/200-orm/050-overview/500-databases/500-sqlite.mdx | cat -nLength of output: 1586 🏁 Script executed: #!/bin/bash
# Check if the file exists and get total line count
wc -l content/200-orm/050-overview/500-databases/500-sqlite.mdxLength of output: 61 🏁 Script executed: #!/bin/bash
# Extract the exact lines 61 and 73 with context
echo "=== Around line 61 ===" && sed -n '58,65p' content/200-orm/050-overview/500-databases/500-sqlite.mdx
echo -e "\n=== Around line 73 ===" && sed -n '70,77p' content/200-orm/050-overview/500-databases/500-sqlite.mdxLength of output: 632 🏁 Script executed: #!/bin/bash
# Search for all PrismaClient imports in the file to see the pattern
grep -n "from.*prisma" content/200-orm/050-overview/500-databases/500-sqlite.mdxLength of output: 617 🏁 Script executed: #!/bin/bash
# Get more context around the Bun section to understand the structure
sed -n '65,85p' content/200-orm/050-overview/500-databases/500-sqlite.mdxLength of output: 547 🏁 Script executed: #!/bin/bash
# Look for the entire file structure to understand sections
grep -n "^##\|^:::" content/200-orm/050-overview/500-databases/500-sqlite.mdx | head -20Length of output: 508 🏁 Script executed: #!/bin/bash
# Get the full context of both code examples
sed -n '50,90p' content/200-orm/050-overview/500-databases/500-sqlite.mdxLength of output: 1395 🏁 Script executed: #!/bin/bash
# Verify the exact import statements with full context
rg -n "from.*generated.*prisma" content/200-orm/050-overview/500-databases/500-sqlite.mdx -C 3Length of output: 446 🏁 Script executed: #!/bin/bash
# Get the raw content to understand the structure precisely
head -90 content/200-orm/050-overview/500-databases/500-sqlite.mdx | tail -35Length of output: 1276 🏁 Script executed: #!/bin/bash
# Look for the Bun tip section specifically
sed -n '66,90p' content/200-orm/050-overview/500-databases/500-sqlite.mdxLength of output: 935 🏁 Script executed: #!/bin/bash
# Extract lines 69-84 exactly as flagged in the review
sed -n '69,84p' content/200-orm/050-overview/500-databases/500-sqlite.mdxLength of output: 493 🏁 Script executed: #!/bin/bash
# Get broader context: lines 55-85
sed -n '55,85p' content/200-orm/050-overview/500-databases/500-sqlite.mdxLength of output: 943 🏁 Script executed: #!/bin/bash
# Look for "generated/prisma" pattern throughout the file
rg -n "generated.prisma|generated/client" content/200-orm/050-overview/500-databases/500-sqlite.mdxLength of output: 169 🏁 Script executed: #!/bin/bash
# Find and display the immediate context before the Bun tip
sed -n '54,72p' content/200-orm/050-overview/500-databases/500-sqlite.mdxLength of output: 671 🏁 Script executed: #!/bin/bash
# Comprehensive view of lines 50-90
awk 'NR>=50 && NR<=90' content/200-orm/050-overview/500-databases/500-sqlite.mdxLength of output: 1395 🏁 Script executed: #!/bin/bash
# Exactly what's in the snippet provided in the review
awk 'NR>=60 && NR<=85' content/200-orm/050-overview/500-databases/500-sqlite.mdxLength of output: 741 🏁 Script executed: #!/bin/bash
# Direct extract to validate the claim
sed -n '60,75p' content/200-orm/050-overview/500-databases/500-sqlite.mdxLength of output: 583 🏁 Script executed: #!/bin/bash
# Show all import statements in order
grep -n "^import " content/200-orm/050-overview/500-databases/500-sqlite.mdx | head -30Length of output: 421 🏁 Script executed: #!/bin/bash
# Check the file more carefully
sed -n '1,90p' content/200-orm/050-overview/500-databases/500-sqlite.mdx | tail -35Length of output: 1276 🏁 Script executed: #!/bin/bash
# Simple view
awk 'NR<=90' content/200-orm/050-overview/500-databases/500-sqlite.mdx | awk 'NR>=55'Length of output: 1334 🏁 Script executed: #!/bin/bash
# Final attempt - get file and look at it
head -85 content/200-orm/050-overview/500-databases/500-sqlite.mdx | tail -30Length of output: 885 🏁 Script executed: #!/bin/bash
# Check if file exists first
ls -la content/200-orm/050-overview/500-databases/500-sqlite.mdx 2>&1 || echo "File not found"
fd "500-sqlite" 2>/dev/null || find . -name "*sqlite*" -type f 2>/dev/null | head -10Length of output: 164 🏁 Script executed: #!/bin/bash
# Search for any sqlite related markdown files
find . -name "*sqlite*" -type fLength of output: 257 🏁 Script executed: #!/bin/bash
# Broader search
fd sqliteLength of output: 249 🏁 Script executed: #!/bin/bash
# Look in content directory
ls -la content/200-orm/050-overview/500-databases/ 2>&1 || ls -la content/ 2>&1 | head -20Length of output: 1264 🏁 Script executed: #!/bin/bash
# Try to find the file
rg -l sqlite content/ 2>/dev/null | head -5Length of output: 257 🏁 Script executed: #!/bin/bash
# Check directory structure
find content -type d | head -20Length of output: 896 🏁 Script executed: #!/bin/bash
# List markdown files in the expected location
find content -name "*.mdx" -o -name "*.md" 2>/dev/null | grep -i sqliteLength of output: 214 🏁 Script executed: #!/bin/bash
# General content directory listing
find content -maxdepth 4 -type f 2>/dev/null | grep 500-sqliteLength of output: 57 🏁 Script executed: #!/bin/bash
# Try a simpler approach
ls content/200-orm/050-overview/500-databases/ 2>&1 || echo "Path does not exist"
ls -la . | head -20Length of output: 1515 🏁 Script executed: #!/bin/bash
# Root directory check
pwd && ls -la | head -20Length of output: 1234 🏁 Script executed: #!/bin/bash
# Determine if this is a cloned repo and what's available
git status 2>&1 | head -5 || echo "Not a git repo"
find . -name "*.mdx" | head -10Length of output: 865 🏁 Script executed: #!/bin/bash
# Find any reference to sqlite in the codebase
rg -l "SQLite" . 2>/dev/null | head -5Length of output: 268 🏁 Script executed: #!/bin/bash
# Try to locate the specific file more directly
find . -path "*200-orm*" -name "*.mdx" 2>/dev/nullLength of output: 19476 🏁 Script executed: #!/bin/bash
# Check if we're in the right directory
ls -laLength of output: 1591 🏁 Script executed: #!/bin/bash
# Final comprehensive check
find . -type f -name "*.mdx" 2>/dev/null | head -20Length of output: 1623 🏁 Script executed: #!/bin/bash
# Search for import statements with prisma/generated
rg "PrismaClient.*from.*generated" 2>/dev/nullLength of output: 24079 🏁 Script executed: #!/bin/bash
# Look for the exact strings mentioned in the review
rg "\./generated/prisma|../prisma/generated/client" 2>/dev/nullLength of output: 38292 🏁 Script executed: #!/bin/bash
# Try to see what repositories or files we can access
find . -maxdepth 3 -type f 2>/dev/null | head -30Length of output: 762 🏁 Script executed: #!/bin/bash
# Last attempt - direct file access
cat content/200-orm/050-overview/500-databases/500-sqlite.mdx 2>&1 | head -100Length of output: 4054 Clarify the import paths between the driver adapter examples. The inconsistency is real. Line 61's better-sqlite3 example imports from This is a valid minor issue worth resolving. Recommend either:
The suggested fix to change line 73 to 🤖 Prompt for AI Agents |
||
|
|
||
| ### 3. Configure timestamp format for backward compatibility | ||
|
|
||
| When using driver adapters with SQLite, you can configure how `DateTime` values are stored in the database using the `timestampFormat` option. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.