Hi Eric,
I am trying your code. I will put a revised version on the patch tracker, so that future discussions about it are easier to follow.
The first things I modified are:
- add a hidden db variable to the form, to propagate db - remove the call to PMA_SQP_analyse (what did you want to do with this?)
Marc
Eric Persson wrote:
Hi everyone,
Some of you might remember I asked for a structure diff earlier, I want to compare 2 tables and get an alter query which would make the target table to look exactly like the original table.
I have now made a small hack which almost does this, at least it show the idea of what I want it to be.
I added the file diff_tables.php which currently takes ?db as an get argument. It shows the table in that database and you can pick 2 tables to compare and you get a hopefully working alter query. :)
I modified left.php to show a link after the num_tables, like (diff) which goes to diff_tables.php with ?db as the database.
If you want to try it out, patch your 2.3.2 version of phpmyadmin with the files, or visit http://www.egp.cx/phpMyAdmin-2.3.2/ where I put up a patched version. Please dont destroy the tables to much. :)
Some ideas of what to improve:
- maintain the order of the fields
- maintain keys/indexes and auto_increment fields
- make it possible to diff tables between databases
- make it possible to diff create table queries
- create a nice graphical view over whats added/changed/dropped
Do you have any furhter suggestions?
Please comment and try it out and think about it. The code is still very hacky, and I might have re-invented the wheel in some places, but I'm not yet familiar with all libraryfiles etc.
Best regards, Eric