Database operations
Use reviewed migrations and explicit administrative commands.
Core uses MikroORM's native entity registry. Migration files and snapshots belong to the application because its plugin registry determines its schema.
Routine commands
From the repository root, corepack pnpm db:migrate and corepack pnpm db:seed target full. Seed creates configured roles and does not assign an owner.
For minimal, select its package explicitly:
corepack pnpm --filter @hackkit/template-nextjs-minimal db:migrate
corepack pnpm --filter @hackkit/template-nextjs-minimal db:seed
corepack pnpm --filter @hackkit/template-nextjs-minimal db:status
corepack pnpm --filter @hackkit/template-nextjs-minimal db:checkdb:status reports executed and pending migrations. db:check verifies migration history, entity/snapshot agreement, and live schema drift.
Change the schema
After changing registered entities, run db:generate in the selected application. Review every generated statement and the snapshot before committing. Test the upgrade against existing data as well as a fresh database.
db:rollback rolls back the most recent migration. Review the down migration and take a backup first. db:reset drops local SQLite data and is restricted to development and test environments; it is not a production recovery tool.
Drivers
Full supports SQLite, libSQL, PostgreSQL, and MySQL. Integration coverage includes both local and HTTP libSQL. Minimal intentionally uses SQLite. Each template has its own migrations. Do not copy full's plugin tables into minimal.