Skip to content

SemProvoost/mysql-schema-compare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MySQL Schema Compare

A tool to compare two MySQL database schemas and highlight differences. Useful for database migrations, version control, and ensuring consistency between environments.

Features

  • Compare table structures, indexes, and constraints
  • Generate reports of schema differences

1. Install dependencies

npm install

2. Set up environment variables

Copy the example environment file and fill in your MySQL connection details.

cp .env.example .env

Edit the .env file to provide the necessary configuration.

3. Generate migration queries

npm run start

This will compare the schemas and generate SQL queries in the output folder.

4. Apply migration queries to the database

npm run apply

This will execute the generated queries on the target database.

Make sure your MySQL connection details are configured as required by the project.

Optional flags for npm run apply:

  • --include-indexes: Also execute queries that update indexes.

Example:

npm run apply -- --include-indexes

This will apply both schema and index changes to the target database.

Contributing

Contributions are welcome! To contribute:

  1. Fork this repository.
  2. Create a new branch for your feature or bugfix.
  3. Make your changes and add tests if applicable.
  4. Submit a pull request with a clear description of your changes.

Please follow the existing code style and conventions.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published