You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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`;
The text was updated successfully, but these errors were encountered:
I want to be able to diff commits using the following syntax
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)
or
For a simple change like this, the resulting query should be
or
The text was updated successfully, but these errors were encountered: