Registry / devops / mysql-schema-compare

mysql-schema-compare

JSON →
library0.0.12jsnpmunverified

A CLI tool that compares MySQL schemas defined in .sql files (CREATE TABLE statements) against a live MySQL server database. It supports MySQL 5.x only and can compare tables (columns, data types, indexes, foreign keys), triggers, stored procedures, and views. Configuration can be done via CLI flags, environment variables, or .env file. Version 0.0.12 is the latest, but the project is a work in progress with limited documentation and no formal release cadence.

npm install mysql-schema-compare
INSTALL
IMPORT
SIG · MYSQL-SCHEMA-COMPA
M
mysql-schema-compare
devopsjavascriptv0.0.12
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
import mysqlSchemaCompare from 'mysql-schema-compare'
const mysqlSchemaCompare = require('mysql-schema-compare')
This is a CLI tool, not a library. It is meant to be run from the command line, not imported programmatically.

Compares the schema defined in schema.sql against the live MySQL database 'mydb'.

mysql-schema-compare --db-host=localhost --db-port=3306 --db-user=root --db-pass=myP@ss --db-name=mydb schema.sql
Debug
Known issues
gotchaTriggers and stored procedures require delimiter to be $$ (hardcoded in parser). Using a different delimiter will cause parsing errors.
fix
Ensure all trigger and stored procedure definitions use $$ as the delimiter.
affects: >=0.0.0
gotchaComments in triggers and stored procedures are compared as part of the body. If they are absent in the target database, differences will be reported.
fix
Import these objects to the database with the --comments flag, e.g., mysql --comments < file.sql
affects: >=0.0.0
gotchaOnly supports MySQL 5.x. MySQL 8.x features may not be parsed correctly.
fix
For MySQL 8.x, consider using a different tool.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Invalid configuration. Most probable some required parameter is missing
Missing required parameters like --db-host, --db-user, --db-pass, or --db-name.
fix
Ensure all required parameters are provided via CLI, environment variables, or .env file.
Error: Definitions parsing error (could happen when parsing database actual schema if unsupported element encountered)
The tool encountered an unsupported database object (e.g., events, functions, or MySQL 8.x features).
fix
Only use MySQL 5.x schemas without unsupported objects.
Error: Schemas differ
The schema in the .sql file does not match the live database schema.
fix
Review the differences reported by the tool and adjust either the definitions or the database accordingly.
Upgrade
Version history
0.0.12latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
mysql-schema-compare — npm install mysql-schema-compare · libregistry