@dbcube/cli
v5.3.4
Published
Command-line interface for DBCube: schema management (.cube files), migrations with rollback, seeders, triggers, TypeScript type generation and database introspection.
Maintainers
Readme
@dbcube/cli
Command-line interface for DBCube: schema management with .cube files, tracked migrations with rollback, seeders, triggers, TypeScript type generation and database introspection.
Installation
npm install -D @dbcube/cli
npx dbcube initCommands
| Command | Description |
|---|---|
| npx dbcube init | Scaffold a new project (config + dbcube/schema/ + example schema) |
| npx dbcube generate | Generate TypeScript types from .table.cube files → dbcube/types/index.ts |
| npx dbcube validate | Validate every .cube file without executing (exit 1 on errors — CI-friendly) |
| npx dbcube doctor | Diagnose config, binaries and database connectivity |
| npx dbcube dev | Watch mode: saving a .cube file applies it automatically |
| npx dbcube run database:create | Interactive database setup (config + physical creation) |
| npx dbcube run table:fresh | Drop and recreate all tables (asks for written confirmation; --force for CI) |
| npx dbcube run table:refresh | Apply schema changes without dropping data |
| npx dbcube run table:alter | Apply pending .alter.cube migrations (--dry-run, --all) |
| npx dbcube migrate:status | Show applied / pending / modified migrations |
| npx dbcube migrate:rollback | Revert the last migration batch |
| npx dbcube run pull [db] | Generate .table.cube files FROM an existing database (MySQL, PostgreSQL, SQLite) |
| npx dbcube run seeder:add | Run .seeder.cube data seeders |
| npx dbcube run trigger:fresh | Recreate triggers from .trigger.cube files |
| npx dbcube update | Check and update the Rust engine binaries |
| npx dbcube run download <engine> [ver] | Download a specific engine binary |
| npx dbcube -v | Versions of CLI, packages, engines, Node and platform |
Run npx dbcube help for the full reference.
Output language
English by default. Add --es to any command (or set DBCUBE_LANG=es) to
get the output in Spanish — only the messages change, not the commands or flags:
npx dbcube help --es
npx dbcube run table:refresh --esProject structure
init, run pull and Dbcube Studio organize generated files by type. The
engine discovers .cube files recursively, so a flat layout still works too:
dbcube/
├── schema/
│ ├── tables/ *.table.cube
│ ├── seeders/ *.seeder.cube
│ ├── triggers/ *.trigger.cube
│ └── alters/ *.alter.cube
└── types/
└── index.ts # dbcube generateConfiguration
dbcube.config.js (created by init):
module.exports = function (config) {
config.set({
databases: {
myapp: {
type: "sqlite", // mysql | postgres | sqlite | mongodb
config: { DATABASE: "myapp" }
}
}
});
};Documentation
https://dbcube.dev
License
MIT
