Migrate from DB plugins
Move from official database plugins to native client.db.
Official database plugins are deprecated. Native DB is built into @djs-core/runtime — same Drizzle stack, simpler setup.
Third-party plugins using definePlugin are not affected. Only official @djs-core/plugin-* database packages are deprecated.
From @djs-core/plugin-drizzle
Remove the plugin
Remove from
djs.config.ts:// Beforeplugins: [import("@djs-core/plugin-drizzle")],pluginsConfig: { drizzle: { dialect: "sqlite" } },// After — add native db block insteaddb: { dialect: "sqlite", autoMigrate: true },Uninstall:
bun remove @djs-core/plugin-drizzleMove schema folder
Move
src/db/schema.ts→db/schema.ts(project root).Move migrations from
drizzle/→db/migrations/if you had generated migrations.Update imports and client access
// Beforeimport * as schema from "../../../db/schema";await interaction.client.drizzle.select().from(schema.users);// Afterimport { schema } from "@djs-core/db";await interaction.client.db.select().from(schema.users);Update CLI commands
Before After djs-core drizzle generatedjs-core db generatedjs-core drizzle migratedjs-core db migratedjs-core drizzle pushdjs-core db pushdjs-core drizzle studiodjs-core db studioDelete
drizzle.config.ts— config is synced fromdjs.config.ts.
From @djs-core/plugin-sql
Raw SQL on client.sql has no direct equivalent in native DB — migrate to Drizzle queries.
Add native db config
db: { dialect: "sqlite", autoMigrate: true },Run
djs-core db init, define tables indb/schema.ts, thendjs-core db generate && djs-core db migrate.Replace client.sql calls
// Beforeclient.sql.run`INSERT INTO todos (task) VALUES (${task})`;client.sql.execute`SELECT * FROM todos`;// Afterimport { schema } from "@djs-core/db";await client.db.insert(schema.todos).values({ task });await client.db.select().from(schema.todos);Remove plugin
Remove
import("@djs-core/plugin-sql")andpluginsConfig.sqlfromdjs.config.ts. Uninstall:bun remove @djs-core/plugin-sql
Remove table creation from ready events — migrations handle schema.
From @djs-core/plugin-prisma-sqlite
Prisma has no native equivalent yet. Options:
- Migrate to Drizzle (recommended) — rewrite schema in
db/schema.tsand queries withclient.db - Keep Prisma as a third-party dependency — use Prisma directly without the official plugin, or wait for a native Prisma path
Checklist
-
db:block indjs.config.ts - Schema in
db/schema.ts -
client.drizzle/client.sql→client.db - CLI:
djs-core dbinstead ofdjs-core drizzle - Official DB plugins removed from
pluginsandpackage.json - Run
djs-core db generate && djs-core db migrate
See the Database guide for full setup.