Tools for identifying changes to a MySQL schema
Pull request Compare This branch is 91 commits behind rcarver:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib
.gitignore
README
Rakefile
VERSION
mysql-inspector.gemspec

README

mysql-inspector is a simple tool for diffing and searching mysql dumps.

Why do I need that?

It helps you migrate your schema from one version to another.

Ok, how?

Say you have a project called zippers. Your development database is called
zippers_development. You're working on a branch called smoother, based on
master, which adds a new column metal_grade.

Start by storing the new state of your database.

% mysql-inspector --target --write zippers_development

This command says "store the state of the zippers_development database as my
target version".

Now, go back to your master branch and load its database into
zippers_development, then dump the contents.

% mysql-inspector --current --write zippers_development

Now, in order to write database migrations for master to smoother let's see
what changes occurred.

% mysql-inspector --diff

[[ show sample output ]]

Here we see that our target version contains one column that the current
version does not. It's easy to write an alter statement, in fact most of the
information is right here.

mysql% alter table zippers add column metal_grade int(11) NOT NULL DEFAULT '0';

Now we can compare the two again. This time we need to add the --force
argument to say that it's ok to overwrite the previous dump. We'll also go
ahead and run the diff.

% mysql-inspector --current --write zippers_development --force --diff

No differences!

That was pretty simple. Is there more?

Sure.

License: MIT