Reputation: 1109
Are there libraries that focus on taking two database exports, finding the differences and creating update/alter statements for it? Basically an update script from export A to export B.
For instance this:
-- Version 1
CREATE TABLE IF NOT EXISTS `mytable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- Version 2
CREATE TABLE IF NOT EXISTS `mytable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`description` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- Would result in this:
ALTER TABLE `mytable`
ADD `description` text;
Edit: this question is related to libraries for MySQL, not tools.
Upvotes: 2
Views: 1407
Reputation: 5743
This node module could be useful. It diffs live databases, but then it should be simple to create a live database from an SQL dump.
https://github.com/contra/dbdiff
Upvotes: 0
Reputation: 3221
RedGate http://www.red-gate.com/products/sql-development/sql-compare/index-b offer a very good and stable solution to this.
I believe ultimate edition of Visual Studio 2010 can also compare schemas however I'm not sure if it will generate the ALTER scripts for you.
Edit: I just remembered this http://opendbiff.codeplex.com/ too however I didn't have much luck when I last looked at it.
Upvotes: 0