Description:
assume 2 tables, db1.TableA has primary key(Key1), db2.TableA has primary key(Key1, Key2).
i use mysqldbcompare to generate the SQL statements for data transformations to make db1.TableA the same as db2.TableA.
the output is :
ALTER TABLE db1.Table1 ADD PRIMARY KEY(Key2)
i think "DROP PRIMARY KEY" is omitted.
i think the output should be "ALTER TABLE db1.Table1 DROP PRIMARY KEY, ADD PRIMARY KEY(Key2)"
Another problem:
To generate the SQL statements for data transformations to make db1.TableA the same as db2.TableA, i need to run mysqldbcompare 3 times:
1. drop primary key(i think omitted) , add primary key(Key2)
2. drop primary key , add primary key(Key1,Key2)
3. insert delete update SQLs
Can i complete in 1 time: drop primary key, add primary key(Key1,Key2), insert delete update SQLs?
How to repeat:
create 2 tables, db1.TableA has primary key(Key1), db2.TableA has primary key(Key1, Key2), and input some records, then run mysqldbcompare --difftype=sql
Suggested fix:
sql_transform.py _get_indexes:
1. before "Generate DROP index clauses", if 2 tables has different primary keys and dest has more than 0 primary key, drop_indexes.append(" DROP PRIMARY KEY").
2. in "Generate DROP index clauses" , if index[2] == "PRIMARY": pass