From Eric Persson:
----------------------------
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
diff_tables.php by Eric Persson
Logged In: YES
user_id=210714
Version 2:
- hidden db variable
- all code with .php3 extension (because our code base
requires it)
to maybe colorize (maybe because some users may have
configured to not colorize):
$parsed_sql = PMA_SQP_parse($the_query);
$maybe_colorized = PMA_formatSql($parsed_sql);
Version 2 by lem9
Logged In: YES
user_id=640012
I'm currently working on the next version which will implement
field order and key maintenance.
Logged In: YES
user_id=210714
Any news about the next version?
Logged In: YES
user_id=192186
Any progress here?
I just found simmilar thing written in perl:
http://adamspiers.org/computing/mysqldiff/
Logged In: NO
Maybe you want to use mysqldiff (http://www.mysqldiff.org).
Logged In: YES
user_id=15563
hey, got exactely the same request from a coworker this
afternoon: this would really be a nice feature...
we could start by allowing the comparaison of tables of the
same DB, and then expand the system to other DB/servers.
Implemented in 3.3 (synchronize feature).