-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
I want to be able to diff commits using the following syntax
git diff <latest-commit> <earlier-commit>
and extract changes as MySQL queries.
Running a diff like this would create syntax like the following (for two commits to change the same table)
@@ -24,6 +24,8 @@ DROP TABLE IF EXISTS `test`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `test` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `new_column` varchar(200) DEFAULT NULL,
+ `another` int(200) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
or
@@ -24,8 +24,6 @@ DROP TABLE IF EXISTS `test`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `test` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `new_column` varchar(200) DEFAULT NULL,
- `another` int(200) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
For a simple change like this, the resulting query should be
ALTER TABLE `test` ADD COLUMN `new_column` varchar(200) DEFAULT NULL AFTER `id`;
ALTER TABLE `test` ADD COLUMN `another` int(200) NOT NULL AFTER `new_column`;
or
ALTER TABLE `test` DROP COLUMN `new_column`;
ALTER TABLE `test` DROP COLUMN `another`;
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels