DT
Drizzle Teamβ€’10mo ago
babakfp

Are there any examples with Drizzle + SvelteKit + `better-sqlite3`?

Hi, I can't get drizzle working, error after error (lol). I'm looking for something bare minimum that works! I'm getting this error:
SqliteError: no such table: users
SqliteError: no such table: users
I ran this but didn't fix it:
pnpm drizzle-kit generate
pnpm drizzle-kit generate
Thanks.
6 Replies
gh680
gh680β€’10mo ago
Did you try pnpm drizzle-kit push:sqlite ?
Startup Spells πŸͺ„ Newsletter Guy
yeah this should fix it in development. but im also getting the same error in production. what do i do in production?
babakfp
babakfpOPβ€’10mo ago
This did the trick, thanks 🌸🌸
Startup Spells πŸͺ„ Newsletter Guy
@babakfp i've written some things in my README.md of https://github.com/deadcoder0904/easypanel-nextjs-sqlite/tree/main that i haven't commited to git yet but it will be in the same repo. here's what it says: Development Side 1. pnpm db:generate generates migration files for development at /src/app/db/migrations 2. pnpm db:migrate generates users.dev.sqlite for development 3. pnpm turbo or pnpm dev runs the local server. 4. if you try to interact with database by clicking add, delete, or get buttons, then it creates *.sqlite-shm or *.sqlite-wal files. read more about wal mode at https://til.simonwillison.net/sqlite/enabling-wal-mode.
GitHub
GitHub - deadcoder0904/easypanel-nextjs-sqlite: Trying to get Next....
Trying to get Next.js + SQLite combo working on Easypanel - deadcoder0904/easypanel-nextjs-sqlite
Startup Spells πŸͺ„ Newsletter Guy
basically, migration files are needed only so you know the final schema as a developer. but if you are still trying to make things work, you can use drizzle-kit:push command when your schema isn't fixed. drizzle-kit:migrate should be run when you finalized your database schema & got everything working. so when things go south in future, you know what database queries to be reverted to. idk enough about databases but there are things called rollback, etc.. on production, you only need drizzle-kit:generate to generate database like *.sqlite file in my case so someone can store data in it.
babakfp
babakfpOPβ€’9mo ago
Thank you for your explanations. Can you help me up deploying this project on Vercel, please? https://discord.com/channels/1043890932593987624/1206258952657043487/1206258952657043487
Want results from more Discord servers?
Add your server