How auto push schema and seed data when starting NextJS using Drizzle (with Docker)

I have an NextJS 15 app using Drizzle. ANd I would like to auto push and seed the data when starting the app. But how to do it ? I dont find any info about this... Btw there is my package.json :
{
...
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
"start": "npm run db:push && npm run db:seed && next start",
"lint": "next lint",
"type-check": "tsc -b",
"format": "prettier --write .",
"lint:fix": "next lint --fix",
"db:generate": "drizzle-kit generate",
"db:migrate": "drizzle-kit migrate",
"db:drop": "drizzle-kit drop",
"db:push": "drizzle-kit push",
"db:pull": "drizzle-kit pull",
"db:studio": "drizzle-kit studio",
"db:seed": "node -r esbuild-register ./src/db/seed.ts"
},
"dependencies": {
"drizzle-orm": "^0.39.3",
...
},
"devDependencies": {
"drizzle-kit": "^0.30.4",
...
}
}
{
...
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
"start": "npm run db:push && npm run db:seed && next start",
"lint": "next lint",
"type-check": "tsc -b",
"format": "prettier --write .",
"lint:fix": "next lint --fix",
"db:generate": "drizzle-kit generate",
"db:migrate": "drizzle-kit migrate",
"db:drop": "drizzle-kit drop",
"db:push": "drizzle-kit push",
"db:pull": "drizzle-kit pull",
"db:studio": "drizzle-kit studio",
"db:seed": "node -r esbuild-register ./src/db/seed.ts"
},
"dependencies": {
"drizzle-orm": "^0.39.3",
...
},
"devDependencies": {
"drizzle-kit": "^0.30.4",
...
}
}
My db:push and db:seed are working in local dev Thx a lot !
1 Reply
chawn
chawn2d ago
What's happening with your start script?

Did you find this page helpful?