Bug #80593 mysqldbcompare CREATE TABLE if not present on both sides
Submitted: 2 Mar 2016 22:24 Modified: 10 Sep 2016 9:49
Reporter: Shigh Phok Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Utilities Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: mysqldbcompare, mysqldiff

[2 Mar 2016 22:24] Shigh Phok
Description:
Currently mysqldbcompare (and mysqldiff for that matter) can detect when tables are present on one side and not the other - however the output will not include any CREATE TABLE statements required to bring parity.

The feature request is to include CREATE TABLE statements when needed. It would greatly benefit when using mysqldbcompare as part of automating database version control.

How to repeat:
$ mysql
CREATE DATABASE `a`; USE `a`;
CREATE TABLE `foo` ( `id` int(11) NOT NULL );
CREATE TABLE `test` ( `id` int(11) NOT NULL, `value` int(11) NOT NULL );
CREATE DATABASE `b`; USE `b`;
CREATE TABLE `test` ( `id` int(11) NOT NULL, `value` int(11) NOT NULL );
exit
$ mysqldbcompare --quiet --compact --difftype=sql --run-all-tests --server1=script:password@localhost:3306 a:b
[..]
# WARNING: Objects in server1.a but not in server1.b
# TABLE: foo

Suggested fix:
$ mysqldbcompare --quiet --compact --difftype=sql --run-all-tests --server1=script:password@localhost:3306 a:b
[..]
#
# Transformation for --changes-for=server1:
#

CREATE TABLE `foo` ( `id` int(11) NOT NULL );
[10 Sep 2016 9:49] MySQL Verification Team
Hello Shigh,

Thank you for the report and test case.

Thanks,
Umesh
[10 Sep 2016 9:54] MySQL Verification Team
Bug #75814 marked as duplicate of this