Registry / database / dana
library1.0.0jsnpmunverified

Dana is a simple, small, and framework-agnostic database schema migration CLI for Node.js, currently supporting MySQL only. It auto-generates migration files by tracking changes in user-defined model files (JavaScript objects describing tables), similar to how Git tracks file changes. Version 1.0.0 is current; no frequent releases reported. Key differentiators: no API to learn (models are plain JS objects), migrations are YAML-based with embedded SQL, built-in rollback support, and model validation before migration generation. Unlike Rails or Knex migrations, users never write migration code manually — dana produces diff-based migration files from model changes.

npm install dana
INSTALL
IMPORT
SIG · DANA
D
dana
databasejavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const dana = require('dana')
dana is primarily a CLI tool, not a library; the package exports a module but usage via require is uncommon.
model definition
module.exports = { tableName: '...', schema: { columns: {...}, indexes: [...] }, _fid: '...' }
Models are exported as CommonJS modules in separate files. No import needed for dana itself.
CLI usage
npx dana migrate:make
dana init
Valid commands: 'dana migrate:make', 'dana migrate:run', 'dana migrate:rollback' etc. 'init' invokes interactive setup.

Shows basic dana workflow: install, initialize, create a model file, generate migration, run, and rollback.

// Install globally or locally npm install -g dana # Or: npm install --save-dev dana # Initialize dana in your project (creates a config file) dana init # Create a model file (e.g., models/post.js) mkdir -p models cat > models/post.js << 'EOF' module.exports = { tableName: 'posts', schema: { columns: { 'title': { type: 'varchar', nullable: false }, 'slug': 'varchar', 'body': 'text' } }, _fid: 'abc123' } EOF # Generate a migration file from current model state dana migrate:make # Run pending migrations dana migrate:run # Rollback last migration dana migrate:rollback
Debug
Known issues
breakingMySQL only — no PostgreSQL, SQLite, or other DB support
fix
Use a different tool if you need multi-DB support (e.g., knex, db-migrate).
affects: <=1.0.0
gotchaThe `_fid` field in models must be unique per model; dana uses it to track changes across migrations
fix
Always include a unique `_fid` value (e.g., a short UUID or random string) in each model file.
affects: >=0.1.0
gotchadana does not support spatial or JSON MySQL data types
fix
Avoid using those column types; manually edit generated SQL if needed.
affects: <=1.0.0
deprecatedPackage appears unmaintained: last update was 5+ years ago, no recent releases
fix
Consider using an actively maintained migration tool like knex or db-migrate.
affects: all
gotchaModel files must export an object using `module.exports` — ES module syntax (`export default`) is not supported
fix
Use CommonJS (`module.exports = {...}`) when defining models.
affects: <=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'dana'
dana not installed or not in PATH
fix
Install globally: `npm install -g dana` or use `npx dana`
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/dana'
Missing write permissions for global npm install
fix
Use `sudo npm install -g dana` or install locally with `npm install --save-dev dana` and run via npx
Error: ER_PARSE_ERROR: You have an error in your SQL syntax
Generated SQL contains unsupported syntax or invalid column definitions
fix
Review generated YAML migration file and manually correct SQL for any unsupported data types (e.g., JSON, spatial)
Error: No models found
Models directory not set or empty
fix
Set correct models path in .danarc or ensure models exist in the default ./models directory
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
mysqlrequiredNative MySQL driver for database connections
commanderrequiredCLI command parsing
Agent activity
12 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
packagedana
dana — npm install dana · libregistry