Registry / database / node-baseline

node-baseline

JSON →
library0.2.7jsnpmunverified

A simple database migration and versioning tool for Node.js, focusing on MySQL databases. Version 0.2.7 (stable, last updated 2015) works by maintaining change logs in the database and incrementally updating the database using user-supplied SQL change scripts. It supports init, migrate, backup, and restore commands via CLI. Only MySQL is supported currently, with planned support for other databases. Requires Node.js >= 4.0.0. Configuration files support YAML, JSON, and Node module formats. The tool is minimal and aimed at database-first development teams.

npm install node-baseline
INSTALL
IMPORT
SIG · NODE-BASELINE
N
node-baseline
databasejavascriptv0.2.7
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.

baseline (CLI)
npm install -g node-baseline && baseline --help
npm install node-baseline --save-dev && node node_modules/.bin/baseline
The package is primarily a CLI tool, installed globally or via npx.
.baselinerc configuration
Create a .baselinerc file (YAML/JSON/JS) in project root
Create a config file named '.baselinerc.json' but with wrong format
Configuration can be any of YAML, JSON, or a Node module exporting an object. Use --config to specify a custom path.
baseline init
baseline init --config /path/to/.baselinerc
baseline init --database test --force
The --database flag is used to target a specific database from the configuration; --force reinitializes if baseline exists.

Initialize a MySQL database with baseline, create a migration script, and apply it.

npm install -g node-baseline # Create a configuration file .baselinerc.yaml: databases: test: host: localhost port: 3306 user: root password: '' database: test rootPath: ./db # Initialize baseline for the database: baseline init --config .baselinerc.yaml # Create a change script in ./db/test/changes/v01.01.sql: # ALTER TABLE users ADD COLUMN age INT; # Apply the migration: baseline up --config .baselinerc.yaml # Backup the database: baseline backup --config .baselinerc.yaml --output ./backups
Debug
Known issues
breakingNode.js version must be >= 4.0.0. Lower versions are not supported.
fix
Upgrade Node.js to version 4.0.0 or higher.
affects: <0.2.7
gotchaOnly MySQL is supported. Other databases will not work.
fix
Use a different migration tool for non-MySQL databases (e.g., Knex, Sequelize).
affects: >=0.0.0
gotchaBaseline uses a global install (`-g`). Local install requires `npx baseline` or full path to binary.
fix
If installed locally, run `npx baseline <command>`.
affects: >=0.0.0
deprecatedThe package has not been updated since 2015 and may have security vulnerabilities in its dependencies.
fix
Consider using actively maintained migration tools like node-pg-migrate, Umzug, or Flyway.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Database configuration not found. Please provide a valid config file.
Missing .baselinerc file or --config flag pointing to non-existent file.
fix
Create a .baselinerc file (YAML/JSON/JS) in the working directory or use --config with a correct path.
Error: connect ECONNREFUSED 127.0.0.1:3306
MySQL server not running or not accessible at the configured host/port.
fix
Start MySQL server or update the configuration with correct host/port.
Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password: NO)
No password provided or incorrect credentials.
fix
Add password field to the database configuration or provide correct credentials.
Upgrade
Version history
0.2.7latest on npm
Audit
Dependencies
mysqlrequiredMySQL database driver for database connections
yamljsoptionalParsing YAML configuration files
Agent activity
6 hits · last 30 days
node
6
Resources
node-baseline — npm install node-baseline · libregistry