Files
julian 21bd0f6227 fix(db): point db:migrate at the live appliance DB by default
`db:migrate` (and drizzle-kit's config default) resolved DATABASE_URL to
`./parking.sqlite` relative to packages/db — a stray, half-empty leftover DB,
not the real store at apps/server/parking.sqlite. Running `pnpm --filter
@parking/db db:migrate` with no env therefore migrated the wrong file and
failed on its broken state, while the real DB went untouched.

Default DATABASE_URL to ../../apps/server/parking.sqlite in both the db:migrate
script and drizzle.config.ts (an explicit DATABASE_URL still overrides). The
stray packages/db/parking.sqlite was untracked + already gitignored (*.sqlite);
deleted it from disk. Now `pnpm --filter @parking/db db:migrate` targets the
appliance DB out of the box.

Claude-Session: https://claude.ai/code/session_01Xcm6ikLgGoCxxHrxtjkk5V
2026-06-20 18:32:44 +02:00

17 lines
710 B
TypeScript

import { defineConfig } from "drizzle-kit";
// Local store is SQLite (single-site, single-writer, WAL). The same schema is
// designed to port to PostgreSQL for the deferred remote sync target — that is
// a durability/anti-fraud decision, not a capacity one. See wiki/entities/sqlite.
export default defineConfig({
dialect: "sqlite",
schema: "./src/schema.ts",
out: "./drizzle",
dbCredentials: {
// Default to the live appliance DB (apps/server), NOT a stray ./parking.sqlite in
// this package. The `db:migrate` script also sets DATABASE_URL to this. Override with
// DATABASE_URL to target another DB.
url: process.env.DATABASE_URL ?? "../../apps/server/parking.sqlite",
},
});