Description:
hi, using mysqldbcompare with in this way
mysqldbcompare --server1=root@localhost --server2=root@localhost --changes-for=server2 --skip-data-check --run-all-tests --skip-table-options --show-reverse --difftype=sql db1:db2 > f:\tst.sql
executing the script produced to sync i receave many errors.
specifically, when updating FK tables. example:
ALTER TABLE `casino_gameround`
DROP FOREIGN KEY casino_gameround_fk1,
DROP FOREIGN KEY casino_gameround_fk2,
DROP INDEX casino_gameround_producttimestamp,
DROP INDEX casino_gameround_timestamp,
DROP INDEX casino_gameround_idx3,
DROP INDEX GAMEID,
DROP INDEX ID_PRODUCT,
DROP INDEX casino_gameround_idx2,
DROP INDEX casino_gameround_idx4,
DROP PRIMARY KEY,
ADD CONSTRAINT casino_gameround_fk1 FOREIGN KEY(ID_PRODUCT) REFERENCES `tooladmin_products`(ID_PRODUCT),
ADD CONSTRAINT casino_gameround_fk2 FOREIGN KEY(GAMEID) REFERENCES `casino_game`(ID_GAME),
ADD PRIMARY KEY(`ID_GAMEROUND`),
ADD INDEX casino_gameround_timestamp (TIMESTAMP),
ADD INDEX casino_gameround_producttimestamp (TIMESTAMP,ID_PRODUCT),
ADD INDEX casino_gameround_idx3 (DEVICEID),
ADD INDEX GAMEID (GAMEID),
ADD INDEX casino_gameround_idx2 (USERID),
ADD INDEX ID_PRODUCT (ID_PRODUCT),
ADD INDEX casino_gameround_idx4 (PRODUCTID);
There is a parameter to produce the change of FK subsequent modification of the tables?
like:
ALTER TABLE `casino_gameround`
DROP FOREIGN KEY casino_gameround_fk1,
DROP FOREIGN KEY casino_gameround_fk2,
DROP INDEX casino_gameround_producttimestamp,
DROP INDEX casino_gameround_timestamp,
DROP INDEX casino_gameround_idx3,
DROP INDEX GAMEID,
DROP INDEX ID_PRODUCT,
DROP INDEX casino_gameround_idx2,
DROP INDEX casino_gameround_idx4,
DROP PRIMARY KEY,
ADD PRIMARY KEY(`ID_GAMEROUND`),
ADD INDEX casino_gameround_timestamp (TIMESTAMP),
ADD INDEX casino_gameround_producttimestamp (TIMESTAMP,ID_PRODUCT),
ADD INDEX casino_gameround_idx3 (DEVICEID),
ADD INDEX GAMEID (GAMEID),
ADD INDEX casino_gameround_idx2 (USERID),
ADD INDEX ID_PRODUCT (ID_PRODUCT),
ADD INDEX casino_gameround_idx4 (PRODUCTID);
and
ALTER TABLE `casino_gameround`
ADD CONSTRAINT casino_gameround_fk1 FOREIGN KEY(ID_PRODUCT) REFERENCES `tooladmin_products`(ID_PRODUCT),
ADD CONSTRAINT casino_gameround_fk2 FOREIGN KEY(GAMEID) REFERENCES `casino_game`(ID_GAME) ;
How to repeat:
just have 2 db equal with linked tables with FK. then on one of the 2 to perform the changes so that the script identifies the differences.
Suggested fix:
if it is not already present, a parameter (eg --fk-after-tables) so you do not run into this problem (change struttra with data already present)