Connection ownership and migrations
Make the native target responsible for its connection, schema readiness and recovery.
Give each connection one owner
Open during startup; close after outstanding operations settle. Use the adapter's close method as the sole owner, rather than also closing the native client.
The adapter enables foreign keys and strict binding, checks filenames and cleans up failed initialization. The host owns the private directory and exclusive recovery. This does not protect against hostile local users or every filesystem race.
Apply migrations explicitly
import { migrate } from "drizzle-orm/bun-sqlite/migrator";
// connection is the application-owned Drizzle connection.
migrate(connection.database, { migrationsFolder: "./migrations" });Generate and review migrations with native Drizzle tooling. Choose startup or a separate deployment task to apply them; opening the connection never migrates automatically. Back up important data before destructive changes.
SQLite transactions are synchronous; nonzero busy waits can block the host. Recovery, repair, retention and backups remain application responsibilities.
See Testing and verification and Build and deployment for project-level procedures.