Database troubleshooting
TurboPanel uses versioned SQL migrations in turbopanel/migrations/ (applied via pnpm migrate; tracked in public.migration). Deno dev can still use drizzle-kit push (dev/scripts/sync.sh) for quick schema iteration without committing migration files. For how schema sync fits into the dev environment, see Development architecture and turbopanel/src/db/AGENTS.md in the repository.
Schema out of sync
| Issue | What to do |
|---|---|
| API errors about missing columns/tables | From dev/: ./scripts/sync.sh (or ./scripts/sync.sh --force after editing schema.ts) |
| You changed the DB in Studio | Run dev/scripts/introspect.sh to pull live schema into turbopanel/src/db/schema.ts |
| Fresh Postgres volume | Converge applies versioned migrations (pnpm migrate via scripts/bootstrap-dev-db.sh) — the only fresh-database bootstrap path. Re-run Developer → Converge / re-converge if relations are missing |
Connection failures
| Issue | What to do |
|---|---|
| Postgres unreachable | Check the turbopanel-database container (docker ps / Services area in ./console); verify Docker is running |
| Wrong credentials | Postgres credentials are generated during converge under /etc/turbopanel/; re-run Developer → Converge / re-converge |
| Connection pool wedged (Deno) | systemctl restart turbopanel-instance (or restart it from the console Services area) |
Reset dev database
Dev console: Developer → Reset dev database (asks for confirmation) — drops the public schema, re-applies the migrations, and restarts the instance into the install wizard.
Manual:
# From dev/ with Postgres running
./scripts/sync.sh --force # push schema.ts for quick iteration; to rebuild from migrations use Reset dev databaseNuclear (dev only): stop the instance (systemctl stop turbopanel-instance), remove the Postgres container and its data volume (docker rm -f turbopanel-database && docker volume rm turbopanel-database), then Developer → Converge / re-converge (recreates empty Postgres and applies migrations).
Drizzle Studio
- Enable it from the Services list in
./console(Drizzle Studio is on by default in the optional-services picker). - Open
https://local.drizzle.studio?host=localhost&port=4983. - Studio applies DDL directly — follow with
dev/scripts/introspect.shto pull changes intoschema.ts. - Close Studio before running
dev/scripts/sync.shto avoid connection contention.
Do not run (current policy)
- Raw
drizzle-kit pushoutsidedev/scripts/sync.sh/dev/scripts/introspect.shworkflows (usedev/scripts/sync.shfor Deno dev push) - Applying or committing migration SQL without reviewing generated files under
migrations/
Manual debugging
# From dev/
./scripts/sync.sh --verbose
docker exec -it turbopanel-database psql -U turbopanel -d turbopanel -c '\dt'Related
Last updated on