Startup Spells 🪄 Newsletter Guy
DTDrizzle Team
•Created by Startup Spells 🪄 Newsletter Guy on 3/22/2024 in #help
How to set timestamp for `created_at` in Drizzle on SQLite?
I found SQLite using https://stackoverflow.com/questions/14461851/how-to-have-an-automatic-timestamp-in-sqlite but not using Drizzle
2 replies
DTDrizzle Team
•Created by Startup Spells 🪄 Newsletter Guy on 2/14/2024 in #help
Close SQLite connection in Next.js API routes for `next build` command to work?
So I got
Database is locked
error when I'm doing next build
like this when I'm building docker image. the command underneath is next build
which builds for production. this command calls all api routes:
my file is:
how do i solve this?
there is a .close()
on client but not on db
? there's a singleton pattern which i haven't tried for sqlite.
what would you do?
i believe this should work & it does locally at least but not with docker.
the problem is it sometimes builds perfectly & randomly fails when i delete previously build. so its hard to debug.3 replies
DTDrizzle Team
•Created by Startup Spells 🪄 Newsletter Guy on 2/13/2024 in #help
SQLite Error: Database is locked with Docker + Next.js + Drizzle
My
docker-compose.yml
is:
my Dockerfile
is huge but the relevant bits are:
i do it in production just like i do it in development.
i don't think i need migrate at all in production so i sometimes comment it out. i probably need to copy migrations
folder into production i guess. can someone correct me here?
anyhow, i get database locked error at the npm run build
command that next.js needs to build production builds.
i've detailed my question on stackoverflow as discord doesn't allow long-form code without going over character limit.
https://stackoverflow.com/q/77986435/6141587
please take a look if you got sqlite + drizzle working on docker? there are few resources on this. many are complicated af.1 replies
DTDrizzle Team
•Created by Startup Spells 🪄 Newsletter Guy on 2/8/2024 in #help
`no such table: user` in production with drizzle + sqlite + next.js?
i have 2 sqlite databases:
1.
example.dev.sqlite
- for development
2. example.prod.sqlite
- for production
i know how to use drizzle in development but i'm having a problem in production.
in development, i do pnpm db:generate
to generate migrations & pnpm db:push
to create tables.
what should i do in production to generate tables? do i have to run the same pnpm db:push
script?
my sqlite file is in docker swarm so the location is a bit different.
my drizzle.config.ts
file looks like:
would i need to change DATABASE_PATH
. im confused here as i am unable to get it to work in production?
my goal is to simply get the production sqlite database working. if anyone has done it before, lmk what's the process? google didn't help much.7 replies
DTDrizzle Team
•Created by Startup Spells 🪄 Newsletter Guy on 1/25/2024 in #help
How to run generate & migrate in production on a VPS for SQLite Database?
So I have a database in development that I run
db:generate
& db:migrate
on to create the database & then run my app that uses it.
But how do I do that in production when I can't run direct commands. I'm using https://easypanel.io on a self-hosted VPS.
Do I just use pre-scripts or post-scripts? What is the recommended way to go about it?5 replies
DTDrizzle Team
•Created by Startup Spells 🪄 Newsletter Guy on 7/20/2023 in #help
Confused about Relationships in Drizzle?
i have relationships like this in https://lucia-auth.com
and my code in drizzle looks like:
i would love to know if it's correct or wrong? idk coding relationships was a bit confusing in drizzle.
11 replies
DTDrizzle Team
•Created by Startup Spells 🪄 Newsletter Guy on 6/22/2023 in #help
Drizzle Kit Push & Generate gives weird error
I get the following error:
the full code is here -> https://github.com/deadcoder0904/next-13-lucia-auth-drizzle-turso-sqlite-magic-link/tree/main
pnpm db:push
& pnpm db:generate
don't work for some reason.5 replies
DTDrizzle Team
•Created by Startup Spells 🪄 Newsletter Guy on 6/21/2023 in #help
Unable to delete all rows from SQLite using Transactions?
i have a route
api/delete-all
that looks like:
i want to delete all values but i get a SQLITE_CONSTRAINT_ERROR
:
how do i delete all rows in a table?
i tried without transactions as well as using await tx.delete(users).all()
but it doesn't delete from the database.
i'm using https://turso.tech for sqlite on the edge.3 replies